[nautilus/freedesktop-dbus: 6/9] Implement ShowItems()



commit 08b590a4c6014d6a91a525b3183d3266788703a4
Author: Akshay Gupta <kitallis gmail com>
Date:   Tue Dec 6 15:08:08 2011 -0600

    Implement ShowItems()
    
    Unfortunately g_application_open() and NautilusApplication don't actually
    use the startup_id.  We will have to pass this in another fashion
    later.

 src/nautilus-freedesktop-dbus.c |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-freedesktop-dbus.c b/src/nautilus-freedesktop-dbus.c
index 087350f..99c1bea 100644
--- a/src/nautilus-freedesktop-dbus.c
+++ b/src/nautilus-freedesktop-dbus.c
@@ -44,6 +44,35 @@ static GDBusObjectManagerServer *object_manager;
 /* Our DBus implementation skeleton */
 static NautilusFreedesktopFileManager1 *skeleton;
 
+
+static gboolean
+skeleton_handle_show_items_cb (NautilusFreedesktopFileManager1 *object,
+			       GDBusMethodInvocation *invocation,
+			       const gchar *const *uris,
+			       const gchar *startup_id)
+{
+	int i;
+
+	for (i = 0; uris[i] != NULL; i++) {
+		GFile *file;
+		GFile *files[1];
+
+		file = g_file_new_for_uri (uris[i]);
+		files[0] = file;
+
+		/* FIXME: we are not using the startup_id.  This is not
+		 * what g_application_open() expects, and neither does
+		 * NautilusApplication internally.
+		 */
+		g_application_open (G_APPLICATION (application), files, 1, "");
+		g_object_unref (file);
+	}
+
+	nautilus_freedesktop_file_manager1_complete_show_items (object, invocation);
+	return TRUE;
+}
+
+
 static void
 bus_acquired_cb (GDBusConnection *conn,
 		 const gchar     *name,
@@ -56,6 +85,9 @@ bus_acquired_cb (GDBusConnection *conn,
 
 	skeleton = nautilus_freedesktop_file_manager1_skeleton_new ();
 
+	g_signal_connect (skeleton, "handle-show-items",
+			  G_CALLBACK (skeleton_handle_show_items_cb), NULL);
+
 	g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (skeleton), connection, "/org/freedesktop/FileManager1", NULL);
 
 	g_dbus_object_manager_server_set_connection (object_manager, connection);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]