[evolution-data-server] evolution-user-prompter: Add a --keep-running option.



commit 7768355b2478df9c72025752fd82262523285a18
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Feb 22 23:58:36 2013 -0500

    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 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 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 <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);


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