Re: [evolution-patches] patch for session management in evo [primitive]



I am attaching the modified patch. Please tell me if it looks ok to
commit.

On Wed, 2005-11-02 at 23:05 +0530, Vivek Jain wrote:
> > Another issue is that the sesssion_save_cb restart command has a
> > hardcoded "/opt/gnome2/bin/evolution-2.4" which looks dubious to me
> > (e.g. what happens when we move to evolution-2.6, what about different
> > installation paths etc).
> 
> http://mail.gnome.org/archives/evolution-patches/2005-November/msg00002.html
> 
> Thanks,
> Vivek Jain
> _______________________________________________
> Evolution-patches mailing list
> Evolution-patches gnome org
> http://mail.gnome.org/mailman/listinfo/evolution-patches
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/shell/ChangeLog,v
retrieving revision 1.1542
diff -u -p -r1.1542 ChangeLog
--- ChangeLog	25 Oct 2005 05:56:13 -0000	1.1542
+++ ChangeLog	8 Nov 2005 11:02:21 -0000
@@ -1,3 +1,12 @@
+2005-11-08  Vivek Jain  <jvivek novell com>
+	
+	* main.c: (idle_cb): call (init_session)
+	a new function for setting up callbacks when 
+	evolution receives signals from session-manager
+	(save_session_cb): asks shell to quit gracefully when 'shutdown'
+	was sent
+	(die_cb): calls bonobo_main_shutdown
+
 2005-10-25  Harish Krishnaswamy  <kharish novell com>
 
 	* main.c: (show_development_warning): Update
Index: main.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/main.c,v
retrieving revision 1.174
diff -u -p -r1.174 main.c
--- main.c	25 Oct 2005 05:56:13 -0000	1.174
+++ main.c	8 Nov 2005 11:02:21 -0000
@@ -58,6 +58,7 @@
 #include <libgnome/gnome-i18n.h>
 #include <libgnome/gnome-util.h>
 #include <libgnome/gnome-sound.h>
+#include <libgnomeui/gnome-client.h>
 #include <libgnomeui/gnome-ui-init.h>
 
 #include <bonobo/bonobo-main.h>
@@ -104,6 +105,8 @@ static gint idle_cb (void *data);
 static char *default_component_id = NULL;
 static char *evolution_debug_log = NULL;
 
+#define EVOLUTION "evolution-" BASE_VERSION
+
 static void
 no_windows_left_cb (EShell *shell, gpointer data)
 {
@@ -318,6 +321,53 @@ open_uris (GNOME_Evolution_Shell corba_s
 	CORBA_exception_free (&ev);
 }
 
+
+/**************************************/
+static void
+client_die_cb (GnomeClient *client, gpointer data)
+{
+	bonobo_main_quit ();
+}
+
+
+static gint
+save_session_cb (GnomeClient *client, gint arg1, GnomeSaveStyle save_style, gint shutdown,
+		GnomeInteractStyle interact_style, gint fast, gpointer user_data)
+{
+	char *args[2];
+	EShell *shell = (EShell *)user_data;
+
+	args[0] = EVOLUTION;
+	args[1] = NULL;
+	gnome_client_set_restart_command (client, 1, args);
+	
+	if (shutdown)
+		e_shell_quit (shell);
+
+	gnome_client_request_save (client,
+			save_style,
+			shutdown,
+			interact_style,
+			fast,
+			TRUE); /*propagte to other apps??*/
+	
+	return TRUE;
+}
+
+static void
+init_session (EShell *shell)
+{
+	GnomeClient *master_client;
+
+	master_client = gnome_master_client ();
+
+	g_signal_connect (G_OBJECT (master_client), "die",
+			  G_CALLBACK (client_die_cb), NULL);
+	g_signal_connect (G_OBJECT (master_client), "save_yourself",
+			  G_CALLBACK (save_session_cb), shell);
+	gnome_client_set_restart_style (master_client, GNOME_RESTART_IF_RUNNING);
+}
+
 /* This is for doing stuff that requires the GTK+ loop to be running already.  */
 
 static gint
@@ -346,6 +396,7 @@ idle_cb (void *data)
 		startup_line_mode = E_SHELL_STARTUP_LINE_MODE_OFFLINE;
 
 	shell = e_shell_new (startup_line_mode, &result);
+	init_session (shell);
 
 	switch (result) {
 	case E_SHELL_CONSTRUCT_RESULT_OK:


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