[gnome-software/gnome-3-22] Avoid triggering unwanted mode switches with search state changes
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/gnome-3-22] Avoid triggering unwanted mode switches with search state changes
- Date: Thu, 1 Dec 2016 14:34:51 +0000 (UTC)
commit 297972aff25eb37d2c192c8753c6011da0f31ca3
Author: Kalev Lember <klember redhat com>
Date: Thu Dec 1 12:17:09 2016 +0100
Avoid triggering unwanted mode switches with search state changes
Avoid a feedback loop that led to first switching to the overview page
and then to the details page every time when clicking on a search
result.
https://bugzilla.gnome.org/show_bug.cgi?id=775373
src/gs-shell.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 4242a63..1de320a 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -83,6 +83,7 @@ typedef struct
GQueue *back_entry_stack;
GPtrArray *modal_dialogs;
gulong search_changed_id;
+ gboolean in_mode_change;
} GsShellPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (GsShell, gs_shell, G_TYPE_OBJECT)
@@ -254,6 +255,7 @@ gs_shell_change_mode (GsShell *shell,
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "header_selection_menu_button"));
gtk_widget_hide (widget);
+ priv->in_mode_change = TRUE;
/* only show the search button in overview and search pages */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "search_button"));
gtk_widget_set_visible (widget, mode == GS_SHELL_MODE_OVERVIEW ||
@@ -262,6 +264,7 @@ gs_shell_change_mode (GsShell *shell,
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "search_bar"));
gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (widget),
mode == GS_SHELL_MODE_SEARCH);
+ priv->in_mode_change = FALSE;
context = gtk_widget_get_style_context (GTK_WIDGET (gtk_builder_get_object (priv->builder,
"header")));
gtk_style_context_remove_class (context, "selection-mode");
@@ -341,7 +344,9 @@ gs_shell_change_mode (GsShell *shell,
mode != GS_SHELL_MODE_SEARCH &&
!g_queue_is_empty (priv->back_entry_stack));
+ priv->in_mode_change = TRUE;
gs_page_switch_to (new_page, scroll_up);
+ priv->in_mode_change = FALSE;
/* update header bar widgets */
widget = gs_page_get_header_start_widget (new_page);
@@ -544,6 +549,9 @@ search_button_clicked_cb (GtkToggleButton *toggle_button, GsShell *shell)
gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (search_bar),
gtk_toggle_button_get_active (toggle_button));
+ if (priv->in_mode_change)
+ return;
+
/* switch back to overview */
if (!gtk_toggle_button_get_active (toggle_button))
gs_shell_change_mode (shell, GS_SHELL_MODE_OVERVIEW, NULL, TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]