soc.2010.detachablepurple: ddbae5bb: Make use of this new purple_object_insta...
gillux at soc.pidgin.im
gillux at soc.pidgin.im
Fri Jul 16 01:17:10 EDT 2010
----------------------------------------------------------------------
Revision: ddbae5bbfdab41bdca80a3a9b08b3136283c6094
Parent: ff15f05ccda09f08db6f7a9f20630d55c4115994
Author: gillux at soc.pidgin.im
Date: 07/15/10 23:17:05
Branch: im.pidgin.soc.2010.detachablepurple
URL: http://d.pidgin.im/viewmtn/revision/info/ddbae5bbfdab41bdca80a3a9b08b3136283c6094
Changelog:
Make use of this new purple_object_install_dbus_infos(). Note that this new
function obsoleted the PURPLE_DBUS_REGISTER_OBJECT() macro.
Changes against parent ff15f05ccda09f08db6f7a9f20630d55c4115994
patched libpurple/account-dbus.c
patched libpurple/account.c
patched libpurple/dbus-constructor.c
patched libpurple/dbus-maybe.h
-------------- next part --------------
============================================================
--- libpurple/account.c 9887a4f105019fcf0a9a36dd2b9e660fd4f124c2
+++ libpurple/account.c 668ca563fbff09092e578d4198d1bf411f19eb9c
@@ -580,8 +580,6 @@ static void purple_account_init(GTypeIns
priv->system_log = NULL;
account->perm_deny = PURPLE_PRIVACY_ALLOW_ALL;
-
- purple_object_set_dbus_obj_interface(PURPLE_OBJECT(account), DBUS_ACCOUNT_INTERFACE);
}
/* GObject destructor function */
@@ -849,7 +847,8 @@ purple_account_new(const char *username,
PURPLE_DBUS_REGISTER_POINTER(account, PurpleAccount);
dbus_path = build_dbus_path(username, protocol_id);
- PURPLE_DBUS_REGISTER_OBJECT(dbus_path, account);
+ purple_object_install_dbus_infos(PURPLE_OBJECT(account),
+ DBUS_ACCOUNT_INTERFACE, dbus_path);
g_free(dbus_path);
prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
============================================================
--- libpurple/dbus-maybe.h de46e30065f6f0b8106d53633cc351481b3a633b
+++ libpurple/dbus-maybe.h a64e03510f183b5bb4af041d792c4c8d3ed46fa3
@@ -16,15 +16,6 @@
#include "dbus-server.h"
#include "debug.h"
-#define PURPLE_DBUS_REGISTER_OBJECT(path, object) \
-G_STMT_START { \
- if (purple_core_is_daemon_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", \
@@ -54,8 +45,6 @@ G_STMT_START { \
#else /* !HAVE_DBUS */
-#define PURPLE_DBUS_REGISTER_OBJECT(path, object)
-
#define PURPLE_DBUS_REGISTER_POINTER(ptr, type) { \
if (ptr) {} \
}
============================================================
--- libpurple/account-dbus.c def408db023ae3d7a88fba5cd5d049e05db172e7
+++ libpurple/account-dbus.c 1164ccc31c15c0800b299eb5438c975ab3c49cb5
@@ -15,6 +15,7 @@ purple_account_new_RPC(const char *usern
char* dbus_path;
DBusGProxy* dbus_proxy;
GError *error = NULL;
+ PurpleRunningMode mode;
/* First, remotely create a new account */
dbus_proxy = dbus_g_proxy_new_for_name(purple_dbus_get_g_connection(),
@@ -28,17 +29,25 @@ purple_account_new_RPC(const char *usern
return NULL;
}
- /* Then, locally create a dummy account that will hold a proxy */
- account = g_object_new(PURPLE_TYPE_ACCOUNT, NULL);
- /* One for the im.pidgin.purple.account interface */
- dbus_proxy = dbus_g_proxy_new_for_name(purple_dbus_get_g_connection(),
- DBUS_PURPLE_SERVICE, dbus_path,
- DBUS_ACCOUNT_INTERFACE);
- purple_object_set_dbus_obj_proxy(PURPLE_OBJECT(account), dbus_proxy);
- /* One for the org.freedesktop.DBus.Properties interface */
- dbus_proxy = dbus_g_proxy_new_for_name(purple_dbus_get_g_connection(),
- DBUS_PURPLE_SERVICE, dbus_path,
- DBUS_INTERFACE_PROPERTIES);
- purple_object_set_dbus_props_proxy(PURPLE_OBJECT(account), dbus_proxy);
+ /* Then, locally create a mirror account that will hold a proxy */
+ /* Act in normal mode so that the account is created locally */
+ mode = purple_core_get_running_mode();
+ purple_core_set_running_mode(PURPLE_RUN_NORMAL_MODE);
+ account = purple_account_new(username, protocol_id);
+ purple_core_set_running_mode(mode);
+
+ /* In normal mode this have been skipped, so do it now */
+ purple_object_install_dbus_infos(PURPLE_OBJECT(account),
+ DBUS_ACCOUNT_INTERFACE, dbus_path);
+
+ /* Watch for signals indicating updates from the daemon */
+ /*
+ dbus_g_proxy_add_signal(dbus_proxy, "PurpleAccountPropertySet",
+ G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID);
+ dbus_g_proxy_connect_signal(dbus_proxy, "PurpleAccountPropertySet",
+ G_CALLBACK(purple_account_set_property_cb),
+ account, NULL);
+ */
+
return account;
}
============================================================
--- libpurple/dbus-constructor.c c8326d0818ef83e214e32edd2a7426e0b6adc0bc
+++ libpurple/dbus-constructor.c 4c8123167749d9d96fefc7d0f045b82717f0b02c
@@ -71,17 +71,14 @@ PurpleConstructor* purple_constructor_ge
}
PurpleConstructor* purple_constructor_get_instance(void) {
- DBusGProxy* proxy;
static PurpleConstructor* self = NULL;
if (self == NULL) {
self = g_object_new(PURPLE_TYPE_CONSTRUCTOR, NULL);
- proxy = dbus_g_proxy_new_for_name(purple_dbus_get_g_connection(),
- DBUS_PURPLE_SERVICE,
- DBUS_CONSTRUCTOR_PATH,
- DBUS_CONSTRUCTOR_INTERFACE);
- purple_object_set_dbus_obj_proxy(PURPLE_OBJECT(self), proxy);
- PURPLE_DBUS_REGISTER_OBJECT(DBUS_CONSTRUCTOR_PATH, self);
+ purple_object_install_dbus_infos(
+ PURPLE_OBJECT(self),
+ DBUS_CONSTRUCTOR_INTERFACE,
+ DBUS_CONSTRUCTOR_PATH);
}
return self;
}
@@ -329,6 +326,10 @@ load_accounts_cb(GValueArray* box)
g_ptr_array_foreach(prop_array, (GFunc)load_account_prop_cb, acc);
purple_core_set_running_mode(mode);
+ /* In normal mode this have been skipped, so do it now */
+ purple_object_install_dbus_infos(PURPLE_OBJECT(acc),
+ DBUS_ACCOUNT_INTERFACE, path_name);
+
g_free(path_name);
g_free(protocol_id);
g_value_unset(username);
More information about the Commits
mailing list