Fix tests to compile again - add missing headers to W32, call correct process-id...
[platform/upstream/glib.git] / gio / tests / gdbus-example-subtree.c
index 1633acc..714bbe6 100644 (file)
@@ -5,9 +5,9 @@
 /* ---------------------------------------------------------------------------------------------------- */
 
 static GDBusNodeInfo *introspection_data = NULL;
-static const GDBusInterfaceInfo *manager_interface_info = NULL;
-static const GDBusInterfaceInfo *block_interface_info = NULL;
-static const GDBusInterfaceInfo *partition_interface_info = NULL;
+static GDBusInterfaceInfo *manager_interface_info = NULL;
+static GDBusInterfaceInfo *block_interface_info = NULL;
+static GDBusInterfaceInfo *partition_interface_info = NULL;
 
 /* Introspection data for the service we are exporting */
 static const gchar introspection_xml[] =
@@ -55,9 +55,9 @@ manager_method_call (GDBusConnection       *connection,
   g_assert_cmpstr (interface_name, ==, "org.gtk.GDBus.Example.Manager");
   g_assert_cmpstr (method_name, ==, "Hello");
 
-  g_variant_get (parameters, "(s)", &greeting);
+  g_variant_get (parameters, "(&s)", &greeting);
 
-  response = g_strdup_printf ("Method %s.%s with user_data `%s' on object path %s called with arg '%s'",
+  response = g_strdup_printf ("Method %s.%s with user_data '%s' on object path %s called with arg '%s'",
                               interface_name,
                               method_name,
                               (const gchar *) user_data,
@@ -94,9 +94,9 @@ block_method_call (GDBusConnection       *connection,
       const gchar *greeting;
       gchar *response;
 
-      g_variant_get (parameters, "(s)", &greeting);
+      g_variant_get (parameters, "(&s)", &greeting);
 
-      response = g_strdup_printf ("Method %s.%s with user_data `%s' on object path %s called with arg '%s'",
+      response = g_strdup_printf ("Method %s.%s with user_data '%s' on object path %s called with arg '%s'",
                                   interface_name,
                                   method_name,
                                   (const gchar *) user_data,
@@ -207,9 +207,9 @@ partition_method_call (GDBusConnection       *connection,
   g_assert_cmpstr (interface_name, ==, "org.gtk.GDBus.Example.Partition");
   g_assert_cmpstr (method_name, ==, "Hello");
 
-  g_variant_get (parameters, "(s)", &greeting);
+  g_variant_get (parameters, "(&s)", &greeting);
 
-  response = g_strdup_printf ("Method %s.%s with user_data `%s' on object path %s called with arg '%s'",
+  response = g_strdup_printf ("Method %s.%s with user_data '%s' on object path %s called with arg '%s'",
                               interface_name,
                               method_name,
                               (const gchar *) user_data,
@@ -253,7 +253,7 @@ subtree_enumerate (GDBusConnection       *connection,
   return nodes;
 }
 
-static GPtrArray *
+static GDBusInterfaceInfo **
 subtree_introspect (GDBusConnection       *connection,
                     const gchar           *sender,
                     const gchar           *object_path,
@@ -263,18 +263,21 @@ subtree_introspect (GDBusConnection       *connection,
   GPtrArray *p;
 
   p = g_ptr_array_new ();
-  if (g_strcmp0 (node, "/") == 0)
+  if (node == NULL)
     {
-      g_ptr_array_add (p, (gpointer) manager_interface_info);
+      g_ptr_array_add (p, g_dbus_interface_info_ref (manager_interface_info));
     }
   else
     {
-      g_ptr_array_add (p, (gpointer) block_interface_info);
+      g_ptr_array_add (p, g_dbus_interface_info_ref (block_interface_info));
       if (strlen (node) == 4)
-        g_ptr_array_add (p, (gpointer) partition_interface_info);
+        g_ptr_array_add (p,
+                         g_dbus_interface_info_ref (partition_interface_info));
     }
 
-  return p;
+  g_ptr_array_add (p, NULL);
+
+  return (GDBusInterfaceInfo **) g_ptr_array_free (p, FALSE);
 }
 
 static const GDBusInterfaceVTable *
@@ -361,8 +364,6 @@ main (int argc, char *argv[])
   guint owner_id;
   GMainLoop *loop;
 
-  g_type_init ();
-
   /* We are lazy here - we don't want to manually provide
    * the introspection data structures - so we just build
    * them from XML.