[nautilus-actions] Instanciate a D-Bus object below the rooted manager



commit 6f149bbb0e55bb681de0406a663d6f354790b665
Author: Pierre Wieser <pwieser trychlos org>
Date:   Mon Jan 30 23:12:07 2012 +0100

    Instanciate a D-Bus object below the rooted manager

 ChangeLog                        |    5 +++++
 src/plugin-tracker/na-tracker.c  |   19 ++++++++++---------
 src/utils/nautilus-actions-run.c |   10 +++++-----
 tools/dbus-introspect.sh         |    2 +-
 4 files changed, 21 insertions(+), 15 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index accf057..e86ae16 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2012-01-30 Pierre Wieser <pwieser trychlos org>
 
+	* src/plugin-tracker/na-tracker.c:
+	* src/utils/nautilus-actions-run.c:
+	* tools/dbus-introspect.sh: Instanciate an object below the rooted
+	manager.
+
 	* docs/reference/nautilus-actions-docs.xml: Add new symbols for 3.2.
 
 	* src/nact/nact-tree-model.c: Define window, treeview and mode properties.
diff --git a/src/plugin-tracker/na-tracker.c b/src/plugin-tracker/na-tracker.c
index d770ccd..65c9e51 100644
--- a/src/plugin-tracker/na-tracker.c
+++ b/src/plugin-tracker/na-tracker.c
@@ -65,7 +65,7 @@ struct _NATrackerPrivate {
 	gboolean                  dispose_has_run;
 #ifdef HAVE_GDBUS
 	guint                     owner_id;	/* the identifier returns by g_bus_own_name */
-	GDBusObjectManagerServer *server;
+	GDBusObjectManagerServer *manager;
 #endif
 	GList                    *selected;
 };
@@ -240,7 +240,7 @@ initialize_dbus_connection( NATracker *tracker )
 	 * instantiation takes care of installing introspection infos
 	 */
 	dbus_g_object_type_install_info( NA_TYPE_TRACKER, &dbus_glib_na_tracker_dbus_object_info );
-	dbus_g_connection_register_g_object( connection, NAUTILUS_ACTIONS_DBUS_TRACKER_PATH, G_OBJECT( tracker ));
+	dbus_g_connection_register_g_object( connection, NAUTILUS_ACTIONS_DBUS_TRACKER_PATH "/0", G_OBJECT( tracker ));
 
 	g_debug( "%s: registering tracker path is ok", thisfn );
 # endif /* HAVE_DBUS_GLIB */
@@ -266,13 +266,13 @@ on_bus_acquired( GDBusConnection *connection, const gchar *name, NATracker *trac
 	/* create a new org.freedesktop.DBus.ObjectManager rooted at
 	 *  /org/nautilus_actions/DBus/Tracker
 	 */
-	tracker->private->server = g_dbus_object_manager_server_new( NAUTILUS_ACTIONS_DBUS_TRACKER_PATH );
+	tracker->private->manager = g_dbus_object_manager_server_new( NAUTILUS_ACTIONS_DBUS_TRACKER_PATH );
 
 	/* create a new D-Bus object at the path
 	 *  /org/nautilus_actions/DBus/Tracker
 	 *  (which must be same or below than that of object manager server)
 	 */
-	tracker_object = na_tracker_object_skeleton_new( NAUTILUS_ACTIONS_DBUS_TRACKER_PATH );
+	tracker_object = na_tracker_object_skeleton_new( NAUTILUS_ACTIONS_DBUS_TRACKER_PATH "/0" );
 
 	/* make a newly created object export the interface
 	 *  org.nautilus_actions.DBus.Tracker.Properties1
@@ -290,15 +290,16 @@ on_bus_acquired( GDBusConnection *connection, const gchar *name, NATracker *trac
 			G_CALLBACK( on_properties1_get_selected_paths ),
 			tracker );
 
-	/* last export the DBus object on the object manager server
+	/* and export the DBus object on the object manager server
 	 * (which takes its own reference on it)
 	 */
-	g_dbus_object_manager_server_export( tracker->private->server, G_DBUS_OBJECT_SKELETON( tracker_object ));
+	g_dbus_object_manager_server_export( tracker->private->manager, G_DBUS_OBJECT_SKELETON( tracker_object ));
 	g_object_unref( tracker_object );
 
 	/* and connect the object manager server to the D-Bus session
+	 * exporting all attached objects
 	 */
-	g_dbus_object_manager_server_set_connection( tracker->private->server, connection );
+	g_dbus_object_manager_server_set_connection( tracker->private->manager, connection );
 }
 
 static void
