aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-10-15 21:22:59 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-10-18 16:11:45 +0800
commite34270c0664061091a9abdebe3df75e76adc5f3f (patch)
tree203378bfce79c94a33e1da51bde2959d4f142c13 /src
parent383e325a32599a0d359e3574cb86859c8a1ed76c (diff)
downloadgsoc2013-empathy-e34270c0664061091a9abdebe3df75e76adc5f3f.tar
gsoc2013-empathy-e34270c0664061091a9abdebe3df75e76adc5f3f.tar.gz
gsoc2013-empathy-e34270c0664061091a9abdebe3df75e76adc5f3f.tar.bz2
gsoc2013-empathy-e34270c0664061091a9abdebe3df75e76adc5f3f.tar.lz
gsoc2013-empathy-e34270c0664061091a9abdebe3df75e76adc5f3f.tar.xz
gsoc2013-empathy-e34270c0664061091a9abdebe3df75e76adc5f3f.tar.zst
gsoc2013-empathy-e34270c0664061091a9abdebe3df75e76adc5f3f.zip
empathy-accounts: port to GtkApplication (#621339)
Diffstat (limited to 'src')
-rw-r--r--src/empathy-accounts.c53
1 files changed, 12 insertions, 41 deletions
diff --git a/src/empathy-accounts.c b/src/empathy-accounts.c
index 788bc89e4..4131100fb 100644
--- a/src/empathy-accounts.c
+++ b/src/empathy-accounts.c
@@ -31,7 +31,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include <unique/unique.h>
#include <telepathy-glib/account-manager.h>
#include <telepathy-glib/defs.h>
@@ -135,35 +134,17 @@ account_manager_ready_for_accounts_cb (GObject *source_object,
}
}
-static UniqueResponse
-unique_app_message_cb (UniqueApp *unique_app,
- gint command,
- UniqueMessageData *data,
- guint timestamp,
- gpointer user_data)
+static void
+app_activated_cb (GtkApplication *app)
{
- DEBUG ("Other instance launched, presenting the main window. "
- "Command=%d, timestamp %u", command, timestamp);
-
- if (command == UNIQUE_ACTIVATE)
- {
- TpAccountManager *account_manager;
+ TpAccountManager *account_manager;
- account_manager = tp_account_manager_dup ();
+ account_manager = tp_account_manager_dup ();
- empathy_accounts_show_accounts_ui (account_manager, NULL,
+ empathy_accounts_show_accounts_ui (account_manager, NULL,
G_CALLBACK (gtk_main_quit));
- g_object_unref (account_manager);
- }
- else
- {
- g_warning (G_STRLOC "unhandled unique app command %d", command);
-
- return UNIQUE_RESPONSE_PASSTHROUGH;
- }
-
- return UNIQUE_RESPONSE_OK;
+ g_object_unref (account_manager);
}
#define COMMAND_ACCOUNTS_DIALOG 1
@@ -173,7 +154,7 @@ main (int argc, char *argv[])
{
TpAccountManager *account_manager;
GError *error = NULL;
- UniqueApp *unique_app;
+ GtkApplication *app;
GOptionContext *optcontext;
GOptionEntry options[] = {
@@ -218,30 +199,20 @@ main (int argc, char *argv[])
gtk_window_set_default_icon_name ("empathy");
textdomain (GETTEXT_PACKAGE);
- unique_app = unique_app_new (EMPATHY_ACCOUNTS_DBUS_NAME, NULL);
-
- if (unique_app_is_running (unique_app))
- {
- if (unique_app_send_message (unique_app, UNIQUE_ACTIVATE, NULL) ==
- UNIQUE_RESPONSE_OK)
- {
- g_object_unref (unique_app);
- return EXIT_SUCCESS;
- }
- }
+ app = gtk_application_new (EMPATHY_ACCOUNTS_DBUS_NAME, &argc, &argv);
account_manager = tp_account_manager_dup ();
tp_account_manager_prepare_async (account_manager, NULL,
account_manager_ready_for_accounts_cb, selected_account_name);
- g_signal_connect (unique_app, "message-received",
- G_CALLBACK (unique_app_message_cb), NULL);
+ g_signal_connect (app, "activated",
+ G_CALLBACK (app_activated_cb), NULL);
- gtk_main ();
+ gtk_application_run (app);
g_object_unref (account_manager);
- g_object_unref (unique_app);
+ g_object_unref (app);
return EXIT_SUCCESS;
}