From 4afc8d39bf9371d4e76eae54e5b8d825366476b7 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 16 Oct 2012 09:04:21 -0400 Subject: 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. --- shell/Makefile.am | 1 - shell/e-shell.c | 56 +++++++++++++------------------------------------------ shell/main.c | 1 + 3 files changed, 14 insertions(+), 44 deletions(-) (limited to 'shell') 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 ( @@ -518,33 +528,9 @@ shell_process_backend (EShellBackend *shell_backend, backends_by_scheme, string, 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. */ -- cgit v1.2.3