aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2012-06-15 20:06:49 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-06-15 20:22:52 +0800
commit503b211d3d598316fc1040775f7a6669c32a47b1 (patch)
tree6c4b13bda71d75e9d328e148865c649ca5e4f00f
parent98e0083ce905266a649e2e583307eab9e5969dea (diff)
downloadgsoc2013-evolution-503b211d3d598316fc1040775f7a6669c32a47b1.tar.gz
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.
-rw-r--r--widgets/misc/e-source-config.c48
-rw-r--r--widgets/misc/e-source-config.h2
2 files changed, 50 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)
{
diff --git a/widgets/misc/e-source-config.h b/widgets/misc/e-source-config.h
index da996b69e8..1a5b549924 100644
--- a/widgets/misc/e-source-config.h
+++ b/widgets/misc/e-source-config.h
@@ -83,6 +83,8 @@ const gchar * e_source_config_get_backend_extension_name
gboolean e_source_config_check_complete (ESourceConfig *config);
ESource * e_source_config_get_original_source
(ESourceConfig *config);
+ESource * e_source_config_get_collection_source
+ (ESourceConfig *config);
ESourceRegistry *
e_source_config_get_registry (ESourceConfig *config);
void e_source_config_resize_window (ESourceConfig *config);