cpw.gillux.detachablepurple: a0c45a2c: Going multi-interface. Adapted the signa...

gillux at soc.pidgin.im gillux at soc.pidgin.im
Sun May 20 13:21:41 EDT 2012


----------------------------------------------------------------------
Revision: a0c45a2c7bf849466234579e0b626ab20cf26784
Parent:   c3661cd112ccc4e794c23ff65fdaeefc93835ef8
Author:   gillux at soc.pidgin.im
Date:     05/20/12 09:40:39
Branch:   im.pidgin.cpw.gillux.detachablepurple
URL: http://d.pidgin.im/viewmtn/revision/info/a0c45a2c7bf849466234579e0b626ab20cf26784

Changelog: 

Going multi-interface. Adapted the signal sender function.
It now takes the target interface as parameter.

Changes against parent c3661cd112ccc4e794c23ff65fdaeefc93835ef8

  patched  libpurple/dbus/constructor.c
  patched  libpurple/pobject.c
  patched  libpurple/pobject.h

-------------- next part --------------
============================================================
--- libpurple/pobject.c	9fd7246b259f7bbde83ebc4676d3ded38498e79b
+++ libpurple/pobject.c	7803fb7eecc509b1e1be27edc5099dd9598a3fbd
@@ -624,6 +624,7 @@ purple_object_forward_notify_cb(GObject 
 
 	signal_params = g_variant_new("(sv)", prop_name, prop);
 	purple_object_emit_dbus_signal(PURPLE_OBJECT(gobj),
+	                               purple_object_interface_info.name,
 	                              "PropertyChanged", signal_params, NULL);
 	g_variant_unref(prop);
 	g_variant_unref(signal_params);
@@ -1001,19 +1002,16 @@ gboolean
 }
 
 gboolean
-purple_object_emit_dbus_signal(PurpleObject *pobj, const gchar *signal_name,
+purple_object_emit_dbus_signal(PurpleObject *pobj, const gchar *interface_name,
+                               const gchar *signal_name,
                                GVariant *signal_params, GError **error)
 {
-	GDBusInterfaceInfo *interface_info;
 	GDBusConnection *connection;
 	char *object_path;
 
 	object_path = purple_object_get_dbus_path(pobj);
 	g_return_val_if_fail(object_path != NULL, FALSE);
 
-	interface_info = PURPLE_OBJECT_GET_CLASS(pobj)->dbus_ifaceinfo;
-	g_return_val_if_fail(interface_info != NULL, FALSE);
-
 	/* Not having a connection yet can happen during an asynchronous
 	 * purple initialization. */
 	connection = purple_gdbus_get_connection();
@@ -1021,7 +1019,7 @@ purple_object_emit_dbus_signal(PurpleObj
 		return FALSE;
 
 	return g_dbus_connection_emit_signal(connection, NULL,
-	                                     object_path, interface_info->name,
+	                                     object_path, interface_name,
 	                                     signal_name, signal_params, error);
 }
 
============================================================
--- libpurple/pobject.h	3d74708889ea6536bfe107c872a32aaa9fe4372f
+++ libpurple/pobject.h	60fcd05fc4cbbad8ef75be1798546bb001377d73
@@ -431,10 +431,10 @@ void purple_object_dbus_init(gpointer ob
 
 /**
  * A convenience function that emits signal_name D-Bus signal on pobj
- * with signal_params parameters. Emits on the dbus_ifaceinfo interface
- * through our D-Bus connection. Only the daemon may emit D-Bus signals.
+ * with signal_params parameters. Only the daemon may emit D-Bus signals.
  *
  * @param pobj The PurpleObject from which the signal must be emitted.
+ * @param interface_name The name of the interface.
  * @param signal_name The name of the signal.
  * @param signal_params The parameters of the signal (may be NULL).
  *        Multiple parameters must be packed in a GVarianttuple, in the
@@ -442,7 +442,7 @@ void purple_object_dbus_init(gpointer ob
  * @param error A GError directly passed to g_dbus_connection_emit_signal().
  * @return TRUE If the signal has been sent, FALSE otherwise.
  */
-gboolean purple_object_emit_dbus_signal(PurpleObject *pobj, const gchar *signal_name, GVariant *signal_params, GError **error);
+gboolean purple_object_emit_dbus_signal(PurpleObject *pobj, const gchar *interface_name, const gchar *signal_name, GVariant *signal_params, GError **error);
 
 /**
  * Remotely calls method_name on pobj over D-Bus. Actually, it's not called
============================================================
--- libpurple/dbus/constructor.c	271254774cfc69617719a1e5f854eefac8cb0f49
+++ libpurple/dbus/constructor.c	368877382422976c2e8cd34f8ab533bbdf0a5cae
@@ -335,8 +335,9 @@ purple_constructor_announce_pobject_crea
 	                       G_OBJECT_TYPE_NAME(pobj),
 	                       purple_object_get_dbus_path(pobj),
 	                       pack_pobject_properties(pobj));
-	purple_object_emit_dbus_signal(PURPLE_OBJECT(con), "PurpleObjectCreated",
-	                               params, NULL);
+	purple_object_emit_dbus_signal(PURPLE_OBJECT(con),
+	                               purple_constructor_interface_info.name,
+	                               "PurpleObjectCreated", params, NULL);
 }
 
 /* "PurpleObjectCreated" signal handler. */


More information about the Commits mailing list