[gnome-shell/wip/sass] calendar-server: activate evolution-source-registry manually at startup
- From: Jakub Steiner <jimmac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/sass] calendar-server: activate evolution-source-registry manually at startup
- Date: Thu, 8 Jan 2015 10:07:25 +0000 (UTC)
commit 4fb649bf1c66a659815886b33d5310c5ab741108
Author: Giovanni Campagna <scampa giovanni gmail com>
Date: Wed Dec 10 16:32:17 2014 -0800
calendar-server: activate evolution-source-registry manually at startup
g_dbus_proxy_new() (and library calls that wrap it) has an hardcoded
timeout of 25 seconds, which is insufficient for starting up e-s-r
in certain setups. Avoid a timeout error by starting the service
manually with a longer timeout before hand.
Also demote the error to a warning + exit failure instead of
a crash, to avoid triggering abrt reports.
https://bugzilla.gnome.org/show_bug.cgi?id=735308
src/calendar-server/calendar-sources.c | 46 ++++++++++++++++++++++++++++---
1 files changed, 41 insertions(+), 5 deletions(-)
---
diff --git a/src/calendar-server/calendar-sources.c b/src/calendar-server/calendar-sources.c
index 219fc45..804fb9c 100644
--- a/src/calendar-server/calendar-sources.c
+++ b/src/calendar-server/calendar-sources.c
@@ -176,18 +176,54 @@ static void
calendar_sources_init (CalendarSources *sources)
{
GError *error = NULL;
+ GDBusConnection *session_bus;
+ GVariant *result;
sources->priv = CALENDAR_SOURCES_GET_PRIVATE (sources);
- /* XXX Not sure what to do if this fails.
- * Should this class implement GInitable or pass the
- * registry in as a G_PARAM_CONSTRUCT_ONLY property? */
- sources->priv->registry = e_source_registry_new_sync (NULL, &error);
+ /* WORKAROUND: the hardcoded timeout for e_source_registry_new_sync()
+ (and other library calls that eventually call g_dbus_proxy_new[_sync]())
+ is 25 seconds. This has been shown to be too small for
+ evolution-source-registry in certain cases (slow disk, concurrent IO,
+ many configured sources), so we first ensure that the service
+ starts with a manual call and a higher timeout.
+
+ HACK: every time the DBus API is bumped in e-d-s we need
+ to update this!
+ */
+ session_bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
+ if (session_bus == NULL)
+ {
+ g_error ("Failed to connect to the session bus: %s", error->message);
+ }
+
+ result = g_dbus_connection_call_sync (session_bus, "org.freedesktop.DBus",
+ "/", "org.freedesktop.DBus",
+ "StartServiceByName",
+ g_variant_new ("(su)",
+ "org.gnome.evolution.dataserver.Sources3",
+ 0),
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ 60 * 1000,
+ NULL, &error);
+ if (result != NULL)
+ {
+ g_variant_unref (result);
+ sources->priv->registry = e_source_registry_new_sync (NULL, &error);
+ }
+
if (error != NULL)
{
- g_error ("%s: %s", G_STRFUNC, error->message);
+ /* Any error is fatal, but we don't want to crash gnome-shell-calendar-server
+ because of e-d-s problems. So just exit here.
+ */
+ g_warning ("Failed to start evolution-source-registry: %s", error->message);
+ exit(EXIT_FAILURE);
}
+ g_object_unref (session_bus);
+
sources->priv->source_added_id = g_signal_connect (sources->priv->registry,
"source-added",
G_CALLBACK
(calendar_sources_registry_source_changed_cb),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]