[evolution] Bug 676141 - Use GtkApplication for session management



commit 4afc8d39bf9371d4e76eae54e5b8d825366476b7
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue Oct 16 09:04:21 2012 -0400

    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.

 Makefile.am                     |    1 -
 configure.ac                    |   12 -
 doc/reference/shell/Makefile.am |    2 -
 shell/Makefile.am               |    1 -
 shell/e-shell.c                 |   56 +--
 shell/main.c                    |    1 +
 smclient/Makefile.am            |   50 --
 smclient/README                 |    2 -
 smclient/eggdesktopfile.c       | 1505 ---------------------------------------
 smclient/eggdesktopfile.h       |  158 ----
 smclient/eggsmclient-private.h  |   52 --
 smclient/eggsmclient-win32.c    |  349 ---------
 smclient/eggsmclient-xsmp.c     | 1389 ------------------------------------
 smclient/eggsmclient.c          |  593 ---------------
 smclient/eggsmclient.h          |  117 ---
 15 files changed, 14 insertions(+), 4274 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index a8dc58d..379c80f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -50,7 +50,6 @@ endif
 SUBDIRS = 			\
 	m4			\
 	data			\
-	smclient		\
 	libgnomecanvas		\
 	libevolution-utils	\
 	filter			\
diff --git a/configure.ac b/configure.ac
index db4a7af..68dad62 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1188,17 +1188,6 @@ CFLAGS=$save_cflags
 LIBS=$save_libs
 AC_MSG_RESULT([$ac_cv_have_iuth])
 
-dnl *****************
-dnl EggSMClient Flags
-dnl *****************
-if test "x$os_win32" = "xyes"; then
-	PKG_CHECK_MODULES([EGG_SMCLIENT], [gtk+-3.0])
-else
-	PKG_CHECK_MODULES([EGG_SMCLIENT], [gtk+-3.0 ice sm])
-fi
-AC_SUBST(EGG_SMCLIENT_CFLAGS)
-AC_SUBST(EGG_SMCLIENT_LIBS)
-
 dnl *******************
 dnl Special directories
 dnl *******************
@@ -1682,7 +1671,6 @@ plugins/pst-import/Makefile
 plugins/publish-calendar/Makefile
 plugins/save-calendar/Makefile
 plugins/templates/Makefile
-smclient/Makefile
 smime/Makefile
 smime/lib/Makefile
 smime/gui/Makefile
diff --git a/doc/reference/shell/Makefile.am b/doc/reference/shell/Makefile.am
index 2e26691..40004ab 100644
--- a/doc/reference/shell/Makefile.am
+++ b/doc/reference/shell/Makefile.am
@@ -59,8 +59,6 @@ GTKDOC_LIBS=								\
 	$(top_builddir)/shell/libeshell.la				\
 	$(top_builddir)/e-util/libeutil.la				\
 	$(top_builddir)/filter/libfilter.la				\
-	$(top_builddir)/smclient/libeggsmclient.la			\
-	$(top_builddir)/smclient/libeggdesktopfile.la			\
 	$(top_builddir)/widgets/menus/libmenus.la			\
 	$(top_builddir)/widgets/misc/libemiscwidgets.la			\
 	$(EVOLUTION_DATA_SERVER_LIBS)					\
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 32f33ee..8e21c7e 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 0f11c16..3440df7 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 2dbb132..c7172be 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. */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]