[evolution-data-server] Skip sources with disabled parents from completion lookup
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Skip sources with disabled parents from completion lookup
- Date: Wed, 5 Sep 2012 13:48:49 +0000 (UTC)
commit 52f95951fe4082a4d0b60c1d3265d8fa4df1b00d
Author: Milan Crha <mcrha redhat com>
Date: Wed Sep 5 15:47:40 2012 +0200
Skip sources with disabled parents from completion lookup
libedataserverui/e-name-selector-entry.c | 37 +++++++++++++++++++++++++++++-
libedataserverui/e-name-selector.c | 37 +++++++++++++++++++++++++++++-
2 files changed, 72 insertions(+), 2 deletions(-)
---
diff --git a/libedataserverui/e-name-selector-entry.c b/libedataserverui/e-name-selector-entry.c
index 6c1cd87..7d56f52 100644
--- a/libedataserverui/e-name-selector-entry.c
+++ b/libedataserverui/e-name-selector-entry.c
@@ -2169,6 +2169,41 @@ ensure_type_ahead_complete_on_timeout (ENameSelectorEntry *name_selector_entry)
type_ahead_complete_on_timeout_cb, name_selector_entry);
}
+static gboolean
+is_source_enabled_with_parents (ESourceRegistry *registry,
+ ESource *source)
+{
+ ESource *parent;
+ const gchar *parent_uid;
+
+ g_return_val_if_fail (registry != NULL, FALSE);
+ g_return_val_if_fail (source != NULL, FALSE);
+
+ if (!e_source_get_enabled (source))
+ return FALSE;
+
+ parent = g_object_ref (source);
+ while (parent_uid = e_source_get_parent (parent), parent_uid) {
+ ESource *next = e_source_registry_ref_source (registry, parent_uid);
+
+ if (!next)
+ break;
+
+ g_object_unref (parent);
+
+ if (!e_source_get_enabled (next)) {
+ g_object_unref (next);
+ return FALSE;
+ }
+
+ parent = next;
+ }
+
+ g_object_unref (parent);
+
+ return TRUE;
+}
+
static void
setup_contact_store (ENameSelectorEntry *name_selector_entry)
{
@@ -2275,7 +2310,7 @@ setup_default_contact_store (ENameSelectorEntry *name_selector_entry)
extension = e_source_get_extension (source, extension_name);
/* Skip disabled address books. */
- if (!e_source_get_enabled (source))
+ if (!is_source_enabled_with_parents (registry, source))
continue;
/* Skip non-completion address books. */
diff --git a/libedataserverui/e-name-selector.c b/libedataserverui/e-name-selector.c
index 87f7f8f..3f25151 100644
--- a/libedataserverui/e-name-selector.c
+++ b/libedataserverui/e-name-selector.c
@@ -69,6 +69,41 @@ enum {
G_DEFINE_TYPE (ENameSelector, e_name_selector, G_TYPE_OBJECT)
+static gboolean
+is_source_enabled_with_parents (ESourceRegistry *registry,
+ ESource *source)
+{
+ ESource *parent;
+ const gchar *parent_uid;
+
+ g_return_val_if_fail (registry != NULL, FALSE);
+ g_return_val_if_fail (source != NULL, FALSE);
+
+ if (!e_source_get_enabled (source))
+ return FALSE;
+
+ parent = g_object_ref (source);
+ while (parent_uid = e_source_get_parent (parent), parent_uid) {
+ ESource *next = e_source_registry_ref_source (registry, parent_uid);
+
+ if (!next)
+ break;
+
+ g_object_unref (parent);
+
+ if (!e_source_get_enabled (next)) {
+ g_object_unref (next);
+ return FALSE;
+ }
+
+ parent = next;
+ }
+
+ g_object_unref (parent);
+
+ return TRUE;
+}
+
static void
reset_pointer_cb (gpointer data,
GObject *where_was)
@@ -178,7 +213,7 @@ e_name_selector_load_books (ENameSelector *name_selector)
extension = e_source_get_extension (source, extension_name);
/* Skip disabled address books. */
- if (!e_source_get_enabled (source))
+ if (!is_source_enabled_with_parents (registry, source))
continue;
/* Only load address books with autocomplete enabled,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]