dbus/test/glib test-dbus-glib.c, 1.9, 1.10 test-profile.c, 1.16, 1.17 test-service-glib.c, 1.3, 1.4

Havoc Pennington hp@freedesktop.org
Tue Jan 18 12:42:17 PST 2005


Update of /cvs/dbus/dbus/test/glib
In directory gabe:/tmp/cvs-serv23786/test/glib

Modified Files:
	test-dbus-glib.c test-profile.c test-service-glib.c 
Log Message:
2005-01-18  Havoc Pennington  <hp@redhat.com>

        * Throughout, grand renaming to strip out the use of "service",
	just say "name" instead (or "bus name" when ambiguous).  Did not
	change the internal code of the message bus itself, only the
	programmer-facing API and messages.
	
	* doc/dbus-specification.xml: further update the message bus section
	
	* bus/config-parser.c (all_are_equiv): fix bug using freed string
	in error case



Index: test-dbus-glib.c
===================================================================
RCS file: /cvs/dbus/dbus/test/glib/test-dbus-glib.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- test-dbus-glib.c	15 Jan 2005 07:15:38 -0000	1.9
+++ test-dbus-glib.c	18 Jan 2005 20:42:15 -0000	1.10
@@ -58,8 +58,8 @@
   DBusGProxy *driver;
   DBusGProxy *proxy;
   DBusGPendingCall *call;
-  char **service_list;
-  int service_list_len;
+  char **name_list;
+  int name_list_len;
   int i;
   guint32 result;
   const char *v_STRING;
@@ -82,38 +82,38 @@
 
   /* Create a proxy object for the "bus driver" */
   
-  driver = dbus_g_proxy_new_for_service (connection,
-                                         DBUS_SERVICE_ORG_FREEDESKTOP_DBUS,
-                                         DBUS_PATH_ORG_FREEDESKTOP_DBUS,
-                                         DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS);
+  driver = dbus_g_proxy_new_for_name (connection,
+                                      DBUS_SERVICE_ORG_FREEDESKTOP_DBUS,
+                                      DBUS_PATH_ORG_FREEDESKTOP_DBUS,
+                                      DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS);
 
-  /* Call ListServices method */
+  /* Call ListNames method */
   
