soc.2010.detachablepurple: fe682f8a: I forget about the most important part o...
gillux at soc.pidgin.im
gillux at soc.pidgin.im
Sat Jul 17 10:38:19 EDT 2010
----------------------------------------------------------------------
Revision: fe682f8af7024f4c99c9d29b3535aaea8f49aca9
Parent: a363e93f9caa9324f0a7a6140e04e45a4ea48074
Author: gillux at soc.pidgin.im
Date: 07/17/10 10:30:12
Branch: im.pidgin.soc.2010.detachablepurple
URL: http://d.pidgin.im/viewmtn/revision/info/fe682f8af7024f4c99c9d29b3535aaea8f49aca9
Changelog:
I forget about the most important part of
07fcf3bc6898f3ccac5d6a393a521d74284829e3. Here it is!
Changes against parent a363e93f9caa9324f0a7a6140e04e45a4ea48074
patched libpurple/pobject.c
-------------- next part --------------
============================================================
--- libpurple/pobject.c 536c0e526dacea76fa9f61acb9e18175c440f239
+++ libpurple/pobject.c 3e17f3f13a85a5014f65295ae29d0920c4afbd34
@@ -302,7 +302,30 @@ purple_object_have_dbus_property(PurpleO
return exported_prop;
}
+/**
+ * Callback, called when we receive a dbus "DBusNotify" signal.
+ */
static void
+purple_object_notify_cb(DBusGProxy *proxy, const char *prop_name, const GValue *prop_val, gpointer data)
+{
+ GObject *obj;
+ PurpleRunningMode mode;
+
+ /* Retrieve the local gobject mirrored with the dbus path which sent
+ * the signal */
+ obj = purple_dbus_get_gobject_by_path(dbus_g_proxy_get_path(proxy));
+ g_return_if_fail(obj != NULL);
+
+ /* Update the local state of this property */
+ mode = purple_core_get_running_mode();
+ purple_core_set_running_mode(PURPLE_RUN_NORMAL_MODE);
+ purple_debug_info("dbus", "Recieved notify about property '%s' of a %s\n",
+ prop_name, G_OBJECT_TYPE_NAME(obj));
+ g_object_set_property(G_OBJECT(obj), prop_name, prop_val);
+ purple_core_set_running_mode(mode);
+}
+
+static void
purple_object_forward_notify_cb(GObject *gobj, GParamSpec *pspec, gpointer user_data)
{
gchar *prop_name;
@@ -359,6 +382,13 @@ purple_object_install_dbus_infos(PurpleO
/* Remember the purple interface */
purple_object_set_dbus_obj_interface(pobj, dbus_interface);
+ /* Watch for signals indicating updates from the daemon */
+ dbus_g_proxy_add_signal(dbus_proxy, "DBusNotify",
+ G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID);
+ dbus_g_proxy_connect_signal(dbus_proxy, "DBusNotify",
+ G_CALLBACK(purple_object_notify_cb),
+ pobj, NULL);
+
/* Remember what local gobject this object is a mirror of. */
purple_dbus_assoc_gobject(dbus_path, G_OBJECT(pobj));
}
More information about the Commits
mailing list