aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-10-15 20:35:19 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-10-18 16:11:45 +0800
commit383e325a32599a0d359e3574cb86859c8a1ed76c (patch)
tree121ec4168833d0adf48016ce710d42a453a78a71
parent5d9afc90e6d9f07aa3408c1e230d0856d71f1363 (diff)
downloadgsoc2013-empathy-383e325a32599a0d359e3574cb86859c8a1ed76c.tar
gsoc2013-empathy-383e325a32599a0d359e3574cb86859c8a1ed76c.tar.gz
gsoc2013-empathy-383e325a32599a0d359e3574cb86859c8a1ed76c.tar.bz2
gsoc2013-empathy-383e325a32599a0d359e3574cb86859c8a1ed76c.tar.lz
gsoc2013-empathy-383e325a32599a0d359e3574cb86859c8a1ed76c.tar.xz
gsoc2013-empathy-383e325a32599a0d359e3574cb86859c8a1ed76c.tar.zst
gsoc2013-empathy-383e325a32599a0d359e3574cb86859c8a1ed76c.zip
Use GtkApplication::activated instead of libunique
Also use empathy_window_present() to present the existing window as it does what we need.
-rw-r--r--src/empathy.c75
1 files changed, 21 insertions, 54 deletions
diff --git a/src/empathy.c b/src/empathy.c
index 9b426b9e0..52b649777 100644
--- a/src/empathy.c
+++ b/src/empathy.c
@@ -30,7 +30,6 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
-#include <unique/unique.h>
#ifdef HAVE_LIBCHAMPLAIN
#include <clutter-gtk/clutter-gtk.h>
@@ -114,7 +113,6 @@ struct _EmpathyApp
EmpathyIdle *idle;
EmpathyConnectivity *connectivity;
EmpathyChatManager *chat_manager;
- UniqueApp *unique_app;
GSettings *gsettings;
#ifdef HAVE_GEOCLUE
EmpathyLocationManager *location_manager;
@@ -155,7 +153,6 @@ empathy_app_dispose (GObject *object)
tp_clear_object (&self->location_manager);
#endif
tp_clear_object (&self->ft_factory);
- tp_clear_object (&self->unique_app);
tp_clear_object (&self->gsettings);
if (dispose != NULL)
@@ -231,12 +228,31 @@ empathy_app_set_property (GObject *object,
}
}
+static void
+empathy_app_activated (GtkApplication *app,
+ GVariant *args)
+{
+ EmpathyApp *self = (EmpathyApp *) app;
+
+ /* We're requested to show stuff again, disable the start hidden global
+ * in case the accounts wizard wants to pop up.
+ */
+ self->start_hidden = FALSE;
+
+ empathy_window_present (GTK_WINDOW (self->window));
+
+ /* Display the accounts dialog if needed */
+ tp_account_manager_prepare_async (self->account_manager, NULL,
+ account_manager_ready_cb, self);
+}
+
static void empathy_app_constructed (GObject *object);
static void
empathy_app_class_init (EmpathyAppClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GtkApplicationClass *gtk_app_class = GTK_APPLICATION_CLASS (klass);
GParamSpec *spec;
gobject_class->set_property = empathy_app_set_property;
@@ -244,6 +260,8 @@ empathy_app_class_init (EmpathyAppClass *klass)
gobject_class->dispose = empathy_app_dispose;
gobject_class->finalize = empathy_app_finalize;
+ gtk_app_class->activated = empathy_app_activated;
+
spec = g_param_spec_boolean ("no-connect", "no connect",
"Don't connect on startup",
FALSE,
@@ -350,42 +368,6 @@ show_accounts_ui (EmpathyApp *self,
NULL, if_needed, self->start_hidden);
}
-static UniqueResponse
-unique_app_message_cb (UniqueApp *unique_app,
- gint command,
- UniqueMessageData *data,
- guint timestamp,
- gpointer user_data)
-{
- EmpathyApp *self = user_data;
- TpAccountManager *account_manager;
-
- DEBUG ("Other instance launched, presenting the main window. "
- "Command=%d, timestamp %u", command, timestamp);
-
- /* XXX: the standalone app somewhat breaks this case, since
- * communicating it would be a pain */
-
- /* We're requested to show stuff again, disable the start hidden global
- * in case the accounts wizard wants to pop up.
- */
- self->start_hidden = FALSE;
-
- gtk_window_set_screen (GTK_WINDOW (self->window),
- unique_message_data_get_screen (data));
- gtk_window_set_startup_id (GTK_WINDOW (self->window),
- unique_message_data_get_startup_id (data));
- gtk_window_present_with_time (GTK_WINDOW (self->window), timestamp);
- gtk_window_set_skip_taskbar_hint (GTK_WINDOW (self->window), FALSE);
-
- account_manager = tp_account_manager_dup ();
- tp_account_manager_prepare_async (account_manager, NULL,
- account_manager_ready_cb, self);
- g_object_unref (account_manager);
-
- return UNIQUE_RESPONSE_OK;
-}
-
static gboolean
show_version_cb (const char *option_name,
const char *value,
@@ -585,18 +567,6 @@ empathy_app_constructed (GObject *object)
g_log_set_default_handler (tp_debug_sender_log_handler, G_LOG_DOMAIN);
#endif
- self->unique_app = unique_app_new ("org.gnome."PACKAGE_NAME, NULL);
-
- if (unique_app_is_running (self->unique_app))
- {
- if (unique_app_send_message (self->unique_app, UNIQUE_ACTIVATE, NULL) ==
- UNIQUE_RESPONSE_OK)
- {
- g_object_unref (self->unique_app);
- exit (EXIT_SUCCESS);
- }
- }
-
notify_init (_(PACKAGE_NAME));
/* Setting up Idle */
@@ -639,9 +609,6 @@ empathy_app_constructed (GObject *object)
/* Chat manager */
self->chat_manager = empathy_chat_manager_dup_singleton ();
- g_signal_connect (self->unique_app, "message-received",
- G_CALLBACK (unique_app_message_cb), self);
-
/* Logging */
self->log_manager = tpl_log_manager_dup_singleton ();