/srv/mercurial-server/detachablepurple: 3a13e9cf3503: Going mult...

Gilles Bedel gillux at cpw.pidgin.im
Fri Jun 15 22:01:40 EDT 2012


Changeset: 3a13e9cf3503fe457165d6c5644f876629f984a6
Author:	 Gilles Bedel <gillux at cpw.pidgin.im>
Date:	 2012-05-20 13:40 +0000
Branch:	 cpw.gillux.detachablepurple
URL: http://hg.pidgin.im/srv/mercurial-server/detachablepurple/rev/3a13e9cf3503

Description:

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

diffstat:

 libpurple/dbus/constructor.c |   5 +++--
 libpurple/pobject.c          |  10 ++++------
 libpurple/pobject.h          |   6 +++---
 3 files changed, 10 insertions(+), 11 deletions(-)

diffs (82 lines):

diff --git a/libpurple/dbus/constructor.c b/libpurple/dbus/constructor.c
--- a/libpurple/dbus/constructor.c
+++ b/libpurple/dbus/constructor.c
@@ -335,8 +335,9 @@
 	                       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. */
diff --git a/libpurple/pobject.c b/libpurple/pobject.c
--- a/libpurple/pobject.c
+++ b/libpurple/pobject.c
@@ -624,6 +624,7 @@
 
 	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
-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 @@
 		return FALSE;
 
 	return g_dbus_connection_emit_signal(connection, NULL,
-	                                     object_path, interface_info->name,
+	                                     object_path, interface_name,
 	                                     signal_name, signal_params, error);
 }
 
diff --git a/libpurple/pobject.h b/libpurple/pobject.h
--- a/libpurple/pobject.h
+++ b/libpurple/pobject.h
@@ -431,10 +431,10 @@
 
 /**
  * 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 @@
  * @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



More information about the Commits mailing list