summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2005-02-12 20:27:45 +0000
committerHavoc Pennington <hp@redhat.com>2005-02-12 20:27:45 +0000
commit970be5fda36ea575973a9e7f25389e2ef173b940 (patch)
tree6bcc78511c8db57acaf1ca9b9c0e064ba122cb4f
parent85fb9ff93c91bc500b91759d044e3dfd951c7868 (diff)
2005-02-12 Havoc Pennington <hp@redhat.com>
* tools/dbus-tree-view.c (info_set_func_text): display more details on args * bus/driver.c (bus_driver_handle_list_services): list the bus driver * glib/dbus-gparser.c (parse_arg): generate an arg name if none is supplied * glib/dbus-gidl.c (signal_info_get_n_args): new function (method_info_get_n_args): new function
-rw-r--r--ChangeLog13
-rw-r--r--bus/driver.c13
-rw-r--r--glib/dbus-gidl.c12
-rw-r--r--glib/dbus-gidl.h2
-rw-r--r--glib/dbus-gparser.c13
-rw-r--r--tools/dbus-tree-view.c49
6 files changed, 100 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index d3581801..ca582e18 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2005-02-12 Havoc Pennington <hp@redhat.com>
+ * tools/dbus-tree-view.c (info_set_func_text): display more
+ details on args
+
+ * bus/driver.c (bus_driver_handle_list_services): list the bus
+ driver
+
+ * glib/dbus-gparser.c (parse_arg): generate an arg name if none is supplied
+
+ * glib/dbus-gidl.c (signal_info_get_n_args): new function
+ (method_info_get_n_args): new function
+
+2005-02-12 Havoc Pennington <hp@redhat.com>
+
* bus/driver.c (bus_driver_handle_introspect): add introspection
for bus driver
diff --git a/bus/driver.c b/bus/driver.c
index 7a716824..9c1a47c7 100644
--- a/bus/driver.c
+++ b/bus/driver.c
@@ -409,6 +409,19 @@ bus_driver_handle_list_services (DBusConnection *connection,
return FALSE;
}
+ {
+ /* Include the bus driver in the list */
+ const char *v_STRING = DBUS_SERVICE_ORG_FREEDESKTOP_DBUS;
+ if (!dbus_message_iter_append_basic (&sub, DBUS_TYPE_STRING,
+ &v_STRING))
+ {
+ dbus_free_string_array (services);
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+ return FALSE;
+ }
+ }
+
i = 0;
while (i < len)
{
diff --git a/glib/dbus-gidl.c b/glib/dbus-gidl.c
index 8e0dc0da..ec87414d 100644
--- a/glib/dbus-gidl.c
+++ b/glib/dbus-gidl.c
@@ -459,6 +459,12 @@ method_info_get_args (MethodInfo *info)
return info->args;
}
+int
+method_info_get_n_args (MethodInfo *info)
+{
+ return g_slist_length (info->args);
+}
+
static int
args_sort_by_direction (const void *a,
const void *b)
@@ -532,6 +538,12 @@ signal_info_get_args (SignalInfo *info)
return info->args;
}
+int
+signal_info_get_n_args (SignalInfo *info)
+{
+ return g_slist_length (info->args);
+}
+
void
signal_info_add_arg (SignalInfo *info,
ArgInfo *arg)
diff --git a/glib/dbus-gidl.h b/glib/dbus-gidl.h
index 88d5c6e7..a706c4d5 100644
--- a/glib/dbus-gidl.h
+++ b/glib/dbus-gidl.h
@@ -106,6 +106,7 @@ const char* method_info_get_name (MethodInfo *info);
GSList* method_info_get_args (MethodInfo *info);
void method_info_add_arg (MethodInfo *info,
ArgInfo *arg);
+int method_info_get_n_args (MethodInfo *info);
SignalInfo* signal_info_new (const char *name);
SignalInfo* signal_info_ref (SignalInfo *info);
void signal_info_unref (SignalInfo *info);
@@ -113,6 +114,7 @@ const char* signal_info_get_name (SignalInfo *info);
GSList* signal_info_get_args (SignalInfo *info);
void signal_info_add_arg (SignalInfo *info,
ArgInfo *arg);
+int signal_info_get_n_args (SignalInfo *info);
PropertyInfo* property_info_new (const char *name,
int type,
PropertyAccessFlags access);
diff --git a/glib/dbus-gparser.c b/glib/dbus-gparser.c
index 963a5730..680d830a 100644
--- a/glib/dbus-gparser.c
+++ b/glib/dbus-gparser.c
@@ -620,6 +620,7 @@ parse_arg (Parser *parser,
ArgDirection dir;
int t;
ArgInfo *arg;
+ char *generated_name;
if (!(parser->method || parser->signal) ||
parser->node_stack == NULL ||
@@ -689,8 +690,16 @@ parse_arg (Parser *parser,
t = type_from_string (type, element_name, error);
if (t == DBUS_TYPE_INVALID)
return FALSE;
+
+ generated_name = NULL;
+ if (name == NULL)
+ generated_name = g_strdup_printf ("arg%d",
+ parser->method ?
+ method_info_get_n_args (parser->method) :
+ signal_info_get_n_args (parser->signal));
+
- arg = arg_info_new (name, dir, t);
+ arg = arg_info_new (name ? name : generated_name, dir, t);
if (parser->method)
method_info_add_arg (parser->method, arg);
else if (parser->signal)
@@ -698,6 +707,8 @@ parse_arg (Parser *parser,
else
g_assert_not_reached ();
+ g_free (generated_name);
+
arg_info_unref (arg);
parser->arg = arg;
diff --git a/tools/dbus-tree-view.c b/tools/dbus-tree-view.c
index d2898fb3..f9342ee9 100644
--- a/tools/dbus-tree-view.c
+++ b/tools/dbus-tree-view.c
@@ -25,6 +25,49 @@
#include "dbus-tree-view.h"
#include <glib/gi18n.h>
+/* FIXME this function should just be in the library */
+static const char *
+type_to_string (int type)
+{
+ switch (type)
+ {
+ case DBUS_TYPE_INVALID:
+ return "invalid";
+ case DBUS_TYPE_BOOLEAN:
+ return "boolean";
+ case DBUS_TYPE_BYTE:
+ return "byte";
+ case DBUS_TYPE_INT16:
+ return "int16";
+ case DBUS_TYPE_UINT16:
+ return "uint16";
+ case DBUS_TYPE_INT32:
+ return "int32";
+ case DBUS_TYPE_UINT32:
+ return "uint32";
+ case DBUS_TYPE_DOUBLE:
+ return "double";
+ case DBUS_TYPE_STRING:
+ return "string";
+ case DBUS_TYPE_OBJECT_PATH:
+ return "object_path";
+ case DBUS_TYPE_SIGNATURE:
+ return "signature";
+ case DBUS_TYPE_STRUCT:
+ return "struct";
+ case DBUS_TYPE_ARRAY:
+ return "array";
+ case DBUS_TYPE_VARIANT:
+ return "variant";
+ case DBUS_STRUCT_BEGIN_CHAR:
+ return "begin_struct";
+ case DBUS_STRUCT_END_CHAR:
+ return "end_struct";
+ default:
+ return "unknown";
+ }
+}
+
enum
{
MODEL_COLUMN_INFO,
@@ -292,7 +335,11 @@ info_set_func_text (GtkTreeViewColumn *tree_column,
g_string_append (str, "<i>property</i>");
break;
case INFO_TYPE_ARG:
- g_string_append (str, "<i>arg</i>");
+ g_string_append_printf (str, "<i>arg</i> %s",
+ arg_info_get_direction ((ArgInfo*)info) == ARG_IN ?
+ "in" : "out");
+ g_string_append_printf (str, " <b>%s</b>",
+ type_to_string (arg_info_get_type ((ArgInfo*)info)));
break;
}