@@ -345,8 +346,8 @@ instance_dispose( GObject *object )
 		if( priv->owner_id ){
 			g_bus_unown_name( priv->owner_id );
 		}
-		if( priv->server ){
-			g_object_unref( priv->server );
+		if( priv->manager ){
+			g_object_unref( priv->manager );
 		}
 #endif
 
diff --git a/src/utils/nautilus-actions-run.c b/src/utils/nautilus-actions-run.c
index 105ca7d..b4a1386 100644
--- a/src/utils/nautilus-actions-run.c
+++ b/src/utils/nautilus-actions-run.c
@@ -285,7 +285,7 @@ targets_from_selection( void )
 			&error );
 
 	if( !manager ){
-		g_printerr( "%s: unable to allocate an ObjectManagerClient: %s", thisfn, error->message );
+		g_printerr( "%s: unable to allocate an ObjectManagerClient: %s\n", thisfn, error->message );
 		g_error_free( error );
 		return( NULL );
 	}
@@ -294,16 +294,16 @@ targets_from_selection( void )
 	g_debug( "%s: name_owner=%s", thisfn, name_owner );
 	g_free( name_owner );
 
-	object = g_dbus_object_manager_get_object( manager, NAUTILUS_ACTIONS_DBUS_TRACKER_PATH );
+	object = g_dbus_object_manager_get_object( manager, NAUTILUS_ACTIONS_DBUS_TRACKER_PATH "/0" );
 	if( !object ){
-		g_printerr( "%s: unable to get object at %s path", thisfn, NAUTILUS_ACTIONS_DBUS_TRACKER_PATH );
+		g_printerr( "%s: unable to get object at %s path\n", thisfn, NAUTILUS_ACTIONS_DBUS_TRACKER_PATH "/0" );
 		g_object_unref( manager );
 		return( NULL );
 	}
 
 	iface = g_dbus_object_get_interface( object, NAUTILUS_ACTIONS_DBUS_TRACKER_IFACE );
 	if( !iface ){
-		g_printerr( "%s: unable to get %s interface", thisfn, NAUTILUS_ACTIONS_DBUS_TRACKER_IFACE );
+		g_printerr( "%s: unable to get %s interface\n", thisfn, NAUTILUS_ACTIONS_DBUS_TRACKER_IFACE );
 		g_object_unref( object );
 		g_object_unref( manager );
 		return( NULL );
@@ -335,7 +335,7 @@ targets_from_selection( void )
 
 	proxy = dbus_g_proxy_new_for_name( connection,
 			NAUTILUS_ACTIONS_DBUS_SERVICE,
-			NAUTILUS_ACTIONS_DBUS_TRACKER_PATH,
+			NAUTILUS_ACTIONS_DBUS_TRACKER_PATH "/0",
 			NAUTILUS_ACTIONS_DBUS_TRACKER_IFACE );
 
 	if( !proxy ){
diff --git a/tools/dbus-introspect.sh b/tools/dbus-introspect.sh
index 0a0b1e2..7a3da2a 100755
--- a/tools/dbus-introspect.sh
+++ b/tools/dbus-introspect.sh
@@ -3,7 +3,7 @@
 # let's check the NATracker service
 
 NA_SERVICE=$(grep '#define NAUTILUS_ACTIONS_DBUS_SERVICE' src/api/na-dbus.h | awk '{ print $3 }' | sed 's?"??g')
-NA_TRACKER_PATH=$(grep '#define NAUTILUS_ACTIONS_DBUS_TRACKER_PATH' src/api/na-dbus.h | awk '{ print $3 }' | sed 's?"??g')
+NA_TRACKER_PATH=$(grep '#define NAUTILUS_ACTIONS_DBUS_TRACKER_PATH' src/api/na-dbus.h | awk '{ print $3 }' | sed 's?"??g')/0
 
 echo "D-Bus service      =  ${NA_SERVICE}"
 echo "D-Bus tracker path = ${NA_TRACKER_PATH}"



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