summaryrefslogtreecommitdiffstats
path: root/glib/dbus-gidl.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2005-01-29 19:52:19 +0000
committerHavoc Pennington <hp@redhat.com>2005-01-29 19:52:19 +0000
commitfd3e49f249fb4ab5ac7da4fe9fc14cc67958d84a (patch)
treedbc9e553ccf466707acffb0f6f1e1f59177f1841 /glib/dbus-gidl.c
parent602c4b05c4d1c7c83a459b7d0164cc14eebdfcb4 (diff)
2005-01-29 Havoc Pennington <hp@redhat.com>
* glib/Makefile.am: rename dbus-glib-tool to dbus-binding-tool; though it uses glib, it could be extended for any binding in principle * glib/dbus-gobject.c (gobject_message_function): change to the new way properties work * dbus/dbus-protocol.h: add the new interfaces * doc/dbus-specification.xml: document the introspection format, Introspectable interface, and add an org.freedesktop.Properties interface. * glib/dbus-gparser.c: add support for a <property> element * glib/dbus-gidl.c: add PropertyInfo * glib/dbus-gobject.c (handle_introspect): put the outermost <node> outside the signal and property descriptions. (introspect_properties): export properties as <property> rather than as method calls
Diffstat (limited to 'glib/dbus-gidl.c')
-rw-r--r--glib/dbus-gidl.c100
1 files changed, 98 insertions, 2 deletions
diff --git a/glib/dbus-gidl.c b/glib/dbus-gidl.c
index 6fa83916..cabc406b 100644
--- a/glib/dbus-gidl.c
+++ b/glib/dbus-gidl.c
@@ -2,7 +2,7 @@
/* dbus-gidl.c data structure describing an interface, to be generated from IDL
* or something
*
- * Copyright (C) 2003 Red Hat, Inc.
+ * Copyright (C) 2003, 2005 Red Hat, Inc.
*
* Licensed under the Academic Free License version 2.1
*
@@ -46,6 +46,7 @@ struct InterfaceInfo
/* Since we have BaseInfo now these could be one list */
GSList *methods;
GSList *signals;
+ GSList *properties;
};
struct MethodInfo
@@ -60,6 +61,13 @@ struct SignalInfo
GSList *args;
};
+struct PropertyInfo
+{
+ BaseInfo base;
+ int type;
+ PropertyAccessFlags access;
+};
+
struct ArgInfo
{
BaseInfo base;
@@ -111,6 +119,9 @@ base_info_unref (BaseInfo *info)
case INFO_TYPE_METHOD:
method_info_unref ((MethodInfo*) info);
break;
+ case INFO_TYPE_PROPERTY:
+ property_info_unref ((PropertyInfo*) info);
+ break;
case INFO_TYPE_ARG:
arg_info_unref ((ArgInfo*) info);
break;
@@ -209,6 +220,20 @@ free_signal_list (GSList **signals_p)
*signals_p = NULL;
}
+static void
+free_property_list (GSList **props_p)
+{
+ GSList *tmp;
+ tmp = *props_p;
+ while (tmp != NULL)
+ {
+ property_info_unref (tmp->data);
+ tmp = tmp->next;
+ }
+ g_slist_free (*props_p);
+ *props_p = NULL;
+}
+
NodeInfo*
node_info_new (const char *name)
{
@@ -307,6 +332,7 @@ interface_info_unref (InterfaceInfo *info)
{
free_method_list (&info->methods);
free_signal_list (&info->signals);
+ free_property_list (&info->properties);
base_info_free (info);
}
}
@@ -329,6 +355,12 @@ interface_info_get_signals (InterfaceInfo *info)
return info->signals;
}
+GSList*
+interface_info_get_properties (InterfaceInfo *info)
+{
+ return info->properties;
+}
+
void
interface_info_add_method (InterfaceInfo *info,
MethodInfo *method)
@@ -345,6 +377,14 @@ interface_info_add_signal (InterfaceInfo *info,
info->signals = g_slist_append (info->signals, signal);
}
+void
+interface_info_add_property (InterfaceInfo *info,
+ PropertyInfo *property)
+{
+ property_info_ref (property);
+ info->properties = g_slist_append (info->properties, property);
+}
+
static void
free_arg_list (GSList **args_p)
{
@@ -352,6 +392,8 @@ free_arg_list (GSList **args_p)
tmp = *args_p;
while (tmp != NULL)
{
+ ArgInfo *ai = tmp->data;
+ g_assert (ai->base.type == INFO_TYPE_ARG);
arg_info_unref (tmp->data);
tmp = tmp->next;
}
@@ -484,10 +526,64 @@ signal_info_add_arg (SignalInfo *info,
arg_info_ref (arg);
info->args = g_slist_append (info->args, arg);
-
+
/* signal args don't need sorting since only "out" is allowed */
}
+PropertyInfo*
+property_info_new (const char *name,
+ int type,
+ PropertyAccessFlags access)
+{
+ PropertyInfo *info;
+
+ info = g_new0 (PropertyInfo, 1);
+ info->base.refcount = 1;
+ info->base.name = g_strdup (name);
+ info->base.type = INFO_TYPE_PROPERTY;
+
+ info->type = type;
+ info->access = access;
+
+ return info;
+}
+
+PropertyInfo*
+property_info_ref (PropertyInfo *info)
+{
+ info->base.refcount += 1;
+
+ return info;
+}
+
+void
+property_info_unref (PropertyInfo *info)
+{
+ info->base.refcount -= 1;
+ if (info->base.refcount == 0)
+ {
+ base_info_free (info);
+ }
+}
+
+const char*
+property_info_get_name (PropertyInfo *info)
+{
+ return info->base.name;
+}
+
+int
+property_info_get_type (PropertyInfo *info)
+{
+ return info->type;
+}
+
+PropertyAccessFlags
+property_info_get_access (PropertyInfo *info)
+{
+ return info->access;
+}
+
ArgInfo*
arg_info_new (const char *name,
ArgDirection direction,