From e7fd71447b10632c944dccc866f312342f3249fb Mon Sep 17 00:00:00 2001 From: Danielle Fore Date: Tue, 23 Jan 2024 12:45:46 -0800 Subject: [PATCH 1/2] CategoryView: absorb headerbar --- src/Application.vala | 38 +------------------------------------- src/CategoryView.vala | 12 +++++++----- 2 files changed, 8 insertions(+), 42 deletions(-) diff --git a/src/Application.vala b/src/Application.vala index 72fad7b0..d3b3da24 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -21,15 +21,10 @@ namespace Switchboard { public class SwitchboardApp : Gtk.Application { - private string all_settings_label = N_("All Settings"); - private GLib.HashTable plug_widgets; - private Gtk.Button navigation_button; private Adw.Leaflet leaflet; - private Gtk.HeaderBar headerbar; private Gtk.Window main_window; private Switchboard.CategoryView category_view; - private Gtk.Label title_label; private static bool opened_directly = false; private static string? link = null; @@ -135,22 +130,6 @@ namespace Switchboard { plug_widgets = new GLib.HashTable (null, null); - navigation_button = new Gtk.Button.with_label (_(all_settings_label)); - navigation_button.action_name = "app.back"; - navigation_button.set_tooltip_markup ( - Granite.markup_accel_tooltip (get_accels_for_action (navigation_button.action_name)) - ); - navigation_button.get_style_context ().add_class ("back-button"); - - title_label = new Gtk.Label (""); - title_label.add_css_class (Granite.STYLE_CLASS_TITLE_LABEL); - - headerbar = new Gtk.HeaderBar () { - show_title_buttons = true, - title_widget = title_label - }; - headerbar.pack_start (navigation_button); - category_view = new Switchboard.CategoryView (plug_to_open); category_view.load_default_plugs.begin (); @@ -166,13 +145,11 @@ namespace Switchboard { child = leaflet, icon_name = application_id, title = _("System Settings"), - titlebar = headerbar + titlebar = new Gtk.Grid () { visible = false } }; add_window (main_window); main_window.present (); - navigation_button.hide (); - /* * This is very finicky. Bind size after present else set_titlebar gives us bad sizes * Set maximize after height/width else window is min size on unmaximize @@ -188,8 +165,6 @@ namespace Switchboard { settings.bind ("window-maximized", main_window, "maximized", SettingsBindFlags.SET); - main_window.bind_property ("title", title_label, "label"); - shutdown.connect (() => { if (plug_widgets[leaflet.visible_child] != null && plug_widgets[leaflet.visible_child] is Switchboard.Plug) { plug_widgets[leaflet.visible_child].hidden (); @@ -219,8 +194,6 @@ namespace Switchboard { var visible_widget = leaflet.visible_child; if (visible_widget is Switchboard.CategoryView) { main_window.title = _("System Settings"); - - navigation_button.hide (); } else { var plug = plug_widgets[visible_widget]; if (plug != null) { @@ -229,15 +202,6 @@ namespace Switchboard { } else { critical ("Visible child is not CategoryView nor is associated with a Plug."); } - - - if (previous_child != null && previous_child is Switchboard.Plug) { - navigation_button.label = previous_child.display_name; - } else { - navigation_button.label = _(all_settings_label); - } - - navigation_button.show (); } } } diff --git a/src/CategoryView.vala b/src/CategoryView.vala index decdc391..e167e0ed 100644 --- a/src/CategoryView.vala +++ b/src/CategoryView.vala @@ -40,10 +40,6 @@ namespace Switchboard { var search_box_eventcontrollerkey = new Gtk.EventControllerKey (); search_box = new Gtk.SearchEntry () { - margin_top = 12, - margin_end = 12, - margin_bottom = 12, - margin_start = 12, placeholder_text = _("Search Settings") }; search_box.add_controller (search_box_eventcontrollerkey); @@ -99,8 +95,14 @@ namespace Switchboard { search_stack.add_child (clamp); search_stack.add_child (searchview); + var headerbar = new Gtk.HeaderBar () { + show_title_buttons = true, + title_widget = search_clamp + }; + headerbar.add_css_class (Granite.STYLE_CLASS_FLAT); + orientation = VERTICAL; - append (search_clamp); + append (headerbar); append (search_stack); if (Switchboard.PlugsManager.get_default ().has_plugs () == false) { From 6858d184152c543135b3a4dd45094ed1fa4c5b7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Thu, 21 Mar 2024 11:38:13 -0700 Subject: [PATCH 2/2] Fix undershoot --- data/styles/CategoryView.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/styles/CategoryView.scss b/data/styles/CategoryView.scss index 586faae6..37366b17 100644 --- a/data/styles/CategoryView.scss +++ b/data/styles/CategoryView.scss @@ -1,5 +1,5 @@ category-view { - > scrolledwindow { + box > scrolledwindow { overshoot.top { background: linear-gradient(