[gnome-control-center] panel-list: Select panel iff non-folded when search is cancelled



commit 2dbc195d773a88d937e12a78168b24ec970a16e7
Author: Mohammed Sadiq <sadiq sadiqpk org>
Date:   Mon Nov 25 17:43:41 2019 +0530

    panel-list: Select panel iff non-folded when search is cancelled
    
    If the window is folded, the previous panel shouldn’t be shown when search
    is cancelled. The panel selection list should be shown instead.

 shell/cc-panel-list.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/shell/cc-panel-list.c b/shell/cc-panel-list.c
index 64bf7ae89..185b16d0a 100644
--- a/shell/cc-panel-list.c
+++ b/shell/cc-panel-list.c
@@ -222,10 +222,20 @@ update_search (CcPanelList *self)
       if (self->view == CC_PANEL_LIST_MAIN)
         switch_to_view (self, CC_PANEL_LIST_SEARCH);
     }
-  else
+  else if (self->view == CC_PANEL_LIST_SEARCH)
     {
-      if (self->view == CC_PANEL_LIST_SEARCH)
-        switch_to_view (self, self->previous_view);
+      GtkSelectionMode selection_mode;
+      gboolean autoselect_panel;
+
+      /* Autoselect panel only if allowed.  Autoselect of
+       * panel isn’t allowed if the panel is folded */
+      autoselect_panel = self->autoselect_panel;
+      selection_mode = gtk_list_box_get_selection_mode (GTK_LIST_BOX (self->main_listbox));
+      self->autoselect_panel = selection_mode != GTK_SELECTION_NONE;
+
+      switch_to_view (self, self->previous_view);
+
+      self->autoselect_panel = autoselect_panel;
     }
 
   gtk_list_box_invalidate_filter (GTK_LIST_BOX (self->search_listbox));


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