[gnome-control-center/gbsneto/search-applications: 3/6] applications: Select the first row at startup



commit 0784dd7b53739e72394ecc7b8be680b0599d67ee
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Fri Mar 29 19:50:07 2019 -0300

    applications: Select the first row at startup
    
    That way we are not presented the empty view initially.

 panels/applications/cc-applications-panel.c | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/panels/applications/cc-applications-panel.c b/panels/applications/cc-applications-panel.c
index 5a4593d3b..a68c20f55 100644
--- a/panels/applications/cc-applications-panel.c
+++ b/panels/applications/cc-applications-panel.c
@@ -1656,12 +1656,16 @@ cc_applications_panel_class_init (CcApplicationsPanelClass *klass)
   gtk_widget_class_bind_template_callback (widget_class, storage_row_activated_cb);
   gtk_widget_class_bind_template_callback (widget_class, open_software_cb);
   gtk_widget_class_bind_template_callback (widget_class, handler_reset_cb);
+  gtk_widget_class_bind_template_callback (widget_class, on_sidebar_search_entry_activated_cb);
+  gtk_widget_class_bind_template_callback (widget_class, on_sidebar_search_entry_search_changed_cb);
+  gtk_widget_class_bind_template_callback (widget_class, on_sidebar_search_entry_search_stopped_cb);
 }
 
 static void
 cc_applications_panel_init (CcApplicationsPanel *self)
 {
   g_autoptr(GtkStyleProvider) provider = NULL;
+  GtkListBoxRow *row;
 
   g_resources_register (cc_applications_get_resource ());
 
@@ -1731,4 +1735,9 @@ cc_applications_panel_init (CcApplicationsPanel *self)
 
   self->globs = parse_globs ();
   self->search_providers = parse_search_providers ();
+
+  /* Select the first row */
+  row = gtk_list_box_get_row_at_index (self->sidebar_listbox, 0);
+  gtk_list_box_select_row (self->sidebar_listbox, row);
+  g_signal_emit_by_name (row, "activate");
 }


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