[glib/wip/gapplication] Drop object path prefix, comment constructor trick



commit 4f3aec0b66a253d81ffaf364eebd48c7ed555278
Author: Colin Walters <walters verbum org>
Date:   Tue Jun 1 10:37:09 2010 -0400

    Drop object path prefix, comment constructor trick

 gio/gapplication.c     |    4 ++++
 gio/gunixapplication.c |    6 +++---
 gio/tests/testapps.c   |    8 ++++----
 3 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/gio/gapplication.c b/gio/gapplication.c
index 78b74c5..c49ba70 100644
--- a/gio/gapplication.c
+++ b/gio/gapplication.c
@@ -286,6 +286,10 @@ g_application_new (int                argc,
 
   g_type_init ();
 
+  /* We do this thread-local variable trick to avoid having to make
+   * argc and argv properties of the object.  It keeps the API
+   * slightly cleaner.
+   */
   construct_data.argc = argc;
   construct_data.argv = argv;
   construct_data.plugin = NULL;
diff --git a/gio/gunixapplication.c b/gio/gunixapplication.c
index 77255b2..155f5b2 100644
--- a/gio/gunixapplication.c
+++ b/gio/gunixapplication.c
@@ -29,7 +29,6 @@
 #include "gdbusintrospection.h"
 #include "gdbusmethodinvocation.h"
 
-#define G_APPLICATION_PATH_PREFIX "/org/gtk/Application"
 #define G_APPLICATION_IFACE "org.gtk.Application"
 
 static void
@@ -269,8 +268,9 @@ application_path_from_appid (const char *appid)
 {
   char *appid_path, *iter;
 
-  appid_path = g_strconcat (G_APPLICATION_PATH_PREFIX, "/", appid, NULL);
-  for (iter = appid_path + strlen (G_APPLICATION_PATH_PREFIX); *iter; iter++)
+
+  appid_path = g_strconcat ("/", appid, NULL);
+  for (iter = appid_path; *iter; iter++)
     {
       if (*iter == '.')
 	*iter = '/';
diff --git a/gio/tests/testapps.c b/gio/tests/testapps.c
index 63326ee..b8e46fb 100644
--- a/gio/tests/testapps.c
+++ b/gio/tests/testapps.c
@@ -129,7 +129,7 @@ quit_app (gpointer data)
   connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
   res = g_dbus_connection_call_sync (connection,
                                      "org.gtk.test.app",
-                                     "/org/gtk/Application/org/gtk/test/app",
+                                     "/org/gtk/test/app",
                                      "org.gtk.Application",
                                      "Quit",
                                      g_variant_new ("(u)", 0),
@@ -235,7 +235,7 @@ list_actions (void)
   connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
   res = g_dbus_connection_call_sync (connection,
                                      "org.gtk.test.app",
-                                     "/org/gtk/Application/org/gtk/test/app",
+                                     "/org/gtk/test/app",
                                      "org.gtk.Application",
                                      "ListActions",
                                      NULL,
@@ -315,7 +315,7 @@ invoke_action (gpointer data)
   connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
   res = g_dbus_connection_call_sync (connection,
                                      "org.gtk.test.app",
-                                     "/org/gtk/Application/org/gtk/test/app",
+                                     "/org/gtk/test/app",
                                      "org.gtk.Application",
                                      "InvokeAction",
                                      g_variant_new ("(su)",
@@ -495,7 +495,7 @@ test_change_action (void)
                                            NULL,
                                            "org.gtk.Application",
                                            "ActionsChanged",
-                                           "/org/gtk/Application/org/gtk/test/app",
+                                           "/org/gtk/test/app",
                                            NULL,
                                            actions_changed,
                                            loop,



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