soc.2010.detachablepurple: ed93886b: Macroified the code that remotely set a ...

gillux at soc.pidgin.im gillux at soc.pidgin.im
Sun Jul 11 17:48:04 EDT 2010


----------------------------------------------------------------------
Revision: ed93886bae41c0954a9bc55e3a23f1f06ab3a9eb
Parent:   58398880b13c1ee95a737351cfcec465368bf735
Author:   gillux at soc.pidgin.im
Date:     07/07/10 04:42:15
Branch:   im.pidgin.soc.2010.detachablepurple
URL: http://d.pidgin.im/viewmtn/revision/info/ed93886bae41c0954a9bc55e3a23f1f06ab3a9eb

Changelog: 

Macroified the code that remotely set a property, so that it would be a simpler
for every property.

Changes against parent 58398880b13c1ee95a737351cfcec465368bf735

  patched  libpurple/account.c
  patched  libpurple/dbus-maybe.h

-------------- next part --------------
============================================================
--- libpurple/account.c	ff8f2ffc366a7bff0955336fda70afada88f917a
+++ libpurple/account.c	5192e4722d173e770df0ad556122f680734b554e
@@ -1437,18 +1437,9 @@ purple_account_set_password(PurpleAccoun
 
 	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
 
-#ifdef HAVE_DBUS
-	GValue prop = {0, };
+	PURPLE_DBUS_REMOTELY_SET_PROP(account, g_value_set_string, G_TYPE_STRING,
+								PROP_PASSWORD_S, password);
 
-	if (purple_core_get_remote_mode()) {
-		g_value_init(&prop, G_TYPE_STRING);
-		g_value_set_string(&prop, password);
-		purple_dbus_remotely_set_obj_prop(PURPLE_OBJECT(account), "password", &prop);
-		g_value_unset(&prop);
-		return;
-	}
-#endif
-
 	priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
 	if (purple_util_strings_equal(priv->password, password))
 		return;
============================================================
--- libpurple/dbus-maybe.h	c73282bae8da7a7885c2536e1a30b19a26db9560
+++ libpurple/dbus-maybe.h	8014bcfc47aaaf70ca8482349897cca7b37f335b
@@ -30,6 +30,19 @@ G_STMT_START { \
     g_error_free(error); \
 } G_STMT_END
 
+#define PURPLE_DBUS_REMOTELY_SET_PROP(account, set_func, gtype, name, var) \
+G_STMT_START { \
+    GValue prop = {0, }; \
+    if (purple_core_get_remote_mode()) { \
+        g_value_init(&prop, gtype); \
+        set_func(&prop, var); \
+        purple_dbus_remotely_set_obj_prop(PURPLE_OBJECT(account), \
+                                          name, &prop); \
+        g_value_unset(&prop); \
+        return; \
+    } \
+} G_STMT_END
+
 /* this provides a type check */
 #define PURPLE_DBUS_REGISTER_POINTER(ptr, type) { \
     type *typed_ptr = ptr; \
@@ -47,6 +60,8 @@ G_STMT_START { \
 
 #define PURPLE_RPC_FAILED(func, error)
 
+#define PURPLE_DBUS_REMOTELY_SET_PROP(account, set_func, gtype, name, var)
+
 #define PURPLE_DBUS_UNREGISTER_POINTER(ptr)
 #define DBUS_EXPORT
 


More information about the Commits mailing list