diff --git a/src/Core/FlatpakBackend.vala b/src/Core/FlatpakBackend.vala index a5cc8e729..3a2ca09d4 100644 --- a/src/Core/FlatpakBackend.vala +++ b/src/Core/FlatpakBackend.vala @@ -90,9 +90,12 @@ public class AppCenterCore.FlatpakBackend : Object, Backend { // Right now only for runtime updates private GLib.ListStore additional_updates; - private Gtk.SortListModel _updatable_packages; + private Gtk.FilterListModel _updatable_packages; public ListModel updatable_packages { get { return _updatable_packages; } } + public ListModel working_packages { get; private set; } + + public bool has_working_packages { get { return working_packages.get_n_items () > 0; } } public bool has_updatable_packages { get { return _updatable_packages.n_items > 0; } } public uint n_updatable_packages { get { return _updatable_packages.n_items; } } public uint n_unpaid_updatable_packages { @@ -273,19 +276,8 @@ public class AppCenterCore.FlatpakBackend : Object, Backend { var flatten_model = new Gtk.FlattenListModel (updates_models); var updatable_filter = new Gtk.BoolFilter (update_available_expression); - var updating_filter = new Gtk.BoolFilter (updating_expression); - - var updatable_any_filter = new Gtk.AnyFilter (); - updatable_any_filter.append (updatable_filter); - updatable_any_filter.append (updating_filter); - var updatable_packages = new Gtk.FilterListModel (flatten_model, updatable_any_filter); - - var updating_sorter = new Gtk.NumericSorter (updating_expression) { - sort_order = DESCENDING - }; - - _updatable_packages = new Gtk.SortListModel (updatable_packages, updating_sorter); + _updatable_packages = new Gtk.FilterListModel (flatten_model, updatable_filter); _updatable_packages.items_changed.connect (() => { notify_property ("has-updatable-packages"); notify_property ("n-updatable-packages"); @@ -294,6 +286,12 @@ public class AppCenterCore.FlatpakBackend : Object, Backend { notify_property ("up-to-date"); }); + var working_expression = new Gtk.PropertyExpression (typeof (Package), null, "working"); + var working_filter = new Gtk.BoolFilter (working_expression); + + working_packages = new Gtk.FilterListModel (_sorted_packages, working_filter); + working_packages.items_changed.connect (() => notify_property ("has-working-packages")); + worker_thread = new Thread ("flatpak-worker", worker_func); user_appstream_pool = new AppStream.Pool (); user_appstream_pool.set_flags (AppStream.PoolFlags.LOAD_OS_CATALOG); diff --git a/src/Core/Package.vala b/src/Core/Package.vala index cc11a651a..7271b136c 100644 --- a/src/Core/Package.vala +++ b/src/Core/Package.vala @@ -103,6 +103,8 @@ public class AppCenterCore.Package : Object { public ChangeInformation change_information { public get; private set; } public State state { public get; private set; default = State.NOT_INSTALLED; } + public bool working { get { return state == INSTALLING || state == UPDATING || state == REMOVING; } } + public double progress { get { return change_information.progress; @@ -446,6 +448,7 @@ public class AppCenterCore.Package : Object { // Only trigger a notify if the state has changed, quite a lot of things listen to this if (state != new_state) { state = new_state; + notify_property ("working"); backend.notify_package_changed (this); } } diff --git a/src/Views/AppListUpdateView.vala b/src/Views/AppListUpdateView.vala index f05500928..c4350b5e1 100644 --- a/src/Views/AppListUpdateView.vala +++ b/src/Views/AppListUpdateView.vala @@ -70,6 +70,22 @@ public class AppCenter.Views.AppListUpdateView : Adw.NavigationPage { updatable_section.append (list_box); flatpak_backend.bind_property ("has-updatable-packages", updatable_section, "visible", SYNC_CREATE); + var in_progress_header = new Granite.HeaderLabel (_("In Progress")) { + margin_end = 12, + margin_start = 12 + }; + + var in_progress_list = new Gtk.ListBox () { + activate_on_single_click = true, + hexpand = true, + }; + in_progress_list.bind_model (flatpak_backend.working_packages, create_row_from_package); + + var in_progress_section = new Granite.Box (VERTICAL, HALF); + in_progress_section.append (in_progress_header); + in_progress_section.append (in_progress_list); + flatpak_backend.bind_property ("has-working-packages", in_progress_section, "visible", SYNC_CREATE); + installed_header = new Granite.HeaderLabel (_("Up to Date")) { margin_end = 12, margin_start = 12 @@ -92,8 +108,9 @@ public class AppCenter.Views.AppListUpdateView : Adw.NavigationPage { installed_section.append (installed_flowbox); flatpak_backend.bind_property ("has-updated-packages", installed_section, "visible", SYNC_CREATE); - var box = new Granite.Box (VERTICAL, SINGLE); + var box = new Granite.Box (VERTICAL, DOUBLE); box.append (updatable_section); + box.append (in_progress_section); box.append (installed_section); var clamp = new Adw.Clamp () {