[glib] Update the GDBus subtree example for the new API



commit 1a06bd8d3f8ccf040901b4aa4b1197d189b8ab4e
Author: Ryan Lortie <desrt desrt ca>
Date:   Mon Jul 19 15:03:54 2010 -0400

    Update the GDBus subtree example for the new API

 docs/reference/glib/tmpl/messages.sgml |   27 +++++++++++++++++++++------
 gio/tests/gdbus-example-subtree.c      |   21 ++++++++++++---------
 2 files changed, 33 insertions(+), 15 deletions(-)
---
diff --git a/docs/reference/glib/tmpl/messages.sgml b/docs/reference/glib/tmpl/messages.sgml
index 2c4e8d8..245a775 100644
--- a/docs/reference/glib/tmpl/messages.sgml
+++ b/docs/reference/glib/tmpl/messages.sgml
@@ -117,15 +117,18 @@ documentation.
 @args: the parameters to insert into the format string.
 
 
-<!-- ##### MACRO g_message ##### -->
+<!-- ##### FUNCTION g_message ##### -->
 <para>
 A convenience function/macro to log a normal message.
 </para>
 
+ format: 
+ Varargs: 
+<!-- # Unused Parameters # -->
 @...: format string, followed by parameters to insert into the format string (as with printf())
 
 
-<!-- ##### MACRO g_warning ##### -->
+<!-- ##### FUNCTION g_warning ##### -->
 <para>
 A convenience function/macro to log a warning message.
 </para>
@@ -135,10 +138,13 @@ You can make warnings fatal at runtime by setting the %G_DEBUG environment
 variable (see <ulink url="glib-running.html">Running GLib Applications</ulink>).
 </para>
 
+ format: 
+ Varargs: 
+<!-- # Unused Parameters # -->
 @...: format string, followed by parameters to insert into the format string (as with printf())
 
 
-<!-- ##### MACRO g_critical ##### -->
+<!-- ##### FUNCTION g_critical ##### -->
 <para>
 Logs a "critical warning" (#G_LOG_LEVEL_CRITICAL). It's more or less
 application-defined what constitutes a critical vs. a regular
@@ -153,10 +159,13 @@ the %G_DEBUG environment variable (see
 <ulink url="glib-running.html">Running GLib Applications</ulink>).
 </para>
 
+ format: 
+ Varargs: 
+<!-- # Unused Parameters # -->
 @...: format string, followed by parameters to insert into the format string (as with printf())
 
 
-<!-- ##### MACRO g_error ##### -->
+<!-- ##### FUNCTION g_error ##### -->
 <para>
 A convenience function/macro to log an error message.
 Error messages are always fatal, resulting in a call to
@@ -166,16 +175,22 @@ expect. Using this function indicates a bug in your program, i.e. an
 assertion failure.
 </para>
 
+ format: 
+ Varargs: 
+<!-- # Unused Parameters # -->
 @...: format string, followed by parameters to insert into the format string (as with printf())
 
 
-<!-- ##### MACRO g_debug ##### -->
+<!-- ##### FUNCTION g_debug ##### -->
 <para>
 A convenience function/macro to log a debug message.
 </para>
 
-    : format string, followed by parameters to insert into the format string (as with printf())
+ format: 
+ Varargs: 
 @Since: 2.6
+<!-- # Unused Parameters # -->
+    : format string, followed by parameters to insert into the format string (as with printf())
 
 
 <!-- ##### FUNCTION g_log_set_handler ##### -->
diff --git a/gio/tests/gdbus-example-subtree.c b/gio/tests/gdbus-example-subtree.c
index b037dd3..cd3365f 100644
--- a/gio/tests/gdbus-example-subtree.c
+++ b/gio/tests/gdbus-example-subtree.c
@@ -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[] =
@@ -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 *



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