summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2016-05-17 11:56:58 +0200
committerAlexander Larsson <alexl@redhat.com>2016-05-17 11:56:58 +0200
commitf916e87d742fbcbf91051b22a365fca2c6972e86 (patch)
tree31bf400b507c8208958045adb89a45d9ff45b866
parent18992c2fa0dfdcc93b516f3cb3a22f19d9af4c43 (diff)
downloadxdg-app-f916e87d742fbcbf91051b22a365fca2c6972e86.tar.gz
system-helper: Add --no-idle-exit commandline argument
This is useful for tests and debugging, where we don't want it to accidentally idle.
-rw-r--r--system-helper/flatpak-system-helper.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/system-helper/flatpak-system-helper.c b/system-helper/flatpak-system-helper.c
index 72249ab..40a7037 100644
--- a/system-helper/flatpak-system-helper.c
+++ b/system-helper/flatpak-system-helper.c
@@ -35,6 +35,8 @@ static FlatpakSystemHelper *helper = NULL;
static GMainLoop *main_loop = NULL;
static guint name_owner_id = 0;
+static gboolean no_idle_exit = FALSE;
+
#define IDLE_TIMEOUT_SECS 10*60
/* This uses a weird Auto prefix to avoid conflicts with later added polkit types.
@@ -102,10 +104,13 @@ schedule_idle_callback (void)
G_LOCK(idle);
- if (idle_timeout_id != 0)
- g_source_remove (idle_timeout_id);
+ if (!no_idle_exit)
+ {
+ if (idle_timeout_id != 0)
+ g_source_remove (idle_timeout_id);
- idle_timeout_id = g_timeout_add_seconds (IDLE_TIMEOUT_SECS, idle_timeout_cb, NULL);
+ idle_timeout_id = g_timeout_add_seconds (IDLE_TIMEOUT_SECS, idle_timeout_cb, NULL);
+ }
G_UNLOCK(idle);
}
@@ -677,6 +682,7 @@ main (int argc,
const GOptionEntry options[] = {
{ "replace", 'r', 0, G_OPTION_ARG_NONE, &replace, "Replace old daemon.", NULL },
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "Enable debug output.", NULL },
+ { "no-idle-exit", 0, 0, G_OPTION_ARG_NONE, &no_idle_exit, "Don't exit when idle.", NULL },
{ "version", 0, 0, G_OPTION_ARG_NONE, &show_version, "Show program version.", NULL},
{ NULL }
};