[evolution-patches] Session manage evolution-wombat



Currently, evolution-wombat doesn't register at all with the session
manager and so when you log out, it continues running.  Having it
continue running while you're logged in without evolution running is
useful (since evolution-alarm-notify needs it), but it really should
quit when you end your session so that bonobo-activation-server can die
as well to avoid the problems in
http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=106826.  Attached
patch implement.

This also changes evolution-alarm-notify's die() to call
bonobo_main_quit instead of gtk_main_quit since it uses bonobo_main and
not gtk_main

Jeremy
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/ChangeLog,v
retrieving revision 1.1215.2.11
diff -u -u -r1.1215.2.11 ChangeLog
--- ChangeLog	8 Oct 2003 16:06:07 -0000	1.1215.2.11
+++ ChangeLog	23 Oct 2003 19:20:48 -0000
@@ -1,3 +1,7 @@
+2003-10-22  Jeremy Katz  <katzj redhat com>
+
+	* configure.in (WOMBAT_CFLAGS): Add libgnomeui.
+
 2003-10-08  Frederic Crozat  <fcrozat mandrakesoft com>
 
 	* configure.in: Check for gnome-thumbnail.h existence.
Index: configure.in
===================================================================
RCS file: /cvs/gnome/evolution/configure.in,v
retrieving revision 1.591.2.9
diff -u -u -r1.591.2.9 configure.in
--- configure.in	8 Oct 2003 16:06:07 -0000	1.591.2.9
+++ configure.in	23 Oct 2003 19:20:49 -0000
@@ -1139,7 +1139,7 @@
 
 dnl -- wombat flags
 
-EVO_SET_COMPILE_FLAGS(WOMBAT, gal-2.0 libgnome-2.0, $LDAP_CFLAGS, $LDAP_LIBS)
+EVO_SET_COMPILE_FLAGS(WOMBAT, gal-2.0 libgnome-2.0 libgnomeui-2.0, $LDAP_CFLAGS, $LDAP_LIBS)
 AC_SUBST(WOMBAT_CFLAGS)
 AC_SUBST(WOMBAT_LIBS)
 
Index: wombat/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/wombat/ChangeLog,v
retrieving revision 1.85.4.1
diff -u -u -r1.85.4.1 ChangeLog
--- wombat/ChangeLog	10 Sep 2003 21:39:51 -0000	1.85.4.1
+++ wombat/ChangeLog	23 Oct 2003 19:20:49 -0000
@@ -1,3 +1,11 @@
+2003-10-22  Jeremy Katz  <katzj redhat com>
+
+	* wombat.c (main): Use LIBGNOMEUI_MODULE to get session management.
+	(set_session_parameters): Register with the session
+	manager and shut down properly when the session manager says to.
+	(setup_pcs): Ref the cal_factory.
+	(setup_pas): Ref the pas_book_factory.
+
 2003-09-09  egallego telefonica net
 
 	Fixes #46130
Index: wombat/wombat.c
===================================================================
RCS file: /cvs/gnome/evolution/wombat/wombat.c,v
retrieving revision 1.42
diff -u -u -r1.42 wombat.c
--- wombat/wombat.c	28 Mar 2003 21:41:44 -0000	1.42
+++ wombat/wombat.c	23 Oct 2003 19:20:49 -0000
@@ -21,11 +21,14 @@
 #include <glib.h>
 #include <libgnome/gnome-init.h>
 #include <bonobo-activation/bonobo-activation.h>
+#include <libgnomeui/gnome-client.h>
+#include <libgnomeui/gnome-ui-init.h>
 #include <libgnomevfs/gnome-vfs-init.h>
 #include <bonobo/bonobo-main.h>
 #include <bonobo/bonobo-i18n.h>
 #include <bonobo/bonobo-exception.h>
 #include <bonobo/bonobo-generic-factory.h>
+#include <gtk/gtkmain.h>
 
 #include "pas/pas-book-factory.h"
 #include "pas/pas-backend-file.h"
