[evolution-data-server] ESourceCollection: Add 'allow-sources-rename' property



commit 5db22df739ddd85161881c26276278ace0aac545
Author: Milan Crha <mcrha redhat com>
Date:   Wed Jan 8 17:21:51 2020 +0100

    ESourceCollection: Add 'allow-sources-rename' property
    
    Related to https://gitlab.gnome.org/GNOME/evolution-ews/issues/67

 src/libedataserver/e-source-collection.c | 72 ++++++++++++++++++++++++++++++++
 src/libedataserver/e-source-collection.h |  5 +++
 2 files changed, 77 insertions(+)
---
diff --git a/src/libedataserver/e-source-collection.c b/src/libedataserver/e-source-collection.c
index f9888e6be..a1292987f 100644
--- a/src/libedataserver/e-source-collection.c
+++ b/src/libedataserver/e-source-collection.c
@@ -50,6 +50,7 @@ struct _ESourceCollectionPrivate {
        gboolean calendar_enabled;
        gboolean contacts_enabled;
        gboolean mail_enabled;
+       gboolean allow_sources_rename;
        gchar *calendar_url;
        gchar *contacts_url;
 };
@@ -60,6 +61,7 @@ enum {
        PROP_CONTACTS_ENABLED,
        PROP_IDENTITY,
        PROP_MAIL_ENABLED,
+       PROP_ALLOW_SOURCES_RENAME,
        PROP_CALENDAR_URL,
        PROP_CONTACTS_URL
 };
@@ -100,6 +102,12 @@ source_collection_set_property (GObject *object,
                                g_value_get_boolean (value));
                        return;
 
+               case PROP_ALLOW_SOURCES_RENAME:
+                       e_source_collection_set_allow_sources_rename (
+                               E_SOURCE_COLLECTION (object),
+                               g_value_get_boolean (value));
+                       return;
+
                case PROP_CALENDAR_URL:
                        e_source_collection_set_calendar_url (
                                E_SOURCE_COLLECTION (object),
@@ -151,6 +159,13 @@ source_collection_get_property (GObject *object,
                                E_SOURCE_COLLECTION (object)));
                        return;
 
+               case PROP_ALLOW_SOURCES_RENAME:
+                       g_value_set_boolean (
+                               value,
+                               e_source_collection_get_allow_sources_rename (
+                               E_SOURCE_COLLECTION (object)));
+                       return;
+
                case PROP_CALENDAR_URL:
                        g_value_take_string (
                                value,
@@ -255,6 +270,20 @@ e_source_collection_class_init (ESourceCollectionClass *class)
                        G_PARAM_STATIC_STRINGS |
                        E_SOURCE_PARAM_SETTING));
 
+       g_object_class_install_property (
+               object_class,
+               PROP_ALLOW_SOURCES_RENAME,
+               g_param_spec_boolean (
+                       "allow-sources-rename",
+                       "Allow Sources Rename",
+                       "Set to TRUE when the collection source allows user rename the child sources",
+                       FALSE,
+                       G_PARAM_READWRITE |
+                       G_PARAM_CONSTRUCT |
+                       G_PARAM_EXPLICIT_NOTIFY |
+                       G_PARAM_STATIC_STRINGS |
+                       E_SOURCE_PARAM_SETTING));
+
        g_object_class_install_property (
                object_class,
                PROP_CALENDAR_URL,
@@ -701,3 +730,46 @@ e_source_collection_set_contacts_url (ESourceCollection *extension,
 
        g_object_notify (G_OBJECT (extension), "contacts-url");
 }
+
+/**
+ * e_source_collection_get_allow_sources_rename:
+ * @extension: an #ESourceCollection
+ *
+ * Returns whether the collection backend allows a user to rename child
+ * sources. It is meant mainly for GUI. The default is %FALSE.
+ *
+ * Returns: whether the collection backend allows a user to rename child sources
+ *
+ * Since: 3.36
+ **/
+gboolean
+e_source_collection_get_allow_sources_rename (ESourceCollection *extension)
+{
+       g_return_val_if_fail (E_IS_SOURCE_COLLECTION (extension), FALSE);
+
+       return extension->priv->allow_sources_rename;
+}
+
+/**
+ * e_source_collection_set_allow_sources_rename:
+ * @extension: an #ESourceCollection
+ * @allow_sources_rename: whether mail sources should be enabled
+ *
+ * Sets whether the collection backend allows a user to rename child
+ * sources. It is meant mainly for GUI. The default is %FALSE.
+ *
+ * Since: 3.36
+ **/
+void
+e_source_collection_set_allow_sources_rename (ESourceCollection *extension,
+                                             gboolean allow_sources_rename)
+{
+       g_return_if_fail (E_IS_SOURCE_COLLECTION (extension));
+
+       if (extension->priv->allow_sources_rename == allow_sources_rename)
+               return;
+
+       extension->priv->allow_sources_rename = allow_sources_rename;
+
+       g_object_notify (G_OBJECT (extension), "allow-sources-rename");
+}
diff --git a/src/libedataserver/e-source-collection.h b/src/libedataserver/e-source-collection.h
index 70d12b369..dbaeaa56c 100644
--- a/src/libedataserver/e-source-collection.h
+++ b/src/libedataserver/e-source-collection.h
@@ -114,6 +114,11 @@ gchar *            e_source_collection_dup_contacts_url
 void           e_source_collection_set_contacts_url
                                                (ESourceCollection *extension,
                                                 const gchar *contacts_url);
+gboolean       e_source_collection_get_allow_sources_rename
+                                               (ESourceCollection *extension);
+void           e_source_collection_set_allow_sources_rename
+                                               (ESourceCollection *extension,
+                                                gboolean allow_sources_rename);
 
 G_END_DECLS
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]