-  call = dbus_g_proxy_begin_call (driver, "ListServices", DBUS_TYPE_INVALID);
+  call = dbus_g_proxy_begin_call (driver, "ListNames", DBUS_TYPE_INVALID);
 
   error = NULL;
   if (!dbus_g_proxy_end_call (driver, call, &error,
                               DBUS_TYPE_ARRAY, DBUS_TYPE_STRING,
-                              &service_list, &service_list_len,
+                              &name_list, &name_list_len,
                               DBUS_TYPE_INVALID))
     {
-      g_printerr ("Failed to complete ListServices call: %s\n",
+      g_printerr ("Failed to complete ListNames call: %s\n",
                   error->message);
       g_error_free (error);
       exit (1);
     }
 
-  g_print ("Services on the message bus:\n");
+  g_print ("Names on the message bus:\n");
   i = 0;
-  while (i < service_list_len)
+  while (i < name_list_len)
     {
-      g_assert (service_list[i] != NULL);
-      g_print ("  %s\n", service_list[i]);
+      g_assert (name_list[i] != NULL);
+      g_print ("  %s\n", name_list[i]);
       ++i;
     }
-  g_assert (service_list[i] == NULL);
+  g_assert (name_list[i] == NULL);
 
-  g_strfreev (service_list);
+  g_strfreev (name_list);
 
   /* Test handling of unknown method */
   v_STRING = "blah blah blah blah blah";
@@ -140,7 +140,7 @@
   /* Activate a service */
   v_STRING = "org.freedesktop.DBus.TestSuiteEchoService";
   v_UINT32 = 0;
-  call = dbus_g_proxy_begin_call (driver, "ActivateService",
+  call = dbus_g_proxy_begin_call (driver, "StartServiceByName",
                                   DBUS_TYPE_STRING,
                                   &v_STRING,
                                   DBUS_TYPE_UINT32,
@@ -158,12 +158,12 @@
       exit (1);
     }
 
-  g_print ("Activation of echo service = 0x%x\n", result);
+  g_print ("Starting echo service result = 0x%x\n", result);
 
   /* Activate a service again */
   v_STRING = "org.freedesktop.DBus.TestSuiteEchoService";
   v_UINT32 = 0;
-  call = dbus_g_proxy_begin_call (driver, "ActivateService",
+  call = dbus_g_proxy_begin_call (driver, "StartServiceByName",
                                   DBUS_TYPE_STRING,
                                   &v_STRING,
                                   DBUS_TYPE_UINT32,
@@ -181,19 +181,19 @@
       exit (1);
     }
 
-  g_print ("Duplicate activation of echo service = 0x%x\n", result);
+  g_print ("Duplicate start of echo service = 0x%x\n", result);
 
   /* Talk to the new service */
   
-  proxy = dbus_g_proxy_new_for_service_owner (connection,
-                                              "org.freedesktop.DBus.TestSuiteEchoService",
-                                              "/org/freedesktop/TestSuite",
-                                              "org.freedesktop.TestSuite",
-                                              &error);
+  proxy = dbus_g_proxy_new_for_name_owner (connection,
+                                           "org.freedesktop.DBus.TestSuiteEchoService",
+                                           "/org/freedesktop/TestSuite",
+                                           "org.freedesktop.TestSuite",
+                                           &error);
   
   if (proxy == NULL)
     {
-      g_printerr ("Failed to create proxy for service owner: %s\n",
+      g_printerr ("Failed to create proxy for name owner: %s\n",
                   error->message);
       g_error_free (error);
       exit (1);      

Index: test-profile.c
===================================================================
RCS file: /cvs/dbus/dbus/test/glib/test-profile.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- test-profile.c	16 Jan 2005 02:23:56 -0000	1.16
+++ test-profile.c	18 Jan 2005 20:42:15 -0000	1.17
@@ -423,19 +423,19 @@
                                     DBUS_SERVICE_ORG_FREEDESKTOP_DBUS) &&
            dbus_message_is_signal (message,
                                    DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS,
-                                   "ServiceOwnerChanged"))
+                                   "NameOwnerChanged"))
     {
-      const char *service_name, *old_owner, *new_owner;
+      const char *name, *old_owner, *new_owner;
       DBusError error;
 
-      service_name = NULL;
+      name = NULL;
       old_owner = NULL;
       new_owner = NULL;
 
       dbus_error_init (&error);
       if (!dbus_message_get_args (message,
                                   &error,
-                                  DBUS_TYPE_STRING, &service_name,
+                                  DBUS_TYPE_STRING, &name,
                                   DBUS_TYPE_STRING, &old_owner,
                                   DBUS_TYPE_STRING, &new_owner,
                                   DBUS_TYPE_INVALID))
@@ -445,12 +445,12 @@
         }
 
       if (g_hash_table_lookup (server->client_names,
-                               service_name) &&
+                               name) &&
           *old_owner != '\0' &&
           *new_owner == '\0')
         {
           g_hash_table_remove (server->client_names,
-                               service_name);
+                               name);
           server->sd->n_clients -= 1;
           if (server->sd->n_clients == 0)
             g_main_loop_quit (server->sd->loop);
@@ -525,13 +525,13 @@
   
   connection = dbus_g_connection_get_connection (gconnection);
 
-  dbus_bus_acquire_service (connection,
-                            ECHO_SERVICE,
-                            0, NULL); /* ignore errors because we suck */
+  dbus_bus_request_name (connection,
+                         ECHO_SERVICE,
+                         0, NULL); /* ignore errors because we suck */
   
   rule = g_strdup_printf ("type='signal',sender='%s',member='%s'",
                           DBUS_SERVICE_ORG_FREEDESKTOP_DBUS,
-                          "ServiceOwnerChanged");
+                          "NameOwnerChanged");
 
   /* ignore errors because we suck */
   dbus_bus_add_match (connection, rule, NULL);

Index: test-service-glib.c
===================================================================
RCS file: /cvs/dbus/dbus/test/glib/test-service-glib.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- test-service-glib.c	20 Jun 2004 15:28:15 -0000	1.3
+++ test-service-glib.c	18 Jan 2005 20:42:15 -0000	1.4
@@ -17,7 +17,7 @@
   loop = g_main_loop_new (NULL, FALSE);
 
   error = NULL;
-  connection = dbus_g_bus_get (DBUS_BUS_ACTIVATION,
+  connection = dbus_g_bus_get (DBUS_BUS_STARTER,
                                &error);
   if (connection == NULL)
     {



More information about the dbus-commit mailing list