summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2021-07-15 18:14:43 +0200
committerMilan Crha <mcrha@redhat.com>2021-07-15 18:17:24 +0200
commit6fd699545c8aeb4909c2637f447749b26bf3bd85 (patch)
tree0f3d36783fe8f589e17a9786b19eb937ad1cd3b7
parent04222ec2e723a3ebee91357c0991f080aa494a50 (diff)
downloadevolution-6fd699545c8aeb4909c2637f447749b26bf3bd85.tar.gz
EShellSearchbar: Update actions only if the shell view is active
This could be seen in the Calendar view, when opening the application with a saved search, the search was active, but the Clear Search button was not sensitive when the task/memo view was without the search. The reason is the actions are shared between all the views.
-rw-r--r--src/shell/e-shell-searchbar.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/shell/e-shell-searchbar.c b/src/shell/e-shell-searchbar.c
index df98e8dde3..2b7e6ac4c3 100644
--- a/src/shell/e-shell-searchbar.c
+++ b/src/shell/e-shell-searchbar.c
@@ -216,7 +216,6 @@ shell_searchbar_update_search_widgets (EShellSearchbar *searchbar)
{
EShellView *shell_view;
EShellWindow *shell_window;
- GtkAction *action;
GtkWidget *widget;
const gchar *search_text;
gboolean sensitive;
@@ -257,11 +256,15 @@ shell_searchbar_update_search_widgets (EShellSearchbar *searchbar)
gtk_widget_set_name (widget, "searchbar_searchentry");
}
- action = E_SHELL_WINDOW_ACTION_SEARCH_CLEAR (shell_window);
- gtk_action_set_sensitive (action, sensitive);
+ if (e_shell_view_is_active (shell_view)) {
+ GtkAction *action;
- action = E_SHELL_WINDOW_ACTION_SEARCH_SAVE (shell_window);
- gtk_action_set_visible (action, sensitive && e_shell_view_get_search_rule (shell_view) != NULL);
+ action = E_SHELL_WINDOW_ACTION_SEARCH_CLEAR (shell_window);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action = E_SHELL_WINDOW_ACTION_SEARCH_SAVE (shell_window);
+ gtk_action_set_visible (action, sensitive && e_shell_view_get_search_rule (shell_view) != NULL);
+ }
}
static void
@@ -356,7 +359,6 @@ shell_searchbar_entry_changed_cb (EShellSearchbar *searchbar)
{
EShellView *shell_view;
EShellWindow *shell_window;
- GtkAction *action;
const gchar *search_text;
gboolean sensitive;
@@ -366,8 +368,12 @@ shell_searchbar_entry_changed_cb (EShellSearchbar *searchbar)
search_text = e_shell_searchbar_get_search_text (searchbar);
sensitive = (search_text != NULL && *search_text != '\0');
- action = E_SHELL_WINDOW_ACTION_SEARCH_QUICK (shell_window);
- gtk_action_set_sensitive (action, sensitive);
+ if (e_shell_view_is_active (shell_view)) {
+ GtkAction *action;
+
+ action = E_SHELL_WINDOW_ACTION_SEARCH_QUICK (shell_window);
+ gtk_action_set_sensitive (action, sensitive);
+ }
}
static void