[gnome-software: 3/10] shell: Stop using the sidebar




commit 072a14a0582f6d15809177a52cd35878774ee260
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Mon Jun 21 08:38:42 2021 +0200

    shell: Stop using the sidebar
    
    Fixes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1278

 src/gs-shell.c  |  35 ------------
 src/gs-shell.ui | 161 +-------------------------------------------------------
 2 files changed, 2 insertions(+), 194 deletions(-)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index dda4acec4..264313932 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -33,7 +33,6 @@
 #include "gs-extras-page.h"
 #include "gs-repos-dialog.h"
 #include "gs-prefs-dialog.h"
-#include "gs-sidebar.h"
 #include "gs-update-dialog.h"
 #include "gs-update-monitor.h"
 #include "gs-utils.h"
@@ -74,13 +73,11 @@ struct _GsShell
        GPtrArray               *modal_dialogs;
        gchar                   *events_info_uri;
        HdyDeck                 *main_deck;
-       HdyLeaflet              *main_leaflet;
        HdyDeck                 *details_deck;
        GtkStack                *stack_loading;
        GtkStack                *stack_main;
        GtkStack                *stack_sub;
        GsPage                  *page;
-       GsSidebar               *sidebar;
 
        GBinding                *main_header_title_binding;
        GBinding                *application_details_header_binding;
@@ -92,12 +89,10 @@ struct _GsShell
        gulong                   scheduler_invalidated_handler;
 #endif  /* HAVE_MOGWAI */
 
-       GtkWidget               *sidebar_box;
        GtkWidget               *main_header;
        GtkWidget               *details_header;
        GtkWidget               *metered_updates_bar;
        GtkWidget               *search_button_main;
-       GtkWidget               *search_button_sidebar;
        GtkWidget               *entry_search;
        GtkWidget               *search_bar;
        GtkWidget               *button_back;
@@ -473,13 +468,11 @@ update_header_widgets (GsShell *shell)
 
        /* only show the search button in overview and search pages */
        g_signal_handlers_block_by_func (shell->search_button_main, search_button_clicked_cb, shell);
-       g_signal_handlers_block_by_func (shell->search_button_sidebar, search_button_clicked_cb, shell);
 
        /* hide unless we're going to search */
        hdy_search_bar_set_search_mode (HDY_SEARCH_BAR (shell->search_bar),
                                        mode == GS_SHELL_MODE_SEARCH);
 
-       g_signal_handlers_unblock_by_func (shell->search_button_sidebar, search_button_clicked_cb, shell);
        g_signal_handlers_unblock_by_func (shell->search_button_main, search_button_clicked_cb, shell);
 }
 
@@ -581,26 +574,6 @@ 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,
-                               gpointer    user_data)
-{
-       GsShell *shell = GS_SHELL (user_data);
-
-       update_header_widgets (shell);
-}
-
 void
 gs_shell_change_mode (GsShell *shell,
                      GsShellMode mode,
@@ -2182,8 +2155,6 @@ 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);
@@ -2538,19 +2509,15 @@ gs_shell_class_init (GsShellClass *klass)
 
        gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/Software/gs-shell.ui");
 
-       gtk_widget_class_bind_template_child (widget_class, GsShell, sidebar_box);
        gtk_widget_class_bind_template_child (widget_class, GsShell, main_header);
        gtk_widget_class_bind_template_child (widget_class, GsShell, main_deck);
-       gtk_widget_class_bind_template_child (widget_class, GsShell, main_leaflet);
        gtk_widget_class_bind_template_child (widget_class, GsShell, details_header);
        gtk_widget_class_bind_template_child (widget_class, GsShell, details_deck);
        gtk_widget_class_bind_template_child (widget_class, GsShell, stack_loading);
        gtk_widget_class_bind_template_child (widget_class, GsShell, stack_main);
        gtk_widget_class_bind_template_child (widget_class, GsShell, stack_sub);
-       gtk_widget_class_bind_template_child (widget_class, GsShell, sidebar);
        gtk_widget_class_bind_template_child (widget_class, GsShell, metered_updates_bar);
        gtk_widget_class_bind_template_child (widget_class, GsShell, search_button_main);
-       gtk_widget_class_bind_template_child (widget_class, GsShell, search_button_sidebar);
        gtk_widget_class_bind_template_child (widget_class, GsShell, entry_search);
        gtk_widget_class_bind_template_child (widget_class, GsShell, search_bar);
        gtk_widget_class_bind_template_child (widget_class, GsShell, button_back);
@@ -2598,8 +2565,6 @@ gs_shell_class_init (GsShellClass *klass)
        gtk_widget_class_bind_template_callback (widget_class, gs_shell_metered_updates_bar_response_cb);
        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 b9833bd49..55a42028d 100644
--- a/src/gs-shell.ui
+++ b/src/gs-shell.ui
@@ -51,82 +51,6 @@
                         <property name="mode-transition-duration" bind-source="main_leaflet" 
bind-property="mode-transition-duration" bind-flags="bidirectional|sync-create"/>
                         <property name="child-transition-duration" bind-source="main_leaflet" 
bind-property="child-transition-duration" bind-flags="bidirectional|sync-create"/>
                         <property name="transition-type" bind-source="main_leaflet" 
