Using org.gtk.MountOperationHandler

"W. Michael Petullo" <[email protected]> Tue, 17 Dec 2019 19:14:24 -0500
Newsgroups gmane.comp.gnome.devel
Message-ID <[email protected]>
--===============5664422036466967224==
Content-Type: multipart/alternative; boundary="=-cDcqL/rQ0GkkO3yQQsjR"

--=-cDcqL/rQ0GkkO3yQQsjR
Content-Type: text/plain; charset=us-ascii; format=flowed

I would expect the following program to cause gnome-shell to prompt for 
a password:

#include <gtk/gtk.h>
#include <assert.h>
#include <string.h>

int main(void)
{
        GMountOperation *mount_op;
        GAskPasswordFlags flags;
        char *message;

        mount_op = gtk_mount_operation_new(NULL);
        flags = G_ASK_PASSWORD_NEED_PASSWORD | 
G_ASK_PASSWORD_SAVING_SUPPORTED;
        message = g_strdup("Enter password");

        g_signal_emit_by_name(mount_op, "ask-password", message, 
"test", "test", flags);

        g_free(message);
}

It does not. (In the full code I register a callback to capture the 
password.)

There is a conditional in GTK/gtkmountoperation.c's handler of 
"ask-password" that chooses between a direct GTK dialog box and a proxy 
that passes the request along using dbus. If I wrap this code in the 
necessary GTK boilerplate and adjust the flags to force GTK, then I get 
a password prompt. But I do not get a password prompt if execution 
follows the proxy path.

I am using gnome-shell-3.34.2 that happens to be running on Fedora 31. 
My GNOME shell seems to provide the org.freedesktop.DBus.ListNames 
service:

$ dbus-send --session --dest=org.freedesktop.DBus --type=method_call 
--print-reply /org/freedesktop/DBus org.freedesktop.DBus.ListNames | 
grep Mount
      [...]
      string "org.gtk.MountOperationHandler"

What might be wrong?

The reason for my question is that I am trying to fix a bug in 
Rhythmbox's DAAP plugin.

--
Mike

:wq


--=-cDcqL/rQ0GkkO3yQQsjR
Content-Type: text/html; charset=us-ascii

<div id="geary-body" dir="auto"><div>I would expect the following program to cause gnome-shell to prompt for a password:</div><div><br></div><div><div>#include &lt;gtk/gtk.h&gt;</div><div>#include &lt;assert.h&gt;</div><div>#include &lt;string.h&gt;</div><div><br></div><div>int main(void)</div><div>{</div><div>&nbsp; &nbsp; &nbsp; &nbsp; GMountOperation *mount_op;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; GAskPasswordFlags flags;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; char *message;</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; mount_op = gtk_mount_operation_new(NULL);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; flags = G_ASK_PASSWORD_NEED_PASSWORD | G_ASK_PASSWORD_SAVING_SUPPORTED;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; message = g_strdup("Enter password");</div><d
 iv><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; g_signal_emit_by_name(mount_op, "ask-password", message, "test", "test", flags);</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; g_free(mes
 sage);</
 div><div>}</div></div><div><br></div><div>It does not. (In the full code I register a callback to capture the password.)</div><div><br></div><div>There is a conditional in GTK/gtkmountoperation.c's handler of "ask-password" that chooses between a direct GTK dialog box and a proxy that passes the request along using dbus. If I wrap this code in the necessary GTK boilerplate and adjust the flags to force GTK, then I get a password prompt. But I do not get a password prompt if execution follows the proxy path.</div><div><br></div><div>I am using&nbsp;gnome-shell-3.34.2 that happens to be running on Fedora 31. My GNOME shell seems to provide the org.freedesktop.DBus.ListNames service:</div><div><br></div><div><div>$ dbus-send --session --dest=org.freedesktop.DBus --type=method_call --print-re
 ply /org/freedesktop/DBus org.freedesktop.DBus.ListNames | grep Mount</div><div>&nbsp; &nbsp; &nbsp; [...]</div><div>&nbsp; &nbsp; &nbsp; string "org.gtk.MountOperationHandler"</div></div><d
 iv><br><
 /div><div>What might be wrong?</div><div><br></div><div>The reason for my question is that I am trying to fix a bug in Rhythmbox's DAAP plugin.</div><div><br></div><div>--</div><div>Mike</div><div><br></div><div>:wq</div></div>
--=-cDcqL/rQ0GkkO3yQQsjR--


--===============5664422036466967224==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
gnome-devel-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gnome-devel-list

--===============5664422036466967224==--