diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-02-22 23:58:36 -0500 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-02-22 23:58:36 -0500 |
commit | 7768355b2478df9c72025752fd82262523285a18 (patch) | |
tree | f29239e5efa0bbde9e107ddbb8c99b9f391475d8 /services | |
parent | 0aa03bf56c924c25a13d5394bda3273f17aeaa8f (diff) | |
download | evolution-data-server-7768355b2478df9c72025752fd82262523285a18.tar.gz |
evolution-user-prompter: Add a --keep-running option.
This thing keeps quitting on me when run from the command-line.
Diffstat (limited to 'services')
-rw-r--r-- | services/evolution-user-prompter/evolution-user-prompter.c | 30 |
1 files 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 64c64b86c..682be170d 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 <config.h> -#endif /* HAVE_CONFIG_H */ - #include <locale.h> #include <libintl.h> +#include <glib/gi18n.h> #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); |