bind-property="transition-type" bind-flags="bidirectional|sync-create"/>
-                        <child>
-                          <object class="HdyHeaderBar" id="sidebar_header">
-                            <property name="visible">True</property>
-                            <property name="can-focus">False</property>
-                            <property name="show-close-button">True</property>
-                            <property name="title" translatable="yes">Software</property>
-                            <child>
-                              <object class="GtkToggleButton" id="search_button_sidebar">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="active" bind-source="search_bar" 
bind-property="search-mode-enabled" bind-flags="sync-create|bidirectional" />
-                                <signal name="clicked" handler="search_button_clicked_cb"/>
-                                <child internal-child="accessible">
-                                  <object class="AtkObject">
-                                    <property name="accessible-name" translatable="yes">Search</property>
-                                  </object>
-                                </child>
-                                <style>
-                                  <class name="image-button"/>
-                                </style>
-                                <child>
-                                  <object class="GtkImage">
-                                    <property name="visible">True</property>
-                                    <property name="icon_name">edit-find-symbolic</property>
-                                    <property name="icon_size">1</property>
-                                  </object>
-                                </child>
-                                <style>
-                                  <class name="image-button"/>
-                                </style>
-                              </object>
-                              <packing>
-                                <property name="pack-type">start</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkMenuButton" id="menu_button_sidebar">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="sensitive">True</property>
-                                <property name="menu_model">primary_menu</property>
-                                <child internal-child="accessible">
-                                  <object class="AtkObject">
-                                    <property name="accessible-name" translatable="yes">Primary 
Menu</property>
-                                  </object>
-                                </child>
-                                <child>
-                                  <object class="GtkImage">
-                                    <property name="visible">True</property>
-                                    <property name="icon_name">open-menu-symbolic</property>
-                                    <property name="icon_size">1</property>
-                                  </object>
-                                </child>
-                                <style>
-                                  <class name="image-button"/>
-                                </style>
-                              </object>
-                              <packing>
-                                <property name="pack-type">end</property>
-                              </packing>
-                            </child>
-                          </object>
-                        </child>
-                        <child>
-                          <object class="GtkSeparator" id="header_separator">
-                            <property name="visible" bind-source="sidebar_header" bind-property="visible" 
bind-flags="sync-create" />
-                            <property name="can-focus">False</property>
-                            <property name="orientation">vertical</property>
-                            <style>
-                              <class name="sidebar"/>
-                            </style>
-                          </object>
-                          <packing>
-                            <property name="navigatable">False</property>
-                          </packing>
-                        </child>
                         <child>
                           <object class="HdyHeaderBar" id="main_header">
                             <property name="visible">True</property>
@@ -193,7 +117,7 @@
                               <object class="HdyViewSwitcherTitle" id="title_switcher">
                                 <property name="visible">True</property>
                                 <property name="stack">stack_main</property>
-                                <property name="title" bind-source="GsShell" bind-property="title" 
bind-flags="sync-create"/>
+                                <property name="title" bind-source="main_header" bind-property="title" 
bind-flags="sync-create"/>
                               </object>
                             </child>
                           </object>
@@ -410,60 +334,6 @@
                                 <property name="visible-child">main_box</property>
                                 <property name="transition-type">slide</property>
                                 <signal name="notify::folded" handler="main_leaflet_notify_folded_cb"/>
-
-                                <child>
-                                  <object class="GtkBox" id="sidebar_box">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="hexpand">False</property>
-                                    <property name="orientation">vertical</property>
-                                    <child>
-                                      <object class="GtkScrolledWindow">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">True</property>
-                                        <property name="vexpand">True</property>
-                                        <property name="width-request">200</property>
-                                        <property name="hscrollbar_policy">never</property>
-                                        <style>
-                                          <class name="view"/>
-                                        </style>
-                                        <child>
-                                          <object class="GsSidebar" id="sidebar">
-                                            <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>
-                                              </object>
-                                            </child>
-                                          </object>
-                                        </child>
-                                      </object>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">True</property>
-                                        <property name="position">1</property>
-                                      </packing>
-                                    </child>
-                                  </object>
-                                </child>
-
-                                <child>
-                                  <object class="GtkSeparator" id="panel_separator">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="orientation">vertical</property>
-                                    <style>
-                                      <class name="sidebar"/>
-                                    </style>
-                                  </object>
-                                  <packing>
-                                    <property name="navigatable">False</property>
-                                  </packing>
-                                </child>
-
                                 <child>
                                   <object class="GtkBox" id="main_box">
                                     <property name="visible">True</property>
@@ -562,7 +432,7 @@
                                         <child>
                                           <object class="GsInstalledPage" id="installed_page">
                                             <property name="visible">True</property>
-                                            <property name="is-narrow" bind-source="main_leaflet" 
bind-property="folded" bind-flags="sync-create"/>
+                                            <property name="is-narrow" bind-source="GsShell" 
bind-property="is-narrow" bind-flags="sync-create"/>
                                           </object>
                                           <packing>
                                             <property name="name">installed</property>
@@ -719,31 +589,4 @@
       <headerbar name="main_header"/>
     </headerbars>
   </object>
-
-  <!-- Synchronize width of sidebar widgets -->
-  <object class="GtkSizeGroup">
-    <property name="mode">horizontal</property>
-    <widgets>
-      <widget name="sidebar_header"/>
-      <widget name="sidebar_box"/>
-    </widgets>
-  </object>
-
-  <!-- Synchronize separators -->
-  <object class="GtkSizeGroup">
-    <property name="mode">horizontal</property>
-    <widgets>
-      <widget name="header_separator"/>
-      <widget name="panel_separator"/>
-    </widgets>
-  </object>
-
-  <!-- Synchronize width of main widgets -->
-  <object class="GtkSizeGroup">
-    <property name="mode">horizontal</property>
-    <widgets>
-      <widget name="main_header"/>
-      <widget name="main_box"/>
-    </widgets>
-  </object>
 </interface>


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