Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a manual refresh button to update all caches #1791

Merged
merged 30 commits into from
May 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
590926c
MainWindow: Add button to pull updates
meisenzahl Dec 12, 2021
bc927b9
MainWindow: Use revealer
meisenzahl Dec 12, 2021
57d4a71
Application: Add refresh action
meisenzahl Dec 12, 2021
228fefe
MainWindow: Use refresh action
meisenzahl Dec 12, 2021
579cb72
Merge branch 'master' into add-a-manual-refresh-button-to-update-all-…
meisenzahl Dec 17, 2021
9dabd9d
Merge branch 'master' into add-a-manual-refresh-button-to-update-all-…
meisenzahl Dec 19, 2021
768203d
Merge branch 'master' into add-a-manual-refresh-button-to-update-all-…
meisenzahl Dec 29, 2021
206dd82
Merge branch 'master' into add-a-manual-refresh-button-to-update-all-…
meisenzahl Jan 2, 2022
cec45e0
Merge branch 'master' into add-a-manual-refresh-button-to-update-all-…
cassidyjames Jan 3, 2022
cd4b552
Merge branch 'master' into add-a-manual-refresh-button-to-update-all-…
meisenzahl Jan 5, 2022
1977f2d
Merge branch 'master' into add-a-manual-refresh-button-to-update-all-…
meisenzahl Jan 6, 2022
9fcf2ac
Merge branch 'master' into add-a-manual-refresh-button-to-update-all-…
cassidyjames Jan 6, 2022
641d20e
Merge branch 'master' into add-a-manual-refresh-button-to-update-all-…
meisenzahl Jan 7, 2022
9b86cbb
MainWindow: Add refresh menu item
meisenzahl Jan 7, 2022
a23efc0
MainWindow: Bind refresh menu item sensitive to working
meisenzahl Jan 7, 2022
769b055
MainWindow: Remove refresh button
meisenzahl Jan 7, 2022
7ded609
Merge branch 'master' into add-a-manual-refresh-button-to-update-all-…
meisenzahl Jan 7, 2022
24a7942
Merge branch 'master' into add-a-manual-refresh-button-to-update-all-…
meisenzahl Jan 9, 2022
58d5a11
Merge branch 'master' into add-a-manual-refresh-button-to-update-all-…
cassidyjames Jan 10, 2022
fe074ca
Update src/MainWindow.vala
meisenzahl Jan 10, 2022
a199350
Merge branch 'master' into add-a-manual-refresh-button-to-update-all-…
danirabbit Jan 11, 2022
f9e5e72
MainWindow: Disable refresh action if working
meisenzahl Jan 11, 2022
03fc6f7
Merge branch 'master' into add-a-manual-refresh-button-to-update-all-…
cassidyjames Jan 11, 2022
8d0b4aa
Merge branch 'master' into add-a-manual-refresh-button-to-update-all-…
meisenzahl Jan 12, 2022
76f847e
Merge branch 'master' into add-a-manual-refresh-button-to-update-all-…
meisenzahl Jan 15, 2022
d2bb3e4
Merge branch 'master' into add-a-manual-refresh-button-to-update-all-…
meisenzahl Jan 16, 2022
b550fad
Merge branch 'master' into add-a-manual-refresh-button-to-update-all-…
meisenzahl Jan 17, 2022
8bcd797
Merge branch 'master' into add-a-manual-refresh-button-to-update-all-…
meisenzahl Feb 6, 2022
2fda29e
Merge branch 'master' into add-a-manual-refresh-button-to-update-all-…
meisenzahl Feb 26, 2022
3d267ba
Merge branch 'master' into add-a-manual-refresh-button-to-update-all-…
danirabbit May 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public class AppCenter.App : Gtk.Application {

public static GLib.Settings settings;

public static SimpleAction refresh_action;

static construct {
settings = new GLib.Settings ("io.elementary.appcenter.settings");
}
Expand Down Expand Up @@ -82,6 +84,11 @@ public class AppCenter.App : Gtk.Application {
client.cache_update_failed.connect (on_cache_update_failed);
client.installed_apps_changed.connect (on_updates_available);

refresh_action = new SimpleAction ("refresh", null);
refresh_action.activate.connect (() => {
client.update_cache.begin (true);
});

if (AppInfo.get_default_for_uri_scheme ("appstream") == null) {
var appinfo = new DesktopAppInfo (application_id + ".desktop");
try {
Expand All @@ -93,7 +100,9 @@ public class AppCenter.App : Gtk.Application {

add_action (quit_action);
add_action (show_updates_action);
add_action (refresh_action);
set_accels_for_action ("app.quit", {"<Control>q"});
set_accels_for_action ("app.refresh", {"<Control>r"});

search_provider = new SearchProvider ();
}
Expand Down
14 changes: 14 additions & 0 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class AppCenter.MainWindow : Hdy.ApplicationWindow {
private Gtk.Stack stack;
private Gtk.SearchEntry search_entry;
private Gtk.Spinner spinner;
private Gtk.ModelButton refresh_menuitem;
private Homepage homepage;
private Views.SearchView search_view;
private Gtk.Button return_button;
Expand Down Expand Up @@ -108,6 +109,7 @@ public class AppCenter.MainWindow : Hdy.ApplicationWindow {
notify["working"].connect (() => {
Idle.add (() => {
spinner.active = working;
App.refresh_action.set_enabled (!working);
return GLib.Source.REMOVE;
});
});
Expand Down Expand Up @@ -224,6 +226,17 @@ public class AppCenter.MainWindow : Hdy.ApplicationWindow {
}
});

var refresh_accellabel = new Granite.AccelLabel.from_action_name (
_("Check for Updates"),
"app.refresh"
);

refresh_menuitem = new Gtk.ModelButton () {
action_name = "app.refresh"
};
refresh_menuitem.get_child ().destroy ();
refresh_menuitem.add (refresh_accellabel);

var menu_popover_grid = new Gtk.Grid () {
column_spacing = 6,
margin_bottom = 6,
Expand All @@ -233,6 +246,7 @@ public class AppCenter.MainWindow : Hdy.ApplicationWindow {
};

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

menu_popover_grid.show_all ();

Expand Down