[evolution-couchdb] Added missing e-d-s <= 2.27.x function



commit 3c706c62ae2771effb2ef72262064dfc06963879
Author: Rodrigo Moya <rodrigo gnome-db org>
Date:   Sat Jul 4 13:26:30 2009 +0200

    Added missing e-d-s <= 2.27.x function

 plugins/couchdb-contacts-source.c |   41 +++++++++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+), 0 deletions(-)
---
diff --git a/plugins/couchdb-contacts-source.c b/plugins/couchdb-contacts-source.c
index 32efee3..7afdb8a 100644
--- a/plugins/couchdb-contacts-source.c
+++ b/plugins/couchdb-contacts-source.c
@@ -37,6 +37,47 @@
 
 #define COUCHDB_BASE_URI "couchdb://"
 
+#if EDS_MINOR_VERSION < 27
+/* Copied from e-d-s 2.27.x branch, since it doesn't exist in 2.26.x */
+
+ESourceGroup *
+e_source_list_ensure_group (ESourceList *list, const gchar *name, const gchar *base_uri, gboolean ret_it)
+{
+        ESourceGroup *group;
+
+        g_return_val_if_fail (E_IS_SOURCE_LIST (list), NULL);
+        g_return_val_if_fail (name != NULL, NULL);
+        g_return_val_if_fail (base_uri != NULL, NULL);
+
+        group = e_source_list_peek_group_by_base_uri (list, base_uri);
+        if (group) {
+                e_source_group_set_name (group, name);
+                if (ret_it)
+                        g_object_ref (group);
+                else
+                        group = NULL;
+        } else {
+                group = e_source_group_new (name, base_uri);
+
+                if (!e_source_list_add_group (list, group, -1)) {
+                        g_warning ("Could not add source group %s with base uri %s to a source list", name, base_uri);
+                        g_object_unref (group);
+                        group = NULL;
+                } else {
+                        /* save it now */
+                        e_source_list_sync (list, NULL);
+
+                        if (!ret_it) {
+                                g_object_unref (group);
+                                group = NULL;
+                        }
+                }
+        }
+
+        return group;
+}
+#endif
+
 static void
 ensure_couchdb_contacts_source_group (void)
 {



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