soc.2010.detachablepurple: eeba3edf: Now the gobjects store their dbus path. ...

gillux at soc.pidgin.im gillux at soc.pidgin.im
Tue Jul 6 17:01:17 EDT 2010


----------------------------------------------------------------------
Revision: eeba3edf2664c1e2652edaf4286a6c6614b1d4b1
Parent:   5b93e9d69da2aecae7175e80450c7056e7bbd93f
Author:   gillux at soc.pidgin.im
Date:     07/06/10 15:54:58
Branch:   im.pidgin.soc.2010.detachablepurple
URL: http://d.pidgin.im/viewmtn/revision/info/eeba3edf2664c1e2652edaf4286a6c6614b1d4b1

Changelog: 

Now the gobjects store their dbus path. Also added a macro to print errors of
RPC, for convenience.

Changes against parent 5b93e9d69da2aecae7175e80450c7056e7bbd93f

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

-------------- next part --------------
============================================================
--- libpurple/account.c	22edcbba26240ede12d2badca13c669d0cb1db9d
+++ libpurple/account.c	cdbc5221fbbcb5234076f3239bcb0ec740160256
@@ -843,9 +843,7 @@ purple_account_new(const char *username,
 		if (!im_pidgin_purple_constructor_new_account(dbus_proxy, username,
 													protocol_id, &dbus_path,
 													&error)) {
-			purple_debug_error("dbus", "Failed to remotely call purple_account_new: %s\n",
-							error->message);
-			g_error_free(error);
+			PURPLE_RPC_FAILED(purple_account_new, error);
 			return NULL;
 		}
 
============================================================
--- libpurple/dbus-maybe.h	9f796119b84aea176bcccd82ddffa4c118f98840
+++ libpurple/dbus-maybe.h	c73282bae8da7a7885c2536e1a30b19a26db9560
@@ -16,11 +16,20 @@ G_STMT_START { \
 
 #define PURPLE_DBUS_REGISTER_OBJECT(path, object) \
 G_STMT_START { \
-    if (!purple_core_get_remote_mode()) \
-         dbus_g_connection_register_g_object(purple_dbus_get_g_connection(), \
-                                             path, G_OBJECT(object)); \
+    if (!purple_core_get_remote_mode()) { \
+        dbus_g_connection_register_g_object(purple_dbus_get_g_connection(), \
+                                            path, G_OBJECT(object)); \
+        purple_object_set_dbus_path(PURPLE_OBJECT(object), path); \
+    } \
 } G_STMT_END
 
+#define PURPLE_RPC_FAILED(func, error) \
+G_STMT_START { \
+    purple_debug_error("dbus", "Failed to remotely call %s: %s\n", \
+                       #func, error->message); \
+    g_error_free(error); \
+} G_STMT_END
+
 /* this provides a type check */
 #define PURPLE_DBUS_REGISTER_POINTER(ptr, type) { \
     type *typed_ptr = ptr; \
@@ -36,6 +45,8 @@ G_STMT_START { \
     if (ptr) {} \
 }
 
+#define PURPLE_RPC_FAILED(func, error)
+
 #define PURPLE_DBUS_UNREGISTER_POINTER(ptr)
 #define DBUS_EXPORT
 


More information about the Commits mailing list