changeset 22712:4c731c4dcc0b

Pop up the buddylist of the running instance instead of exiting quietly when started a second time. References #3417.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 25 Apr 2008 16:23:35 +0000
parents 17cd33c5b5ef
children 74f586c40f6e 5433b59bdfc3
files libpurple/dbus-server.h pidgin/gtkmain.c
diffstat 2 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/dbus-server.h	Fri Apr 25 05:53:48 2008 +0000
+++ b/libpurple/dbus-server.h	Fri Apr 25 16:23:35 2008 +0000
@@ -28,9 +28,9 @@
 #ifndef _PURPLE_DBUS_SERVER_H_
 #define _PURPLE_DBUS_SERVER_H_
 
+#include "dbus-purple.h"
 #include "value.h"
 
-
 G_BEGIN_DECLS
 
 /**
@@ -51,6 +51,8 @@
     PurpleDBusType *parent;
 };
 
+#include "dbus-bindings.h"
+
 /* By convention, the PurpleDBusType variable representing each structure
    PurpleSomeStructure has the name PURPLE_DBUS_TYPE_PurpleSomeStructure.
    The following macros facilitate defining such variables
--- a/pidgin/gtkmain.c	Fri Apr 25 05:53:48 2008 +0000
+++ b/pidgin/gtkmain.c	Fri Apr 25 16:23:35 2008 +0000
@@ -27,6 +27,7 @@
 #include "account.h"
 #include "conversation.h"
 #include "core.h"
+#include "dbus-server.h"
 #include "debug.h"
 #include "eventloop.h"
 #include "ft.h"
@@ -783,6 +784,15 @@
 	}
 
 	if (opt_si && !purple_core_ensure_single_instance()) {
+#ifdef HAVE_DBUS
+		DBusConnection *conn = purple_dbus_get_connection();
+		DBusMessage *message = dbus_message_new_method_call(DBUS_SERVICE_PURPLE, DBUS_PATH_PURPLE,
+				DBUS_INTERFACE_PURPLE, "PurpleBlistSetVisible");
+		gboolean tr = TRUE;
+		dbus_message_append_args(message, DBUS_TYPE_UINT32, &tr, DBUS_TYPE_INVALID);
+		dbus_connection_send_with_reply_and_block(conn, message, -1, NULL);
+		dbus_message_unref(message);
+#endif
 		purple_debug_info("main", "exiting because another libpurple client is already running\n");
 		purple_core_quit();
 #ifdef HAVE_SIGNAL_H