[evolution-patches] patch for session management in evo [primitive]
- From: Vivek Jain <jvivek novell com>
- To: evolution-patches gnome org
- Subject: [evolution-patches] patch for session management in evo [primitive]
- Date: Wed, 02 Nov 2005 12:29:10 +0530
hi,
I am trying to implement session management in evolution. As of now,
when gdm quits, it simply kills evo, without any sync'ing happening. I
have just added a few callbacks and ask shell to quit all the components
gracefully if 'shutdown' was 'true'.
Evolution is automatically re-started during the next log on, provided
we "save-current-setup".
Please let me know if this approach looks ok. Please drop in some
pointers about how/where to store info about the windows that evo had
opened, so that in the next log on they can be opened directly. Usage of
"gnome_client_request_save" is not very clear to me from documentation
whether this is the one I want.
Thanks,
Vivek Jain
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 2 Nov 2005 06:47:38 -0000
@@ -1,3 +1,12 @@
+2005-11-02 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):??
+
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 2 Nov 2005 06:47:38 -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,46 @@ 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] = "/opt/gnome2/bin/evolution-2.4"; //EVOLUTION;
+ args[1] = NULL;
+ gnome_client_set_restart_command (client, 1, args);
+
+ if (shutdown)
+ e_shell_quit (shell);
+
+ 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 +389,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]