[gnome-software] Don't hardcode going back to the overview page when closing search



commit b3b3ebfbeb6c1e145298f81ecc5c9a83f33bc116
Author: Kalev Lember <klember redhat com>
Date:   Thu Dec 1 12:43:46 2016 +0100

    Don't hardcode going back to the overview page when closing search
    
    Instead, rely on the back button stack to go back to the page where we
    were before the search.

 src/gs-shell.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 208e190..6b0f998 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -480,10 +480,11 @@ gs_shell_plugin_events_more_info_cb (GtkWidget *widget, GsShell *shell)
 }
 
 static void
-gs_shell_back_button_cb (GtkWidget *widget, GsShell *shell)
+gs_shell_go_back (GsShell *shell)
 {
        GsShellPrivate *priv = gs_shell_get_instance_private (shell);
        BackEntry *entry;
+       GtkWidget *widget;
 
        g_return_if_fail (!g_queue_is_empty (priv->back_entry_stack));
 
@@ -534,6 +535,12 @@ gs_shell_back_button_cb (GtkWidget *widget, GsShell *shell)
 }
 
 static void
+gs_shell_back_button_cb (GtkWidget *widget, GsShell *shell)
+{
+       gs_shell_go_back (shell);
+}
+
+static void
 initial_overview_load_done (GsShellOverview *shell_overview, gpointer data)
 {
        GsShell *shell = data;
@@ -608,9 +615,10 @@ search_button_clicked_cb (GtkToggleButton *toggle_button, GsShell *shell)
        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);
+       /* go back when exiting the search view */
+       if (priv->mode == GS_SHELL_MODE_SEARCH &&
+           !gtk_toggle_button_get_active (toggle_button))
+               gs_shell_go_back (shell);
 }
 
 static void


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