diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-06-15 20:06:49 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-06-15 20:22:52 +0800 |
commit | 503b211d3d598316fc1040775f7a6669c32a47b1 (patch) | |
tree | 6c4b13bda71d75e9d328e148865c649ca5e4f00f /widgets/misc/e-source-config.c | |
parent | 98e0083ce905266a649e2e583307eab9e5969dea (diff) | |
download | gsoc2013-evolution-503b211d3d598316fc1040775f7a6669c32a47b1.tar gsoc2013-evolution-503b211d3d598316fc1040775f7a6669c32a47b1.tar.gz gsoc2013-evolution-503b211d3d598316fc1040775f7a6669c32a47b1.tar.bz2 gsoc2013-evolution-503b211d3d598316fc1040775f7a6669c32a47b1.tar.lz gsoc2013-evolution-503b211d3d598316fc1040775f7a6669c32a47b1.tar.xz gsoc2013-evolution-503b211d3d598316fc1040775f7a6669c32a47b1.tar.zst gsoc2013-evolution-503b211d3d598316fc1040775f7a6669c32a47b1.zip |
ESourceConfig: Add "collection-source" property.
This is a read-only property, set when editing an existing data source
which is a collection member. We'll use this to lock down certain UI
elements.
Diffstat (limited to 'widgets/misc/e-source-config.c')
-rw-r--r-- | widgets/misc/e-source-config.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/widgets/misc/e-source-config.c b/widgets/misc/e-source-config.c index 45a3d2d816..25e7923a4d 100644 --- a/widgets/misc/e-source-config.c +++ b/widgets/misc/e-source-config.c @@ -36,6 +36,7 @@ typedef struct _Candidate Candidate; struct _ESourceConfigPrivate { ESource *original_source; + ESource *collection_source; ESourceRegistry *registry; GHashTable *backends; @@ -58,6 +59,7 @@ struct _Candidate { enum { PROP_0, + PROP_COLLECTION_SOURCE, PROP_COMPLETE, PROP_ORIGINAL_SOURCE, PROP_REGISTRY @@ -368,6 +370,13 @@ source_config_get_property (GObject *object, GParamSpec *pspec) { switch (property_id) { + case PROP_COLLECTION_SOURCE: + g_value_set_object ( + value, + e_source_config_get_collection_source ( + E_SOURCE_CONFIG (object))); + return; + case PROP_COMPLETE: g_value_set_boolean ( value, @@ -405,6 +414,11 @@ source_config_dispose (GObject *object) priv->original_source = NULL; } + if (priv->collection_source != NULL) { + g_object_unref (priv->collection_source); + priv->collection_source = NULL; + } + if (priv->registry != NULL) { g_object_unref (priv->registry); priv->registry = NULL; @@ -460,11 +474,25 @@ static void source_config_constructed (GObject *object) { ESourceConfig *config; + ESourceRegistry *registry; ESource *original_source; + ESource *collection_source = NULL; config = E_SOURCE_CONFIG (object); + registry = e_source_config_get_registry (config); original_source = e_source_config_get_original_source (config); + /* If we have an original source, see if it's part + * of a collection and note the collection source. */ + if (original_source != NULL) { + const gchar *extension_name; + + extension_name = E_SOURCE_EXTENSION_COLLECTION; + collection_source = e_source_registry_find_extension ( + registry, original_source, extension_name); + config->priv->collection_source = collection_source; + } + if (original_source != NULL) e_source_config_insert_widget ( config, NULL, _("Type:"), @@ -636,6 +664,18 @@ e_source_config_class_init (ESourceConfigClass *class) g_object_class_install_property ( object_class, + PROP_COLLECTION_SOURCE, + g_param_spec_object ( + "collection-source", + "Collection Source", + "The collection ESource to which " + "the ESource being edited belongs", + E_TYPE_SOURCE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property ( + object_class, PROP_COMPLETE, g_param_spec_boolean ( "complete", @@ -904,6 +944,14 @@ e_source_config_get_original_source (ESourceConfig *config) return config->priv->original_source; } +ESource * +e_source_config_get_collection_source (ESourceConfig *config) +{ + g_return_val_if_fail (E_IS_SOURCE_CONFIG (config), NULL); + + return config->priv->collection_source; +} + ESourceRegistry * e_source_config_get_registry (ESourceConfig *config) { |