[evolution-data-server] Add --wait-for-client factory processes command line option
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Add --wait-for-client factory processes command line option
- Date: Fri, 2 Dec 2011 13:12:26 +0000 (UTC)
commit 60dbefb2716daccede36bf80090a5f0cf203f676
Author: Milan Crha <mcrha redhat com>
Date: Fri Dec 2 14:08:13 2011 +0100
Add --wait-for-client factory processes command line option
This is much better than --keep-running for cases when debugger
needs to be sure that everything opened is freed (the factory
closes itself automatically), while client's run takes longer
than 10 seconds (which is easy when running both/all under
valgrind, especially with evolution as the client).
libebackend/e-dbus-server.c | 9 +++++++--
libebackend/e-dbus-server.h | 3 ++-
.../evolution-addressbook-factory.c | 6 ++++--
.../evolution-calendar-factory.c | 6 ++++--
4 files changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/libebackend/e-dbus-server.c b/libebackend/e-dbus-server.c
index 194ecbf..3b648fd 100644
--- a/libebackend/e-dbus-server.c
+++ b/libebackend/e-dbus-server.c
@@ -46,6 +46,7 @@ struct _EDBusServerPrivate {
guint inactivity_timeout_id;
guint use_count;
+ gboolean wait_for_client;
};
enum {
@@ -128,7 +129,7 @@ static void
dbus_server_bus_acquired (EDBusServer *server,
GDBusConnection *connection)
{
- if (server->priv->use_count == 0)
+ if (server->priv->use_count == 0 && !server->priv->wait_for_client)
server->priv->inactivity_timeout_id =
g_timeout_add_seconds (
INACTIVITY_TIMEOUT, (GSourceFunc)
@@ -212,6 +213,7 @@ e_dbus_server_init (EDBusServer *server)
{
server->priv = E_DBUS_SERVER_GET_PRIVATE (server);
server->priv->main_loop = g_main_loop_new (NULL, FALSE);
+ server->priv->wait_for_client = FALSE;
#ifdef G_OS_UNIX
server->priv->terminate_id = g_unix_signal_add (
@@ -220,7 +222,8 @@ e_dbus_server_init (EDBusServer *server)
}
void
-e_dbus_server_run (EDBusServer *server)
+e_dbus_server_run (EDBusServer *server,
+ gboolean wait_for_client)
{
EDBusServerClass *class;
@@ -229,6 +232,8 @@ e_dbus_server_run (EDBusServer *server)
if (g_main_loop_is_running (server->priv->main_loop))
return;
+ server->priv->wait_for_client = wait_for_client;
+
/* Try to acquire the well-known bus name. */
class = E_DBUS_SERVER_GET_CLASS (server);
diff --git a/libebackend/e-dbus-server.h b/libebackend/e-dbus-server.h
index 19af800..b909d8f 100644
--- a/libebackend/e-dbus-server.h
+++ b/libebackend/e-dbus-server.h
@@ -77,7 +77,8 @@ struct _EDBusServerClass {
};
GType e_dbus_server_get_type (void) G_GNUC_CONST;
-void e_dbus_server_run (EDBusServer *server);
+void e_dbus_server_run (EDBusServer *server,
+ gboolean wait_for_client);
void e_dbus_server_quit (EDBusServer *server);
void e_dbus_server_hold (EDBusServer *server);
void e_dbus_server_release (EDBusServer *server);
diff --git a/services/evolution-addressbook-factory/evolution-addressbook-factory.c b/services/evolution-addressbook-factory/evolution-addressbook-factory.c
index 4577e8c..477a31e 100644
--- a/services/evolution-addressbook-factory/evolution-addressbook-factory.c
+++ b/services/evolution-addressbook-factory/evolution-addressbook-factory.c
@@ -38,13 +38,15 @@
#include <libedata-book/e-data-book-factory.h>
-/* Keep running after the last client is closed. */
static gboolean opt_keep_running = FALSE;
+static gboolean opt_wait_for_client = 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 },
+ { "wait-for-client", 'w', 0, G_OPTION_ARG_NONE, &opt_wait_for_client,
+ N_("Wait running until at least one client is connected"), NULL },
{ NULL }
};
@@ -128,7 +130,7 @@ main (gint argc,
if (opt_keep_running)
e_dbus_server_hold (server);
- e_dbus_server_run (server);
+ e_dbus_server_run (server, opt_wait_for_client);
g_object_unref (server);
diff --git a/services/evolution-calendar-factory/evolution-calendar-factory.c b/services/evolution-calendar-factory/evolution-calendar-factory.c
index 40bf10b..86648bc 100644
--- a/services/evolution-calendar-factory/evolution-calendar-factory.c
+++ b/services/evolution-calendar-factory/evolution-calendar-factory.c
@@ -42,13 +42,15 @@
#include <libedata-cal/e-data-cal-factory.h>
-/* Keeps running after the last client is closed. */
static gboolean opt_keep_running = FALSE;
+static gboolean opt_wait_for_client = 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 },
+ { "wait-for-client", 'w', 0, G_OPTION_ARG_NONE, &opt_wait_for_client,
+ N_("Wait running until at least one client is connected"), NULL },
{ NULL }
};
@@ -136,7 +138,7 @@ main (gint argc,
if (opt_keep_running)
e_dbus_server_hold (server);
- e_dbus_server_run (server);
+ e_dbus_server_run (server, opt_wait_for_client);
g_object_unref (server);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]