[gnome-session] gsm: Share code to restart an app
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-session] gsm: Share code to restart an app
- Date: Tue, 27 Mar 2012 08:35:34 +0000 (UTC)
commit 16abf44d44b640d62204fd4e4a55c9ec648f5aa5
Author: Vincent Untz <vuntz gnome org>
Date: Fri Mar 23 16:54:52 2012 +0100
gsm: Share code to restart an app
https://bugzilla.gnome.org/show_bug.cgi?id=672419
gnome-session/gsm-manager.c | 46 ++++++++++++++++++------------------------
1 files changed, 20 insertions(+), 26 deletions(-)
---
diff --git a/gnome-session/gsm-manager.c b/gnome-session/gsm-manager.c
index 76b1d3b..210f1f7 100644
--- a/gnome-session/gsm-manager.c
+++ b/gnome-session/gsm-manager.c
@@ -612,21 +612,11 @@ app_event_during_startup (GsmManager *manager,
}
static void
-app_died (GsmApp *app,
- GsmManager *manager)
+_restart_app (GsmManager *manager,
+ GsmApp *app)
{
GError *error = NULL;
- g_signal_handlers_disconnect_by_func (app, app_registered, manager);
-
- g_warning ("Application '%s' killed by signal", gsm_app_peek_app_id (app));
-
- if (gsm_app_peek_autorestart (app)) {
- g_debug ("Component '%s' is autorestart, ignoring died signal",
- gsm_app_peek_app_id (app));
- return;
- }
-
if (!gsm_app_restart (app, &error)) {
if (is_app_required (manager, app)) {
on_required_app_failure (manager, app);
@@ -637,6 +627,23 @@ app_died (GsmApp *app,
app_event_during_startup (manager, app);
}
+}
+
+static void
+app_died (GsmApp *app,
+ GsmManager *manager)
+{
+ g_signal_handlers_disconnect_by_func (app, app_registered, manager);
+
+ g_warning ("Application '%s' killed by signal", gsm_app_peek_app_id (app));
+
+ if (gsm_app_peek_autorestart (app)) {
+ g_debug ("Component '%s' is autorestart, ignoring died signal",
+ gsm_app_peek_app_id (app));
+ return;
+ }
+
+ _restart_app (manager, app);
/* For now, we don't do anything with crashes from
* non-required apps after they hit the restart limit.
@@ -1779,8 +1786,6 @@ _disconnect_client (GsmManager *manager,
{
gboolean is_condition_client;
GsmApp *app;
- GError *error;
- gboolean res;
const char *app_id;
const char *startup_id;
gboolean app_restart;
@@ -1873,18 +1878,7 @@ _disconnect_client (GsmManager *manager,
g_debug ("GsmManager: restarting app");
- error = NULL;
- res = gsm_app_restart (app, &error);
- if (! res) {
- if (is_app_required (manager, app)) {
- on_required_app_failure (manager, app);
- } else {
- g_warning ("Error on restarting session managed app: %s", error->message);
- }
- g_clear_error (&error);
-
- app_event_during_startup (manager, app);
- }
+ _restart_app (manager, app);
out:
g_object_unref (client);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]