@@ -54,6 +57,8 @@
 /* Timeout ID for termination handler */
 static guint termination_handler_id;
 
+static GnomeClient *master_client = NULL;
+
 
 
 /* Termination */
@@ -101,6 +106,8 @@
 	if (!pas_book_factory)
 		return FALSE;
 
+        bonobo_object_ref (BONOBO_OBJECT (pas_book_factory));
+
 	pas_book_factory_register_backend (
 		pas_book_factory, "file", pas_backend_file_new);
 
@@ -144,6 +151,8 @@
 		return FALSE;
 	}
 
+        bonobo_object_ref (BONOBO_OBJECT (cal_factory));
+
 	cal_factory_register_method (cal_factory, "file", CAL_BACKEND_FILE_TYPE);
 
 	if (!cal_factory_oaf_register (cal_factory, CAL_FACTORY_OAF_ID)) {
@@ -176,6 +185,42 @@
 }
 
 
+/* Callback for the master client's "die" signal.  We need to shut down
+ * since the session is ending.
+ */
+static void
+client_die_cb (GnomeClient *client)
+{
+    bonobo_main_quit ();
+}
+
+/* Sees if a session manager is present and connects to it if present so 
+ * that we terminate properly when the session ends.
+ */
+static void
+set_session_parameters (void)
+{
+	int flags;
+
+	master_client = gnome_master_client ();
+        if (!GNOME_CLIENT_CONNECTED (master_client)) {
+                fprintf (stderr, "Error: could not connect to the session manager\n");
+                return;
+        }
+
+	flags = gnome_client_get_flags (master_client);
+
+	if (!(flags & GNOME_CLIENT_IS_CONNECTED))
+		return;
+
+        /* we'll always get started for other things anyway */
+	gnome_client_set_restart_style (master_client, GNOME_RESTART_NEVER);
+
+	g_signal_connect (G_OBJECT (master_client), "die",
+			  G_CALLBACK (client_die_cb), NULL);
+}
+
+
 
 #ifdef DEBUG_BACKENDS
 static void
@@ -201,7 +246,7 @@
 #endif
 
        	gnome_program_init ("Wombat", VERSION,
-			    LIBGNOME_MODULE,
+			    LIBGNOMEUI_MODULE,
 			    argc, argv,
 			    GNOME_PROGRAM_STANDARD_PROPERTIES, NULL);
 
@@ -242,7 +287,10 @@
 
 	g_print ("Wombat up and running\n");
 
+        set_session_parameters();
+
 	bonobo_main ();
+
 
 	bonobo_object_unref (BONOBO_OBJECT (cal_factory));
 	cal_factory = NULL;
Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.1802.2.35
diff -u -u -r1.1802.2.35 ChangeLog
--- calendar/ChangeLog	8 Oct 2003 09:32:06 -0000	1.1802.2.35
+++ calendar/ChangeLog	23 Oct 2003 19:20:49 -0000
@@ -1,3 +1,9 @@
+2003-10-22  Jeremy Katz  <katzj redhat com>
+
+	* gui/alarm-notify/notify-main.c (client_die_cb): Use
+	bonobo_main_quit() instead of gtk_main_quit() since there's only a
+	bonobo main loop.
+
 2003-10-08  Harry Lu  <harry lu sun com>
 
 	* gui/dialogs/alarm-options.glade: Make repeat-quantity and 
Index: calendar/gui/alarm-notify/notify-main.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/alarm-notify/notify-main.c,v
retrieving revision 1.25.4.2
diff -u -u -r1.25.4.2 notify-main.c
--- calendar/gui/alarm-notify/notify-main.c	22 Aug 2003 15:23:35 -0000	1.25.4.2
+++ calendar/gui/alarm-notify/notify-main.c	23 Oct 2003 19:20:49 -0000
@@ -55,7 +55,7 @@
 static void
 client_die_cb (GnomeClient *client)
 {
-	gtk_main_quit ();
+	bonobo_main_quit ();
 }
 
 /* Sees if a session manager is present.  If so, it tells the SM how to restart


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