From c230d0adc8722e1116b4f77803be359330a6fa4b Mon Sep 17 00:00:00 2001 From: heliguy Date: Mon, 19 Feb 2024 03:39:16 -0500 Subject: [PATCH] Consolodate header buttons Remove the Refresh List button in favor of it in the main menu drop down Remove the newly added Install Menu button in favor of it in the manin menu drop down --- data/ui/window.blp | 45 +++++++++++++++++---------------------------- src/main.py | 2 +- src/window.py | 4 ---- 3 files changed, 18 insertions(+), 33 deletions(-) diff --git a/data/ui/window.blp b/data/ui/window.blp index bdfd1fb..2f1ce00 100644 --- a/data/ui/window.blp +++ b/data/ui/window.blp @@ -6,12 +6,6 @@ template $WarehouseWindow: Adw.ApplicationWindow { Adw.ToolbarView main_toolbar_view { [top] HeaderBar header_bar { - [start] - Button refresh_button { - icon-name: "view-refresh-symbolic"; - tooltip-text: _("Refresh List"); - } - [start] ToggleButton search_button { icon-name: "system-search-symbolic"; @@ -36,13 +30,6 @@ template $WarehouseWindow: Adw.ApplicationWindow { icon-name: "selection-mode-symbolic"; tooltip-text: _("Toggle Selection Mode"); } - - [end] - MenuButton install_button { - icon-name: "plus-large-symbolic"; - tooltip-text: _("Install New Flatpak"); - menu-model: install_menu; - } } [top] @@ -257,7 +244,23 @@ menu primary_menu { label: _("Manage Remotes…"); action: "app.show-remotes-window"; } + } + section { + item { + label: _("Install From File…"); + action: "app.install-from-file"; + } + item { + label: _("Install From The Web…"); + action: "app.open-search-install"; + } + } + section { + item { + label: _("Refresh List"); + action: "app.refresh-list"; + } item { label: _("_Keyboard Shortcuts"); action: "win.show-help-overlay"; @@ -287,18 +290,4 @@ menu copy_menu { action: "win.copy-refs"; } } -} - -menu install_menu { - section { - item { - label: _("Install From File…"); - action: "app.install-from-file"; - } - - item { - label: _("Install From The Web…"); - action: "app.open-search-install"; - } - } -} +} \ No newline at end of file diff --git a/src/main.py b/src/main.py index 4a4e926..5a124e3 100644 --- a/src/main.py +++ b/src/main.py @@ -105,7 +105,7 @@ class WarehouseApplication(Adw.Application): for rem in my_utils.get_host_remotes(): if my_utils.get_install_type(rem[7]) != "disabled": total += 1 - if total < 2: + if total < 1: self.lookup_action(f"open-search-install").set_enabled(False) def open_search_install(self, widget, _): diff --git a/src/window.py b/src/window.py index 78f1797..dbf3ba4 100644 --- a/src/window.py +++ b/src/window.py @@ -43,7 +43,6 @@ class WarehouseWindow(Adw.ApplicationWindow): search_button = Gtk.Template.Child() search_bar = Gtk.Template.Child() toast_overlay = Gtk.Template.Child() - refresh_button = Gtk.Template.Child() no_flatpaks = Gtk.Template.Child() no_results = Gtk.Template.Child() main_stack = Gtk.Template.Child() @@ -67,7 +66,6 @@ class WarehouseWindow(Adw.ApplicationWindow): no_matches = Gtk.Template.Child() reset_filters_button = Gtk.Template.Child() uninstalling_status = Gtk.Template.Child() - install_button = Gtk.Template.Child() main_progress_bar = Gtk.ProgressBar(visible=False, can_target=False) main_progress_bar.add_css_class("osd") @@ -95,7 +93,6 @@ class WarehouseWindow(Adw.ApplicationWindow): def uninstall_buttons_enable(self, should_enable): if self.currently_uninstalling: return - self.refresh_button.set_sensitive(should_enable) if not should_enable: self.batch_uninstall_button.set_sensitive(False) @@ -872,7 +869,6 @@ class WarehouseWindow(Adw.ApplicationWindow): self.search_entry.connect("search-changed", self.on_invalidate) self.search_bar.connect_entry(self.search_entry) self.search_bar.connect("notify", self.on_change) - self.refresh_button.connect("clicked", self.refresh_list_of_flatpaks, True) self.filter_button.connect("clicked", lambda *_: FilterWindow(self)) self.batch_mode_button.connect("toggled", self.batch_mode_handler) self.batch_clean_button.connect("clicked", self.batch_clean_handler)