[evolution/gnome-3-28] I#78 - Search scope in Mail view not restored properly



commit 2485e37869e45e640efcac67e9b4c0614870a6fe
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jul 24 09:11:38 2018 +0200

    I#78 - Search scope in Mail view not restored properly
    
    Closes https://gitlab.gnome.org/GNOME/evolution/issues/78

 src/shell/e-shell-searchbar.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)
---
diff --git a/src/shell/e-shell-searchbar.c b/src/shell/e-shell-searchbar.c
index 7fba4c0b01..db9c12bc49 100644
--- a/src/shell/e-shell-searchbar.c
+++ b/src/shell/e-shell-searchbar.c
@@ -1026,15 +1026,6 @@ e_shell_searchbar_init (EShellSearchbar *searchbar)
        gtk_box_pack_start (box, widget, FALSE, FALSE, 0);
        searchbar->priv->scope_combo_box = widget;
        gtk_widget_show (widget);
-
-       /* Use G_CONNECT_AFTER here so the EActionComboBox has a
-        * chance to update its radio actions before we go sifting
-        * through the radio group for the current action. */
-       g_signal_connect_data (
-               widget, "changed",
-               G_CALLBACK (shell_searchbar_save_search_scope),
-               searchbar, (GClosureNotify) NULL,
-               G_CONNECT_AFTER | G_CONNECT_SWAPPED);
 }
 
 /**
@@ -1257,6 +1248,20 @@ e_shell_searchbar_set_scope_visible (EShellSearchbar *searchbar,
 
        searchbar->priv->scope_visible = scope_visible;
 
+       if (searchbar->priv->scope_visible) {
+               /* Use G_CONNECT_AFTER here so the EActionComboBox has a
+                * chance to update its radio actions before we go sifting
+                * through the radio group for the current action. */
+               g_signal_connect_data (
+                       searchbar->priv->scope_combo_box, "changed",
+                       G_CALLBACK (shell_searchbar_save_search_scope),
+                       searchbar, (GClosureNotify) NULL,
+                       G_CONNECT_AFTER | G_CONNECT_SWAPPED);
+       } else {
+               g_signal_handlers_disconnect_by_func (searchbar->priv->scope_combo_box,
+                       G_CALLBACK (shell_searchbar_save_search_scope), searchbar);
+       }
+
        g_object_notify (G_OBJECT (searchbar), "scope-visible");
 }
 


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