[empathy] Take org.gnome.Empathy as a well-known name on startup. (Fixes #560159)



commit 21ed0c9812b89d41518397ff4ee08c3eeebe0712
Author: Jonny Lamb <jonny lamb collabora co uk>
Date:   Wed Jun 17 22:53:10 2009 +0100

    Take org.gnome.Empathy as a well-known name on startup. (Fixes #560159)
    
    Signed-off-by: Jonny Lamb <jonny lamb collabora co uk>

 src/empathy.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/src/empathy.c b/src/empathy.c
index d5be4df..f23ce91 100644
--- a/src/empathy.c
+++ b/src/empathy.c
@@ -38,6 +38,7 @@
 #include <libebook/e-book.h>
 #include <libnotify/notify.h>
 
+#include <telepathy-glib/dbus.h>
 #include <telepathy-glib/util.h>
 #include <libmissioncontrol/mc-account.h>
 #include <libmissioncontrol/mission-control.h>
@@ -470,6 +471,7 @@ main (int argc, char *argv[])
 	gboolean           hide_contact_list = FALSE;
 	gboolean           accounts_dialog = FALSE;
 	GError            *error = NULL;
+	TpDBusDaemon      *dbus_daemon;
 	GOptionEntry       options[] = {
 		{ "no-connect", 'n',
 		  0, G_OPTION_ARG_NONE, &no_connect,
@@ -547,6 +549,23 @@ main (int argc, char *argv[])
 		g_warning ("Cannot create the 'empathy' bacon connection.");
 	}
 
+	/* Take well-known name */
+	dbus_daemon = tp_dbus_daemon_dup (&error);
+	if (error == NULL) {
+		if (!tp_dbus_daemon_request_name (dbus_daemon,
+						  "org.gnome.Empathy",
+						  TRUE, &error)) {
+			DEBUG ("Failed to request well-known name: %s",
+			       error ? error->message : "no message");
+			g_clear_error (&error);
+		}
+		g_object_unref (dbus_daemon);
+	} else {
+		DEBUG ("Failed to dup dbus daemon: %s",
+		       error ? error->message : "no message");
+		g_clear_error (&error);
+	}
+
 	/* Setting up MC */
 	mc = empathy_mission_control_dup_singleton ();
 	g_signal_connect (mc, "ServiceEnded",



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]