Skip to content

Commit

Permalink
MainWindow: misc menu fixes (#1842)
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit authored May 9, 2022
1 parent 65f6ea6 commit 0e21002
Showing 1 changed file with 14 additions and 20 deletions.
34 changes: 14 additions & 20 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,6 @@ public class AppCenter.MainWindow : Hdy.ApplicationWindow {
description = _("System updates and unpaid apps will not update automatically")
};

automatic_updates_button.notify["active"].connect (() => {
if (automatic_updates_button.active) {
AppCenterCore.Client.get_default ().update_cache.begin (true);
} else {
AppCenterCore.Client.get_default ().cancel_updates (true);
}
});

var refresh_accellabel = new Granite.AccelLabel.from_action_name (
_("Check for Updates"),
"app.refresh"
Expand All @@ -237,24 +229,18 @@ public class AppCenter.MainWindow : Hdy.ApplicationWindow {
refresh_menuitem.get_child ().destroy ();
refresh_menuitem.add (refresh_accellabel);

var menu_popover_grid = new Gtk.Grid () {
column_spacing = 6,
var menu_popover_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0) {
margin_bottom = 6,
margin_top = 6,
orientation = Gtk.Orientation.VERTICAL,
row_spacing = 6
margin_top = 6
};

menu_popover_grid.add (automatic_updates_button);
menu_popover_grid.add (refresh_menuitem);

menu_popover_grid.show_all ();
menu_popover_box.add (automatic_updates_button);
menu_popover_box.add (refresh_menuitem);
menu_popover_box.show_all ();

var menu_popover = new Gtk.Popover (null);
menu_popover.add (menu_popover_grid);
menu_popover.add (menu_popover_box);

var menu_button = new Gtk.MenuButton () {
can_focus = false,
image = new Gtk.Image.from_icon_name ("open-menu", Gtk.IconSize.LARGE_TOOLBAR),
popover = menu_popover,
tooltip_text = _("Settings"),
Expand Down Expand Up @@ -319,6 +305,14 @@ public class AppCenter.MainWindow : Hdy.ApplicationWindow {

stack.notify["visible-child"].connect (on_view_mode_changed);

automatic_updates_button.notify["active"].connect (() => {
if (automatic_updates_button.active) {
AppCenterCore.Client.get_default ().update_cache.begin (true, AppCenterCore.Client.CacheUpdateType.FLATPAK);
} else {
AppCenterCore.Client.get_default ().cancel_updates (true);
}
});

eventbox_badge.button_release_event.connect (() => {
stack.visible_child = installed_view;
});
Expand Down

0 comments on commit 0e21002

Please sign in to comment.