diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-10-16 21:04:21 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-10-16 21:38:21 +0800 |
commit | 4afc8d39bf9371d4e76eae54e5b8d825366476b7 (patch) | |
tree | 907e81320fc8161caec2b9732f6d2763bc735925 /shell | |
parent | a902cc15ed320d304de306a0f63db127d41e3e18 (diff) | |
download | gsoc2013-evolution-4afc8d39bf9371d4e76eae54e5b8d825366476b7.tar.gz gsoc2013-evolution-4afc8d39bf9371d4e76eae54e5b8d825366476b7.tar.zst gsoc2013-evolution-4afc8d39bf9371d4e76eae54e5b8d825366476b7.zip |
Bug 676141 - Use GtkApplication for session management
As of GTK+ 3.4, GtkApplication now provides session management
support similar to EggSMClient. So drop our copy of EggSMClient.
Diffstat (limited to 'shell')
-rw-r--r-- | shell/Makefile.am | 1 | ||||
-rw-r--r-- | shell/e-shell.c | 56 | ||||
-rw-r--r-- | shell/main.c | 1 |
3 files changed, 14 insertions, 44 deletions
diff --git a/shell/Makefile.am b/shell/Makefile.am index 32f33ee919..8e21c7eca2 100644 --- a/shell/Makefile.am +++ b/shell/Makefile.am @@ -93,7 +93,6 @@ libeshell_la_LDFLAGS = -avoid-version $(NO_UNDEFINED) libeshell_la_LIBADD = \ $(top_builddir)/e-util/libeutil.la \ $(top_builddir)/filter/libfilter.la \ - $(top_builddir)/smclient/libeggsmclient.la \ $(top_builddir)/widgets/misc/libemiscwidgets.la \ $(top_builddir)/widgets/menus/libmenus.la \ $(top_builddir)/libemail-utils/libemail-utils.la \ diff --git a/shell/e-shell.c b/shell/e-shell.c index 0f11c16903..3440df7bbf 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -37,7 +37,6 @@ #include "e-util/e-util.h" #include "e-util/e-util-private.h" -#include "smclient/eggsmclient.h" #include "widgets/misc/e-preferences-window.h" #include "e-shell-backend.h" @@ -69,6 +68,8 @@ struct _EShellPrivate { gchar *startup_view; + guint inhibit_cookie; + guint auto_reconnect : 1; guint express_mode : 1; guint meego_mode : 1; @@ -406,6 +407,8 @@ shell_ready_for_quit (EShell *shell, /* Finalize the activity. */ g_object_unref (activity); + gtk_application_uninhibit (application, shell->priv->inhibit_cookie); + /* Destroy all watched windows. Note, we iterate over a -copy- * of the watched windows list because the act of destroying a * watched window will modify the watched windows list, which @@ -430,6 +433,13 @@ shell_prepare_for_quit (EShell *shell) application = GTK_APPLICATION (shell); + shell->priv->inhibit_cookie = gtk_application_inhibit ( + application, NULL, + GTK_APPLICATION_INHIBIT_SWITCH | + GTK_APPLICATION_INHIBIT_LOGOUT | + GTK_APPLICATION_INHIBIT_SUSPEND, + _("Preparing to quit")); + shell->priv->preparing_for_quit = e_activity_new (); e_activity_set_text ( @@ -519,32 +529,8 @@ shell_process_backend (EShellBackend *shell_backend, } static void -shell_sm_quit_requested_cb (EShell *shell, - EggSMClient *sm_client) -{ - EShellQuitReason reason = E_SHELL_QUIT_SESSION_REQUEST; - gboolean will_quit; - - /* If preparations are already in progress then we have already - * committed ourselves to quitting, and can answer 'yes'. */ - if (shell->priv->preparing_for_quit == NULL) - will_quit = shell_request_quit (shell, reason); - else - will_quit = TRUE; - - egg_sm_client_will_quit (sm_client, will_quit); -} - -static void -shell_sm_quit_cancelled_cb (EShell *shell, - EggSMClient *sm_client) -{ - /* Nothing to do. This is just to aid debugging. */ -} - -static void shell_sm_quit_cb (EShell *shell, - EggSMClient *sm_client) + gpointer user_data) { shell_prepare_for_quit (shell); } @@ -1208,7 +1194,6 @@ e_shell_init (EShell *shell) GHashTable *backends_by_name; GHashTable *backends_by_scheme; GtkIconTheme *icon_theme; - EggSMClient *sm_client; shell->priv = E_SHELL_GET_PRIVATE (shell); @@ -1246,23 +1231,8 @@ e_shell_init (EShell *shell) "org.gnome.evolution.shell", "start-offline"); - /*** Session Management ***/ - - sm_client = egg_sm_client_get (); - - /* Not participating in session saving yet. */ - egg_sm_client_set_mode (EGG_SM_CLIENT_MODE_NO_RESTART); - - g_signal_connect_swapped ( - sm_client, "quit-requested", - G_CALLBACK (shell_sm_quit_requested_cb), shell); - - g_signal_connect_swapped ( - sm_client, "quit-cancelled", - G_CALLBACK (shell_sm_quit_cancelled_cb), shell); - g_signal_connect_swapped ( - sm_client, "quit", + G_APPLICATION (shell), "shutdown", G_CALLBACK (shell_sm_quit_cb), shell); } diff --git a/shell/main.c b/shell/main.c index 2dbb132f1f..c7172bea28 100644 --- a/shell/main.c +++ b/shell/main.c @@ -417,6 +417,7 @@ create_default_shell (void) "express-mode", express_mode, "small-screen-mode", small_screen, "online", online, + "register-session", TRUE, NULL); /* Failure to register is fatal. */ |