gnome-session r4958 - in trunk: . gnome-session



Author: mccann
Date: Fri Aug 15 17:09:43 2008
New Revision: 4958
URL: http://svn.gnome.org/viewvc/gnome-session?rev=4958&view=rev

Log:
2008-08-15  William Jon McCann  <jmccann redhat com>

	* gnome-session/gdm-signal-handler.c (signal_io_watch),
	(gdm_signal_handler_set_fatal_func):
	* gnome-session/gdm-signal-handler.h:
	* gnome-session/main.c (main):
	Allow the signal handler to call gtk_main_quit.



Modified:
   trunk/ChangeLog
   trunk/gnome-session/gdm-signal-handler.c
   trunk/gnome-session/gdm-signal-handler.h
   trunk/gnome-session/main.c

Modified: trunk/gnome-session/gdm-signal-handler.c
==============================================================================
--- trunk/gnome-session/gdm-signal-handler.c	(original)
+++ trunk/gnome-session/gdm-signal-handler.c	Fri Aug 15 17:09:43 2008
@@ -50,11 +50,12 @@
 
 struct GdmSignalHandlerPrivate
 {
-        GMainLoop  *main_loop;
-        GHashTable *lookup;
-        GHashTable *id_lookup;
-        GHashTable *action_lookup;
-        guint       next_id;
+        GHashTable    *lookup;
+        GHashTable    *id_lookup;
+        GHashTable    *action_lookup;
+        guint          next_id;
+        GDestroyNotify fatal_func;
+        gpointer       fatal_data;
 };
 
 static void     gdm_signal_handler_class_init   (GdmSignalHandlerClass *klass);
@@ -140,10 +141,11 @@
         block_signals_pop ();
 
         if (is_fatal) {
-                g_debug ("GdmSignalHandler: Caught termination signal - exiting main loop");
-                if (handler->priv->main_loop != NULL) {
-                        g_main_loop_quit (handler->priv->main_loop);
+                if (handler->priv->fatal_func != NULL) {
+                        g_debug ("GdmSignalHandler: Caught termination signal - calling fatal func");
+                        handler->priv->fatal_func (handler->priv->fatal_data);
                 } else {
+                        g_debug ("GdmSignalHandler: Caught termination signal - exiting");
                         exit (1);
                 }
 
@@ -456,13 +458,14 @@
 }
 
 void
-gdm_signal_handler_set_main_loop (GdmSignalHandler *handler,
-                                  GMainLoop        *main_loop)
+gdm_signal_handler_set_fatal_func (GdmSignalHandler *handler,
+                                   GDestroyNotify    func,
+                                   gpointer          user_data)
 {
         g_return_if_fail (GDM_IS_SIGNAL_HANDLER (handler));
 
-        /* FIXME: take a ref */
-        handler->priv->main_loop = main_loop;
+        handler->priv->fatal_func = func;
+        handler->priv->fatal_data = user_data;
 }
 
 static void

Modified: trunk/gnome-session/gdm-signal-handler.h
==============================================================================
--- trunk/gnome-session/gdm-signal-handler.h	(original)
+++ trunk/gnome-session/gdm-signal-handler.h	Fri Aug 15 17:09:43 2008
@@ -53,8 +53,9 @@
 GType               gdm_signal_handler_get_type                (void);
 
 GdmSignalHandler *  gdm_signal_handler_new                     (void);
-void                gdm_signal_handler_set_main_loop           (GdmSignalHandler    *handler,
-                                                                GMainLoop           *main_loop);
+void                gdm_signal_handler_set_fatal_func          (GdmSignalHandler    *handler,
+                                                                GDestroyNotify       func,
+                                                                gpointer             user_data);
 
 void                gdm_signal_handler_add_fatal               (GdmSignalHandler    *handler);
 guint               gdm_signal_handler_add                     (GdmSignalHandler    *handler,

Modified: trunk/gnome-session/main.c
==============================================================================
--- trunk/gnome-session/main.c	(original)
+++ trunk/gnome-session/main.c	Fri Aug 15 17:09:43 2008
@@ -422,6 +422,7 @@
         }
 
         signal_handler = gdm_signal_handler_new ();
+        gdm_signal_handler_set_fatal_func (signal_handler, (GDestroyNotify)gtk_main_quit, NULL);
         gdm_signal_handler_add_fatal (signal_handler);
         gdm_signal_handler_add (signal_handler, SIGTERM, signal_cb, NULL);
         gdm_signal_handler_add (signal_handler, SIGINT, signal_cb, NULL);
@@ -466,9 +467,8 @@
                 g_object_unref (xsmp_server);
         }
 
-        gsm_gconf_shutdown ();
-
         if (manager != NULL) {
+                g_debug ("Unreffing manager");
                 g_object_unref (manager);
         }
 
@@ -476,5 +476,7 @@
                 g_object_unref (client_store);
         }
 
+        gsm_gconf_shutdown ();
+
         return 0;
 }



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