summaryrefslogtreecommitdiffstats
path: root/glib/dbus-gidl.c
diff options
context:
space:
mode:
Diffstat (limited to 'glib/dbus-gidl.c')
-rw-r--r--glib/dbus-gidl.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/glib/dbus-gidl.c b/glib/dbus-gidl.c
index ec87414d..554e18c3 100644
--- a/glib/dbus-gidl.c
+++ b/glib/dbus-gidl.c
@@ -43,6 +43,7 @@ struct NodeInfo
struct InterfaceInfo
{
BaseInfo base;
+ GHashTable *bindings;
/* Since we have BaseInfo now these could be one list */
GSList *methods;
GSList *signals;
@@ -52,6 +53,7 @@ struct InterfaceInfo
struct MethodInfo
{
BaseInfo base;
+ GHashTable *bindings;
GSList *args;
};
@@ -75,6 +77,23 @@ struct ArgInfo
ArgDirection direction;
};
+static void
+get_hash_key (gpointer key, gpointer value, gpointer data)
+{
+ GSList **list = data;
+ *list = g_slist_prepend (*list, key);
+}
+
+static GSList *
+get_hash_keys (GHashTable *table)
+{
+ GSList *ret = NULL;
+
+ g_hash_table_foreach (table, get_hash_key, &ret);
+
+ return ret;
+}
+
BaseInfo *
base_info_ref (BaseInfo *info)
{
@@ -326,6 +345,9 @@ interface_info_new (const char *name)
info->base.refcount = 1;
info->base.name = g_strdup (name);
info->base.type = INFO_TYPE_INTERFACE;
+ info->bindings = g_hash_table_new_full (g_str_hash, g_str_equal,
+ (GDestroyNotify) g_free,
+ (GDestroyNotify) g_free);
return info;
}
@@ -344,6 +366,7 @@ interface_info_unref (InterfaceInfo *info)
info->base.refcount -= 1;
if (info->base.refcount == 0)
{
+ g_hash_table_destroy (info->bindings);
free_method_list (&info->methods);
free_signal_list (&info->signals);
free_property_list (&info->properties);
@@ -357,6 +380,19 @@ interface_info_get_name (InterfaceInfo *info)
return info->base.name;
}
+GSList *
+interface_info_get_binding_names (InterfaceInfo *info)
+{
+ return get_hash_keys (info->bindings);
+}
+
+const char*
+interface_info_get_binding_name (InterfaceInfo *info,
+ const char *binding_type)
+{
+ return g_hash_table_lookup (info->bindings, binding_type);
+}
+
GSList*
interface_info_get_methods (InterfaceInfo *info)
{
@@ -376,6 +412,16 @@ interface_info_get_properties (InterfaceInfo *info)
}
void
+interface_info_set_binding_name (InterfaceInfo *info,
+ const char *binding_type,
+ const char *bound_name)
+{
+ g_hash_table_insert (info->bindings,
+ g_strdup (binding_type),
+ g_strdup (bound_name));
+}
+
+void
interface_info_add_method (InterfaceInfo *info,
MethodInfo *method)
{
@@ -424,6 +470,9 @@ method_info_new (const char *name)
info->base.refcount = 1;
info->base.name = g_strdup (name);
info->base.type = INFO_TYPE_METHOD;
+ info->bindings = g_hash_table_new_full (g_str_hash, g_str_equal,
+ (GDestroyNotify) g_free,
+ (GDestroyNotify) g_free);
return info;
}
@@ -442,6 +491,7 @@ method_info_unref (MethodInfo *info)
info->base.refcount -= 1;
if (info->base.refcount == 0)
{
+ g_hash_table_destroy (info->bindings);
free_arg_list (&info->args);
base_info_free (info);
}
@@ -453,6 +503,19 @@ method_info_get_name (MethodInfo *info)
return info->base.name;
}
+GSList *
+method_info_get_binding_names (MethodInfo *info)
+{
+ return get_hash_keys (info->bindings);
+}
+
+const char*
+method_info_get_binding_name (MethodInfo *info,
+ const char *binding_type)
+{
+ return g_hash_table_lookup (info->bindings, binding_type);
+}
+
GSList*
method_info_get_args (MethodInfo *info)
{
@@ -481,6 +544,16 @@ args_sort_by_direction (const void *a,
}
void
+method_info_set_binding_name (MethodInfo *info,
+ const char *binding_type,
+ const char *bound_name)
+{
+ g_hash_table_insert (info->bindings,
+ g_strdup (binding_type),
+ g_strdup (bound_name));
+}
+
+void
method_info_add_arg (MethodInfo *info,
ArgInfo *arg)
{