From 7768355b2478df9c72025752fd82262523285a18 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 22 Feb 2013 23:58:36 -0500 Subject: [PATCH] evolution-user-prompter: Add a --keep-running option. This thing keeps quitting on me when run from the command-line. --- .../evolution-user-prompter.c | 30 +++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/services/evolution-user-prompter/evolution-user-prompter.c b/services/evolution-user-prompter/evolution-user-prompter.c index 64c64b8..682be17 100644 --- a/services/evolution-user-prompter/evolution-user-prompter.c +++ b/services/evolution-user-prompter/evolution-user-prompter.c @@ -16,20 +16,29 @@ * */ -#ifdef HAVE_CONFIG_H #include -#endif /* HAVE_CONFIG_H */ - #include #include +#include #include "prompt-user.h" +static gboolean opt_keep_running = FALSE; + +static GOptionEntry entries[] = { + + { "keep-running", 'r', 0, G_OPTION_ARG_NONE, &opt_keep_running, + N_("Keep running after the last client is closed"), NULL }, + { NULL } +}; + gint main (gint argc, gchar **argv) { + GOptionContext *context; EDBusServer *server; + GError *error = NULL; setlocale (LC_ALL, ""); bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); @@ -37,6 +46,16 @@ main (gint argc, prompt_user_init (&argc, &argv); + context = g_option_context_new (NULL); + g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE); + g_option_context_parse (context, &argc, &argv, &error); + g_option_context_free (context); + + if (error != NULL) { + g_printerr ("%s\n", error->message); + exit (EXIT_FAILURE); + } + e_gdbus_templates_init_main_thread (); server = e_user_prompter_server_new (); @@ -46,6 +65,11 @@ main (gint argc, g_print ("Prompter is up and running...\n"); + /* This SHOULD keep the server's use + * count from ever reaching zero. */ + if (opt_keep_running) + e_dbus_server_hold (server); + e_dbus_server_run (server, TRUE); g_object_unref (server); -- 2.7.4