[gnome-software: 12/18] gs-shell: Connect category switching to the sidebar
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software: 12/18] gs-shell: Connect category switching to the sidebar
- Date: Thu, 15 Apr 2021 12:54:06 +0000 (UTC)
commit 7c3c1de250b5c151c42af95c41d789c93e3f870a
Author: Philip Withnall <pwithnall endlessos org>
Date: Wed Mar 17 16:10:50 2021 +0000
gs-shell: Connect category switching to the sidebar
This allows categories to be viewed by clicking on them in the sidebar.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
Helps: #1111
src/gs-shell.c | 13 +++++++++++++
src/gs-shell.ui | 1 +
2 files changed, 14 insertions(+)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 1f1ab0a08..acc179b37 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -528,6 +528,16 @@ stack_notify_visible_child_cb (GObject *object,
}
}
+static void
+sidebar_category_selected_cb (GsSidebar *sidebar,
+ GsCategory *category,
+ gpointer user_data)
+{
+ GsShell *shell = GS_SHELL (user_data);
+
+ gs_shell_show_category (shell, category);
+}
+
static void
main_leaflet_notify_folded_cb (GObject *obj,
GParamSpec *pspec,
@@ -2087,6 +2097,8 @@ gs_shell_setup (GsShell *shell, GsPluginLoader *plugin_loader, GCancellable *can
shell->settings = g_settings_new ("org.gnome.software");
+ gs_sidebar_set_category_manager (shell->sidebar, gs_plugin_loader_get_category_manager
(plugin_loader));
+
/* get UI */
accel_group = gtk_accel_group_new ();
gtk_window_add_accel_group (GTK_WINDOW (shell), accel_group);
@@ -2389,6 +2401,7 @@ gs_shell_class_init (GsShellClass *klass)
gtk_widget_class_bind_template_callback (widget_class, stack_notify_visible_child_cb);
gtk_widget_class_bind_template_callback (widget_class, initial_refresh_done);
gtk_widget_class_bind_template_callback (widget_class, main_leaflet_notify_folded_cb);
+ gtk_widget_class_bind_template_callback (widget_class, sidebar_category_selected_cb);
}
static void
diff --git a/src/gs-shell.ui b/src/gs-shell.ui
index 3c42469ce..e69303fea 100644
--- a/src/gs-shell.ui
+++ b/src/gs-shell.ui
@@ -360,6 +360,7 @@
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="stack">stack_main</property>
+ <signal name="category-selected" handler="sidebar_category_selected_cb"/>
<child internal-child="accessible">
<object class="AtkObject">
<property name="accessible-description" translatable="yes">Navigation
sidebar</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]