[evolution-data-server/gnome-3-16] Bug 751108 - Source registry Reload() method call broken
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/gnome-3-16] Bug 751108 - Source registry Reload() method call broken
- Date: Wed, 17 Jun 2015 14:23:17 +0000 (UTC)
commit 11764532116db5c3be891f9ec0f0010fdaf63a4c
Author: Milan Crha <mcrha redhat com>
Date: Wed Jun 17 16:21:02 2015 +0200
Bug 751108 - Source registry Reload() method call broken
libebackend/e-data-factory.c | 75 ++++++++++++++++++++++++++++---
libebackend/e-data-factory.h | 2 +
libebackend/e-source-registry-server.c | 2 +-
3 files changed, 70 insertions(+), 9 deletions(-)
---
diff --git a/libebackend/e-data-factory.c b/libebackend/e-data-factory.c
index 72b5f0b..e072fb4 100644
--- a/libebackend/e-data-factory.c
+++ b/libebackend/e-data-factory.c
@@ -81,11 +81,14 @@ struct _EDataFactoryPrivate {
GCond spawn_subprocess_cond;
GMutex spawn_subprocess_lock;
DataFactorySpawnSubprocessStates spawn_subprocess_state;
+
+ gboolean reload_supported;
};
enum {
PROP_0,
- PROP_REGISTRY
+ PROP_REGISTRY,
+ PROP_RELOAD_SUPPORTED
};
/* Forward Declarations */
@@ -794,24 +797,34 @@ data_factory_quit_server (EDBusServer *server,
GDBusInterfaceSkeleton *skeleton_interface;
EDataFactoryClass *class;
- class = E_DATA_FACTORY_GET_CLASS (E_DATA_FACTORY (server));
-
- skeleton_interface = class->get_dbus_interface_skeleton (server);
- g_dbus_interface_skeleton_unexport (skeleton_interface);
-
- /* This factory does not support reloading, so stop the signal
+ /* If the factory does not support reloading, stop the signal
* emission and return without chaining up to prevent quitting. */
- if (exit_code == E_DBUS_SERVER_EXIT_RELOAD) {
+ if (exit_code == E_DBUS_SERVER_EXIT_RELOAD &&
+ !e_data_factory_get_reload_supported (E_DATA_FACTORY (server))) {
g_signal_stop_emission_by_name (server, "quit-server");
return;
}
+ class = E_DATA_FACTORY_GET_CLASS (E_DATA_FACTORY (server));
+
+ skeleton_interface = class->get_dbus_interface_skeleton (server);
+ g_dbus_interface_skeleton_unexport (skeleton_interface);
+
/* Chain up to parent's quit_server() method. */
E_DBUS_SERVER_CLASS (e_data_factory_parent_class)->
quit_server (server, exit_code);
}
static void
+e_data_factory_set_reload_supported (EDataFactory *data_factory,
+ gboolean is_supported)
+{
+ g_return_if_fail (E_IS_DATA_FACTORY (data_factory));
+
+ data_factory->priv->reload_supported = is_supported;
+}
+
+static void
e_data_factory_get_property (GObject *object,
guint property_id,
GValue *value,
@@ -824,6 +837,30 @@ e_data_factory_get_property (GObject *object,
e_data_factory_get_registry (
E_DATA_FACTORY (object)));
return;
+
+ case PROP_RELOAD_SUPPORTED:
+ g_value_set_boolean (
+ value,
+ e_data_factory_get_reload_supported (
+ E_DATA_FACTORY (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+e_data_factory_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_RELOAD_SUPPORTED:
+ e_data_factory_set_reload_supported (
+ E_DATA_FACTORY (object),
+ g_value_get_boolean (value));
+ return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -949,6 +986,7 @@ e_data_factory_class_init (EDataFactoryClass *class)
object_class = G_OBJECT_CLASS (class);
object_class->get_property = e_data_factory_get_property;
+ object_class->set_property = e_data_factory_set_property;
object_class->dispose = data_factory_dispose;
object_class->finalize = data_factory_finalize;
object_class->constructed = data_factory_constructed;
@@ -970,6 +1008,18 @@ e_data_factory_class_init (EDataFactoryClass *class)
E_TYPE_SOURCE_REGISTRY,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_RELOAD_SUPPORTED,
+ g_param_spec_boolean (
+ "reload-supported",
+ "Reload Supported",
+ "Whether the data factory supports Reload",
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
}
static void
@@ -1014,6 +1064,7 @@ e_data_factory_init (EDataFactory *data_factory)
(GDestroyNotify) watched_names_value_free);
data_factory->priv->spawn_subprocess_state = DATA_FACTORY_SPAWN_SUBPROCESS_NONE;
+ data_factory->priv->reload_supported = FALSE;
}
/**
@@ -1333,3 +1384,11 @@ e_data_factory_spawn_subprocess_backend (EDataFactory *data_factory,
g_thread_unref (thread);
}
+
+gboolean
+e_data_factory_get_reload_supported (EDataFactory *data_factory)
+{
+ g_return_val_if_fail (E_IS_DATA_FACTORY (data_factory), FALSE);
+
+ return data_factory->priv->reload_supported;
+}
diff --git a/libebackend/e-data-factory.h b/libebackend/e-data-factory.h
index 08faaa5..4a8bd0c 100644
--- a/libebackend/e-data-factory.h
+++ b/libebackend/e-data-factory.h
@@ -102,6 +102,8 @@ void e_data_factory_spawn_subprocess_backend
const gchar *uid,
const gchar *extension_name,
const gchar *subprocess_path);
+gboolean e_data_factory_get_reload_supported
+ (EDataFactory *data_factory);
G_END_DECLS
diff --git a/libebackend/e-source-registry-server.c b/libebackend/e-source-registry-server.c
index 8a678f7..85c0ca6 100644
--- a/libebackend/e-source-registry-server.c
+++ b/libebackend/e-source-registry-server.c
@@ -978,7 +978,7 @@ e_source_registry_server_init (ESourceRegistryServer *server)
EDBusServer *
e_source_registry_server_new (void)
{
- return g_object_new (E_TYPE_SOURCE_REGISTRY_SERVER, NULL);
+ return g_object_new (E_TYPE_SOURCE_REGISTRY_SERVER, "reload-supported", TRUE, NULL);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]