[gnome-settings-daemon] common: Add a "timed exit" option to plugins tests



commit 1a0178fcda44542d37997dc52574ea77dc19bcd8
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Mar 21 14:41:18 2013 +0100

    common: Add a "timed exit" option to plugins tests

 plugins/common/test-plugin.h |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/plugins/common/test-plugin.h b/plugins/common/test-plugin.h
index b277a59..eb45388 100644
--- a/plugins/common/test-plugin.h
+++ b/plugins/common/test-plugin.h
@@ -26,6 +26,12 @@
 #endif /* !PLUGIN_NAME */
 
 static MANAGER *manager = NULL;
+static int timeout = -1;
+
+static GOptionEntry entries[] = {
+        { "exit-time", 0, 0, G_OPTION_ARG_INT, &timeout, "Exit after n seconds time", NULL },
+        {NULL}
+};
 
 static gboolean
 has_settings (void)
@@ -64,12 +70,15 @@ main (int argc, char **argv)
        g_setenv ("G_MESSAGES_DEBUG", "all", TRUE);
 
         error = NULL;
-        if (! gtk_init_with_args (&argc, &argv, NULL, NULL, NULL, &error)) {
+        if (! gtk_init_with_args (&argc, &argv, SCHEMA_NAME, entries, NULL, &error)) {
                 fprintf (stderr, "%s\n", error->message);
                 g_error_free (error);
                 exit (1);
         }
 
+       if (timeout > 0)
+               g_timeout_add_seconds (timeout, (GSourceFunc) gtk_main_quit, NULL);
+
        if (has_settings () == FALSE) {
                fprintf (stderr, "The schemas for plugin '%s' isn't available, check your installation.\n", 
SCHEMA_NAME);
        } else {


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