Add GetMountPoint method for document portal

This is both to get the mount path and to have a nice way
to activate the mount.
tingping/wmclass
Alexander Larsson 2015-07-10 17:02:38 +02:00
parent 929071ad10
commit 4c4c66fc2d
4 changed files with 18 additions and 0 deletions

View File

@ -25,6 +25,9 @@
<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
<interface name='org.freedesktop.portal.Documents'>
<method name="GetMountPoint">
<arg type='ay' name='path' direction='out'/>
</method>
<method name="Add">
<arg type='s' name='uri' direction='in'/>
<arg type='u' name='doc_id' direction='out'/>

View File

@ -1724,6 +1724,12 @@ static struct fuse_session *session = NULL;
static struct fuse_chan *main_ch = NULL;
static char *mount_path = NULL;
const char *
xdp_fuse_get_mountpoint (void)
{
return mount_path;
}
void
xdp_fuse_exit (void)
{

View File

@ -9,6 +9,7 @@ G_BEGIN_DECLS
gboolean xdp_fuse_init (XdpDocDb *db,
GError **error);
void xdp_fuse_exit (void);
const char * xdp_fuse_get_mountpoint (void);
G_END_DECLS

View File

@ -347,6 +347,13 @@ handle_method (GCallback method_callback,
return TRUE;
}
static gboolean
handle_get_mount_point (XdpDbusDocuments *object, GDBusMethodInvocation *invocation)
{
xdp_dbus_documents_complete_get_mount_point (object, invocation, xdp_fuse_get_mountpoint ());
return TRUE;
}
static void
on_bus_acquired (GDBusConnection *connection,
const gchar *name,
@ -357,6 +364,7 @@ on_bus_acquired (GDBusConnection *connection,
helper = xdp_dbus_documents_skeleton_new ();
g_signal_connect_swapped (helper, "handle-get-mount-point", G_CALLBACK (handle_get_mount_point), NULL);
g_signal_connect_swapped (helper, "handle-add", G_CALLBACK (handle_method), portal_add);
g_signal_connect_swapped (helper, "handle-add-local", G_CALLBACK (handle_method), portal_add_local);
g_signal_connect_swapped (helper, "handle-grant-permissions", G_CALLBACK (handle_method), portal_grant_permissions);