cpw.gillux.detachablepurple: 54c1d227: Going multi-interface. Changed the way o...
gillux at soc.pidgin.im
gillux at soc.pidgin.im
Sun May 20 13:21:20 EDT 2012
----------------------------------------------------------------------
Revision: 54c1d227ef939a1ba1d7a73c6374be16438eeb48
Parent: 0adfd627cdf14b6bb6102de3dd58f591ff109543
Author: gillux at soc.pidgin.im
Date: 05/20/12 10:39:33
Branch: im.pidgin.cpw.gillux.detachablepurple
URL: http://d.pidgin.im/viewmtn/revision/info/54c1d227ef939a1ba1d7a73c6374be16438eeb48
Changelog:
Going multi-interface. Changed the way objects say they want their
property changes to be propagated on D-Bus. Now we already have the
PurpleObject D-Bus interface already registered, we only need to
register a "notify" gobject callback if objects want so.
Changes against parent 0adfd627cdf14b6bb6102de3dd58f591ff109543
patched libpurple/account.c
patched libpurple/connection.c
patched libpurple/dbus/account.c
patched libpurple/dbus/constructor.c
patched libpurple/pobject.c
patched libpurple/pobject.h
-------------- next part --------------
============================================================
--- libpurple/account.c 912da524a4ad903f4ae512d4784a037226150270
+++ libpurple/account.c 02584aa90dda4e19a93526ff8e745b31946f94c4
@@ -838,8 +838,8 @@ purple_account_new(const char *username,
g_signal_emit_by_name(G_OBJECT(account), "new");
- /* D-Bus-related initialization. */
- purple_object_dbus_init(account);
+ /* Export this new object on D-Bus and propagate any property change. */
+ purple_object_dbus_init(account, TRUE);
return account;
}
============================================================
--- libpurple/connection.c 20c35dfd092229d84b3bd031cdd4c10ebdeb9124
+++ libpurple/connection.c 4fb4d6a8ae291a11d4fdf890baf4e85622d60210
@@ -232,8 +232,8 @@ _purple_connection_new(PurpleAccount *ac
priv->password = g_strdup(password);
- /* D-Bus-related initialization. */
- purple_object_dbus_init(gc);
+ /* Export this new object on D-Bus and propagate any property change. */
+ purple_object_dbus_init(gc, TRUE);
g_signal_emit(G_OBJECT(gc), signals[SIG_SIGNING_ON], 0);
============================================================
--- libpurple/pobject.c 477c4b6caae28b2a8b27e19712adc0bccd0ac637
+++ libpurple/pobject.c aae13f6be27a2299f3cb323d46d23af61e8cb7c6
@@ -722,19 +722,6 @@ void
}
void
-purple_object_dbus_bind_notify(PurpleObject *pobj)
-{
- if (purple_core_is_remote_mode() || purple_core_is_mirror_mode()) {
- purple_object_bind_dbus_callback
- (PURPLE_OBJECT_GET_CLASS(pobj), "PropertyChanged",
- G_CALLBACK(purple_object_dbus_prop_changed));
- } else if (purple_core_is_daemon_mode())
- g_signal_connect(pobj, "notify",
- G_CALLBACK(purple_object_forward_notify_cb),
- NULL);
-}
-
-void
purple_object_bind_dbus_callback(PurpleObjectClass *klass,
const char *iface_name, const char *cb_name,
GCallback func)
@@ -1039,10 +1026,15 @@ void
}
void
-purple_object_dbus_init(gpointer object)
+purple_object_dbus_init(gpointer object, gboolean propagate_props_changes)
{
PurpleObjectClass *pclass = PURPLE_OBJECT_GET_CLASS(object);
+ if (purple_core_is_daemon_mode() && propagate_props_changes)
+ g_signal_connect(object, "notify",
+ G_CALLBACK(purple_object_forward_notify_cb),
+ NULL);
+
if (pclass->dbus_init) {
pclass->dbus_init(object);
}
============================================================
--- libpurple/pobject.h bf1f5d642667e9fee19e7e2dc3a8c5858ad92a06
+++ libpurple/pobject.h 68eb0bab3da932bb270118bc2458eb0090937330
@@ -242,17 +242,6 @@ void purple_object_bind_dbus_callback(Pu
GCallback func);
/**
- * Makes the relevant object properties changes to be transmitted over DBus.
- * "Relevant" properties are the one listed in the matching XML file of the
- * PurpleObject subclass, e.g. account.xml. In client context, it binds a
- * DBus signal handler that receives properties changes. In daemon context,
- * it propagates the properties changes with a DBus signal.
- *
- * @param pobj The PurpleObject we want to bind notifications for.
- */
-void purple_object_dbus_bind_notify(PurpleObject *pobj);
-
-/**
* Gets the GClosure created to handle the call of the DBus method
* (in dameon context) or signal handler (in client context) named name.
*
@@ -428,10 +417,15 @@ void purple_object_set_prop_on_dbus(Purp
/**
* Calls the dbus_init function pointer on a child of PurpleObject.
+ * Additionally, if propagate_props_changes is TRUE, registers a "notify"
+ * sighandler that propagates any property change of this object on D-Bus.
*
* @param object A child of PurpleObject.
+ * @param propagate_props_changes Wether to send D-Bus signals when a property
+ * changes on daemon mode.
*/
-void purple_object_dbus_init(gpointer object);
+void purple_object_dbus_init(gpointer object,
+ gboolean propagate_props_changes);
/**
* A convenience function that emits signal_name D-Bus signal on pobj
============================================================
--- libpurple/dbus/account.c f794c468c37520e33d1ead6af0e06cf476af6401
+++ libpurple/dbus/account.c 9a744e2c53f8f5d591c13dfb70bc1c2bc91297f5
@@ -173,8 +173,6 @@ purple_account_dbus_init(gpointer object
/* Publish/listen for the object on the bus. */
purple_dbus_connect_object(account);
- /* Keep the properties synchronized between client and daemon. */
- purple_object_dbus_bind_notify(pobject);
if (purple_core_is_daemon_mode()) {
/* Tell the clients about this new account. */
============================================================
--- libpurple/dbus/constructor.c d1628a9523e6afe70ea5a85bbce706cf925a8965
+++ libpurple/dbus/constructor.c 1c41b809b856abb18ae62a79f0704d521801359d
@@ -259,7 +259,8 @@ load_pobject(GVariant *vpobject, const c
pobject = PURPLE_OBJECT(obj);
purple_object_set_dbus_path(pobject, dbus_path);
- purple_object_dbus_init(obj);
+ /* Note: we are in remote mode so the 2nd parameter doesn't matter. */
+ purple_object_dbus_init(obj, FALSE);
g_variant_unref(props);
g_free((gchar*)dbus_path);
@@ -359,7 +360,8 @@ purple_constructor_pobj_created(PurpleOb
purple_object_set_dbus_path(PURPLE_OBJECT(obj), dbus_path);
g_free((gchar*)dbus_path);
- purple_object_dbus_init(obj);
+ /* Note: we are in remote mode so the 2nd parameter doesn't matter. */
+ purple_object_dbus_init(obj, FALSE);
purple_object_set_synchronized(PURPLE_OBJECT(obj), TRUE);
}
More information about the Commits
mailing list