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
This commit is contained in:
parent
ef2e301c08
commit
ce818c0ae5
@ -176,18 +176,54 @@ static void
|
|||||||
calendar_sources_init (CalendarSources *sources)
|
calendar_sources_init (CalendarSources *sources)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
GDBusConnection *session_bus;
|
||||||
|
GVariant *result;
|
||||||
|
|
||||||
sources->priv = CALENDAR_SOURCES_GET_PRIVATE (sources);
|
sources->priv = CALENDAR_SOURCES_GET_PRIVATE (sources);
|
||||||
|
|
||||||
/* XXX Not sure what to do if this fails.
|
/* WORKAROUND: the hardcoded timeout for e_source_registry_new_sync()
|
||||||
* Should this class implement GInitable or pass the
|
(and other library calls that eventually call g_dbus_proxy_new[_sync]())
|
||||||
* registry in as a G_PARAM_CONSTRUCT_ONLY property? */
|
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);
|
sources->priv->registry = e_source_registry_new_sync (NULL, &error);
|
||||||
|
}
|
||||||
|
|
||||||
if (error != NULL)
|
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,
|
sources->priv->source_added_id = g_signal_connect (sources->priv->registry,
|
||||||
"source-added",
|
"source-added",
|
||||||
G_CALLBACK (calendar_sources_registry_source_changed_cb),
|
G_CALLBACK (calendar_sources_registry_source_changed_cb),
|
||||||
|
Loading…
Reference in New Issue
Block a user