[gnome-session] gsm: Pass exit code in "exited" signal of GsmApp



commit 35c9e37483c1c734fdff673b3899f8723b6b0af5
Author: Vincent Untz <vuntz gnome org>
Date:   Fri Mar 23 16:59:08 2012 +0100

    gsm: Pass exit code in "exited" signal of GsmApp
    
    https://bugzilla.gnome.org/show_bug.cgi?id=672419

 gnome-session/gsm-app.c           |    9 +++++----
 gnome-session/gsm-app.h           |    6 ++++--
 gnome-session/gsm-autostart-app.c |    2 +-
 gnome-session/gsm-manager.c       |   12 +++++++++++-
 4 files changed, 21 insertions(+), 8 deletions(-)
---
diff --git a/gnome-session/gsm-app.c b/gnome-session/gsm-app.c
index 6b94753..ad940dd 100644
--- a/gnome-session/gsm-app.c
+++ b/gnome-session/gsm-app.c
@@ -283,9 +283,9 @@ gsm_app_class_init (GsmAppClass *klass)
                               G_SIGNAL_RUN_LAST,
                               G_STRUCT_OFFSET (GsmAppClass, exited),
                               NULL, NULL,
-                              g_cclosure_marshal_VOID__VOID,
+                              g_cclosure_marshal_VOID__UCHAR,
                               G_TYPE_NONE,
-                              0);
+                              1, G_TYPE_UCHAR);
         signals[DIED] =
                 g_signal_new ("died",
                               G_OBJECT_CLASS_TYPE (object_class),
@@ -471,11 +471,12 @@ gsm_app_registered (GsmApp *app)
 }
 
 void
-gsm_app_exited (GsmApp *app)
+gsm_app_exited (GsmApp *app,
+                guchar  exit_code)
 {
         g_return_if_fail (GSM_IS_APP (app));
 
-        g_signal_emit (app, signals[EXITED], 0);
+        g_signal_emit (app, signals[EXITED], 0, exit_code);
 }
 
 void
diff --git a/gnome-session/gsm-app.h b/gnome-session/gsm-app.h
index fa11b67..9604b96 100644
--- a/gnome-session/gsm-app.h
+++ b/gnome-session/gsm-app.h
@@ -54,7 +54,8 @@ struct _GsmAppClass
         GObjectClass parent_class;
 
         /* signals */
-        void        (*exited)       (GsmApp *app);
+        void        (*exited)       (GsmApp *app,
+                                     guchar  exit_code);
         void        (*died)         (GsmApp *app);
         void        (*registered)   (GsmApp *app);
 
@@ -109,7 +110,8 @@ gboolean         gsm_app_stop                           (GsmApp     *app,
                                                          GError    **error);
 gboolean         gsm_app_is_running                     (GsmApp     *app);
 
-void             gsm_app_exited                         (GsmApp     *app);
+void             gsm_app_exited                         (GsmApp     *app,
+                                                         guchar      exit_code);
 void             gsm_app_died                           (GsmApp     *app);
 
 gboolean         gsm_app_provides                       (GsmApp     *app,
diff --git a/gnome-session/gsm-autostart-app.c b/gnome-session/gsm-autostart-app.c
index 5443c44..70118f3 100644
--- a/gnome-session/gsm-autostart-app.c
+++ b/gnome-session/gsm-autostart-app.c
@@ -919,7 +919,7 @@ app_exited (GPid             pid,
         app->priv->child_watch_id = 0;
 
         if (WIFEXITED (status)) {
-                gsm_app_exited (GSM_APP (app));
+                gsm_app_exited (GSM_APP (app), WEXITSTATUS (status));
         } else if (WIFSIGNALED (status)) {
                 gsm_app_died (GSM_APP (app));
         }
diff --git a/gnome-session/gsm-manager.c b/gnome-session/gsm-manager.c
index 787b28e..6d01b98 100644
--- a/gnome-session/gsm-manager.c
+++ b/gnome-session/gsm-manager.c
@@ -654,6 +654,16 @@ app_died (GsmApp     *app,
 }
 
 static void
+app_exited (GsmApp     *app,
+            guchar      exit_code,
+            GsmManager *manager)
+{
+        g_debug ("App %s exited with %d", gsm_app_peek_app_id (app), exit_code);
+
+        app_event_during_startup (manager, app);
+}
+
+static void
 app_registered (GsmApp     *app,
                 GsmManager *manager)
 {
@@ -750,7 +760,7 @@ _start_app (const char *id,
                  */
                 g_signal_connect (app,
                                   "exited",
-                                  G_CALLBACK (app_registered),
+                                  G_CALLBACK (app_exited),
                                   manager);
                 g_signal_connect (app,
                                   "registered",



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