Update the GDBus subtree example for the new API

This commit is contained in:
Ryan Lortie
2010-07-19 15:03:54 -04:00
parent c7c573afb6
commit 1a06bd8d3f
2 changed files with 33 additions and 15 deletions

View File

@@ -117,15 +117,18 @@ documentation.
@args: the parameters to insert into the format string. @args: the parameters to insert into the format string.
<!-- ##### MACRO g_message ##### --> <!-- ##### FUNCTION g_message ##### -->
<para> <para>
A convenience function/macro to log a normal message. A convenience function/macro to log a normal message.
</para> </para>
@format:
@Varargs:
<!-- # Unused Parameters # -->
@...: format string, followed by parameters to insert into the format string (as with printf()) @...: format string, followed by parameters to insert into the format string (as with printf())
<!-- ##### MACRO g_warning ##### --> <!-- ##### FUNCTION g_warning ##### -->
<para> <para>
A convenience function/macro to log a warning message. A convenience function/macro to log a warning message.
</para> </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>). variable (see <ulink url="glib-running.html">Running GLib Applications</ulink>).
</para> </para>
@format:
@Varargs:
<!-- # Unused Parameters # -->
@...: format string, followed by parameters to insert into the format string (as with printf()) @...: format string, followed by parameters to insert into the format string (as with printf())
<!-- ##### MACRO g_critical ##### --> <!-- ##### FUNCTION g_critical ##### -->
<para> <para>
Logs a "critical warning" (#G_LOG_LEVEL_CRITICAL). It's more or less Logs a "critical warning" (#G_LOG_LEVEL_CRITICAL). It's more or less
application-defined what constitutes a critical vs. a regular 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>). <ulink url="glib-running.html">Running GLib Applications</ulink>).
</para> </para>
@format:
@Varargs:
<!-- # Unused Parameters # -->
@...: format string, followed by parameters to insert into the format string (as with printf()) @...: format string, followed by parameters to insert into the format string (as with printf())
<!-- ##### MACRO g_error ##### --> <!-- ##### FUNCTION g_error ##### -->
<para> <para>
A convenience function/macro to log an error message. A convenience function/macro to log an error message.
Error messages are always fatal, resulting in a call to 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. assertion failure.
</para> </para>
@format:
@Varargs:
<!-- # Unused Parameters # -->
@...: format string, followed by parameters to insert into the format string (as with printf()) @...: format string, followed by parameters to insert into the format string (as with printf())
<!-- ##### MACRO g_debug ##### --> <!-- ##### FUNCTION g_debug ##### -->
<para> <para>
A convenience function/macro to log a debug message. A convenience function/macro to log a debug message.
</para> </para>
@...: format string, followed by parameters to insert into the format string (as with printf()) @format:
@Varargs:
@Since: 2.6 @Since: 2.6
<!-- # Unused Parameters # -->
@...: format string, followed by parameters to insert into the format string (as with printf())
<!-- ##### FUNCTION g_log_set_handler ##### --> <!-- ##### FUNCTION g_log_set_handler ##### -->

View File

@@ -5,9 +5,9 @@
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */
static GDBusNodeInfo *introspection_data = NULL; static GDBusNodeInfo *introspection_data = NULL;
static const GDBusInterfaceInfo *manager_interface_info = NULL; static GDBusInterfaceInfo *manager_interface_info = NULL;
static const GDBusInterfaceInfo *block_interface_info = NULL; static GDBusInterfaceInfo *block_interface_info = NULL;
static const GDBusInterfaceInfo *partition_interface_info = NULL; static GDBusInterfaceInfo *partition_interface_info = NULL;
/* Introspection data for the service we are exporting */ /* Introspection data for the service we are exporting */
static const gchar introspection_xml[] = static const gchar introspection_xml[] =
@@ -253,7 +253,7 @@ subtree_enumerate (GDBusConnection *connection,
return nodes; return nodes;
} }
static GPtrArray * static GDBusInterfaceInfo **
subtree_introspect (GDBusConnection *connection, subtree_introspect (GDBusConnection *connection,
const gchar *sender, const gchar *sender,
const gchar *object_path, const gchar *object_path,
@@ -263,18 +263,21 @@ subtree_introspect (GDBusConnection *connection,
GPtrArray *p; GPtrArray *p;
p = g_ptr_array_new (); 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 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) 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 * static const GDBusInterfaceVTable *