soc.2010.detachablepurple: b75e8820: Added dbus path name in each account ret...

gillux at soc.pidgin.im gillux at soc.pidgin.im
Fri Jul 16 01:17:07 EDT 2010


----------------------------------------------------------------------
Revision: b75e8820d5e4bd0fff4903fd9a36149a184efc0e
Parent:   5f5c086e3fbc34e4f65af26932ea6b8d42e5c22d
Author:   gillux at soc.pidgin.im
Date:     07/15/10 19:29:03
Branch:   im.pidgin.soc.2010.detachablepurple
URL: http://d.pidgin.im/viewmtn/revision/info/b75e8820d5e4bd0fff4903fd9a36149a184efc0e

Changelog: 

Added dbus path name in each account returned by the GetAllAccounts method.
We will need it to build the dbus proxy associated by the mirror object.

Changes against parent 5f5c086e3fbc34e4f65af26932ea6b8d42e5c22d

  patched  libpurple/dbus-constructor.c
  patched  libpurple/dbus-constructor.h
  patched  libpurple/dbus-prototypes/constructor.xml

-------------- next part --------------
============================================================
--- libpurple/dbus-constructor.c	b6713abc76a55400584075313dce2cf521e8ced4
+++ libpurple/dbus-constructor.c	f83a05086d9dd5240dfcc3ea6abc63d1219a8ed4
@@ -143,8 +143,8 @@ extern const DBusGObjectInfo dbus_glib_D
 
 /**
  * A callback used in DBUS_purple_constructor_get_all_accounts().
- * Packs the given acc account into a { protocol_id, account_struct } dbus
- * structure and append it in accounts_pack.
+ * Packs the given acc account into a { dbus_path, protocol_id, account_struct }
+ * dbus structure and append it in accounts_pack.
  */
 static void
 pack_accounts_cb(PurpleAccount *acc, GPtrArray *accounts_pack, GPtrArray *exported_props)
@@ -170,8 +170,9 @@ pack_accounts_cb(PurpleAccount *acc, GPt
 
 	/* Setup the DBus struct, with our extracted data */
 	ok = dbus_g_type_struct_set(&acc_props,
-				0, purple_account_get_protocol_id(acc),
-				1, props_pack,
+				0, purple_object_get_dbus_path(PURPLE_OBJECT(acc)),
+				1, purple_account_get_protocol_id(acc),
+				2, props_pack,
 				G_MAXUINT);
 	g_ptr_array_foreach(props_pack, (GFunc)g_value_array_free, NULL);
 	g_ptr_array_free(props_pack, TRUE);
@@ -198,6 +199,7 @@ DBUS_purple_constructor_get_all_accounts
 	 * defined in dbus-constructor.h, is something like :
 	 * GPtrArray *account = [
 	 *     struct {
+	 *         char      *dbus_path_name;
 	 *         char      *protocol_id; // Needed to properly g_object_new()
 	 *         GPtrArray *properties [
 	 *             struct {
@@ -289,7 +291,7 @@ get_prop_by_name(GPtrArray *prop_array, 
 
 /**
  * A callback used in purple_accounts_get_all_RPC().
- * Unpacks the { protocol_id, account_struct } dbus structure and construct
+ * Unpacks the { dbus_path, protocol_id, account_struct } dbus structure and construct
  * a new account based on these informations.
  */
 static void
@@ -297,6 +299,7 @@ load_accounts_cb(GValueArray* box)
 {
 	GValue val = {0, };
 	PurpleAccount *acc;
+	char *path_name;
 	char *protocol_id;
 	GPtrArray *prop_array;
 	GValue *username;
@@ -305,7 +308,7 @@ load_accounts_cb(GValueArray* box)
 	g_value_init(&val, DBUS_STRUCT_ACCOUNT);
 	g_value_set_boxed(&val, box);
 	dbus_g_type_struct_get(&val,
-		0, &protocol_id, 1, &prop_array, G_MAXUINT);
+		0, &path_name, 1, &protocol_id, 0, &prop_array, G_MAXUINT);
 
 	/* First get the username, it is needed to construct the account */
 	username = get_prop_by_name(prop_array, "username");
@@ -324,6 +327,7 @@ load_accounts_cb(GValueArray* box)
 	g_ptr_array_foreach(prop_array, (GFunc)load_account_prop_cb, acc);
 	purple_core_set_remote_mode(TRUE);
 
+	g_free(path_name);
 	g_free(protocol_id);
 	g_value_unset(username);
 	g_ptr_array_free(prop_array, TRUE);
============================================================
--- libpurple/dbus-constructor.h	d4131551274011a835d8e9f7281bd13531d3e97b
+++ libpurple/dbus-constructor.h	4d9344627244424f33b1cd5817c180392904b8c7
@@ -54,7 +54,7 @@ typedef struct {
 #define DBUS_STRUCT_ACCOUNT \
 ( \
 	dbus_g_type_get_struct("GValueArray", \
-		G_TYPE_STRING, DBUS_COLLECTION_PROPS, \
+		DBUS_TYPE_G_OBJECT_PATH, G_TYPE_STRING, DBUS_COLLECTION_PROPS, \
 		G_TYPE_INVALID) \
 )
 
============================================================
--- libpurple/dbus-prototypes/constructor.xml	43bccf4ca2b3a020e5ef8041bb43d3b1ad3b9ee6
+++ libpurple/dbus-prototypes/constructor.xml	5f283dd83a16b683279061f7f0f1a605d0ab0886
@@ -8,7 +8,7 @@
 			<arg type="s" name="protocol_id" direction="in" />
 		</method>
 		<method name="GetAllAccounts">
-			<arg type="a(sa(sv))" name="accounts" direction="out" />
+			<arg type="a(osa(sv))" name="accounts" direction="out" />
 		</method>
 	</interface>
 </node>


More information about the Commits mailing list