soc.2010.detachablepurple: a254ef1c: Added a function that grabs the dbus reg...

gillux at soc.pidgin.im gillux at soc.pidgin.im
Thu Jul 15 17:35:51 EDT 2010


----------------------------------------------------------------------
Revision: a254ef1c2e90cb2fb355cc506748177983700148
Parent:   fbe63405ad6f6fff8e2d6c110b2dacad7a0e8e32
Author:   gillux at soc.pidgin.im
Date:     07/15/10 10:12:10
Branch:   im.pidgin.soc.2010.detachablepurple
URL: http://d.pidgin.im/viewmtn/revision/info/a254ef1c2e90cb2fb355cc506748177983700148

Changelog: 

Added a function that grabs the dbus registered properties of a gobject.
See the C comments for more details.

Changes against parent fbe63405ad6f6fff8e2d6c110b2dacad7a0e8e32

  patched  libpurple/dbus-server.c
  patched  libpurple/dbus-server.h

-------------- next part --------------
============================================================
--- libpurple/dbus-server.c	eebbf96d501418ade2a3bb1000ec12865979743e
+++ libpurple/dbus-server.c	02b12fa3cac5a8e0299e29661e175a547e1bda62
@@ -437,6 +437,30 @@ purple_dbus_remotely_set_obj_prop(Purple
 	}
 }
 
+GPtrArray*
+purple_dbus_get_gobj_props(char *interface, const DBusGObjectInfo *infos) {
+	GPtrArray *props_a = g_ptr_array_new();
+	char *props = (char*)infos->exported_properties;
+
+	while (*props) {
+		/* Only read properties that belongs to the correct interface */
+		if (!strcmp(interface, props)) {
+			/* Skip the interface name */
+			while (*(props++));
+			/* Pick the property name */
+			g_ptr_array_add(props_a, g_strdup(props));
+			/* Skip the property name */
+			while (*(props++));
+		} else {
+			/* Skip the interface and property name */
+			while (*(props++));
+			while (*(props++));
+		}
+	}
+
+	return props_a;
+}
+
 /**************************************************************/
 /* DBus bindings ...                                          */
 /**************************************************************/
============================================================
--- libpurple/dbus-server.h	9be6b34b7edf64e4eb757649473df49b198e83eb
+++ libpurple/dbus-server.h	5859038b15ef078377b6fbf61fc971aed4a5c432
@@ -203,7 +203,22 @@ gboolean purple_dbus_remotely_set_obj_pr
 gboolean purple_dbus_remotely_set_obj_prop(PurpleObject* pobj, const char* prop_name, GValue* prop_value);
 
 /**
+ * Grabs the properties of a gobject's DBusGObjectInfo that belong to the
+ * specified interface. This should return what <property> tags were defined
+ * in the dbus-prototype/<stuff>.xml, inside the matching <interface> block.
+ * These properties are the ones we want to export through DBus. The
+ * DBusGObjectInfo structs are usually automatically generated by
+ *dbus-binding-tool and held in the dbus-*-server.h files.
+ *
+ * @param interface The interface the properties belong to.
+ * @param infos The DBusGObjectInfo informations.
+ *
+ * @return An array of strings, the properties names.
+ */
+GPtrArray* purple_dbus_get_gobj_props(char *interface, const DBusGObjectInfo *infos);
 
+/**
+
  Macro #DBUS_EXPORT expands to nothing.  It is used to indicate to the
  dbus-analyze-functions.py script that the given function should be
  available to other applications through DBUS.  If


More information about the Commits mailing list