[evolution] I#2059 - Group Manager: Auto-deselect sources in to be hidden groups
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] I#2059 - Group Manager: Auto-deselect sources in to be hidden groups
- Date: Mon, 3 Oct 2022 08:33:55 +0000 (UTC)
commit 8aa57f934c9f21920ffbb58093eb3f33f32c36e0
Author: Milan Crha <mcrha redhat com>
Date: Mon Oct 3 10:32:36 2022 +0200
I#2059 - Group Manager: Auto-deselect sources in to be hidden groups
Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/2059
src/e-util/e-source-selector.c | 50 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
---
diff --git a/src/e-util/e-source-selector.c b/src/e-util/e-source-selector.c
index efc72fdf20..75a5be6593 100644
--- a/src/e-util/e-source-selector.c
+++ b/src/e-util/e-source-selector.c
@@ -3462,6 +3462,55 @@ create_tree (ESourceSelector *selector,
return scrolled;
}
+static void
+deselect_sources_in_hidden_groups (ESourceSelector *selector)
+{
+ ESourceRegistry *registry;
+ const gchar *extension_name;
+ GNode *root;
+
+ /* No group to hide */
+ if (!g_hash_table_size (selector->priv->hidden_groups))
+ return;
+
+ /* Address books are not selectable */
+ if (g_strcmp0 (e_source_selector_get_extension_name (selector), E_SOURCE_EXTENSION_ADDRESS_BOOK) == 0)
+ return;
+
+ extension_name = e_source_selector_get_extension_name (selector);
+ registry = e_source_selector_get_registry (selector);
+ root = e_source_registry_build_display_tree (registry, extension_name);
+
+ if (root) {
+ GNode *node;
+
+ for (node = g_node_first_child (root); node; node = g_node_next_sibling (node)) {
+ ESource *source;
+
+ source = node->data;
+
+ if (source && g_hash_table_contains (selector->priv->hidden_groups, e_source_get_uid
(source))) {
+ GNode *child_node;
+
+ for (child_node = g_node_first_child (node); child_node; child_node =
g_node_next_sibling (child_node)) {
+ ESource *child = child_node->data;
+
+ if (child && e_source_has_extension (child, extension_name)) {
+ gpointer extension = e_source_get_extension (child,
extension_name);
+
+ if (E_IS_SOURCE_SELECTABLE (extension) &&
+ e_source_selectable_get_selected (extension)) {
+ e_source_selector_unselect_source (selector, child);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ e_source_registry_free_display_tree (root);
+}
+
static void
process_move_button (GtkButton *button,
GtkTreeView *tree,
@@ -3710,6 +3759,7 @@ e_source_selector_manage_groups (ESourceSelector *selector)
selector->priv->groups_order = g_slist_reverse (selector->priv->groups_order);
+ deselect_sources_in_hidden_groups (selector);
source_selector_build_model (selector);
confirmed = TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]