[gnome-games/wip/exalm/tnum: 16/24] collection-view: Invalidate the collection sort on rename
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/tnum: 16/24] collection-view: Invalidate the collection sort on rename
- Date: Wed, 19 Aug 2020 18:22:24 +0000 (UTC)
commit a1d5dadf695cf44c663a69d0535d5ab4674c7620
Author: Neville <nevilleantony98 gmail com>
Date: Sun Aug 9 16:24:06 2020 +0530
collection-view: Invalidate the collection sort on rename
This will rearrange the collections in the flowbox with the right sort
after a rename operation.
src/collection/collection-model.vala | 5 +++++
src/ui/collections-main-page.vala | 4 ++++
src/ui/collections-page.vala | 4 ++++
3 files changed, 13 insertions(+)
---
diff --git a/src/collection/collection-model.vala b/src/collection/collection-model.vala
index 05e45305c..3aee5ead4 100644
--- a/src/collection/collection-model.vala
+++ b/src/collection/collection-model.vala
@@ -47,4 +47,9 @@ private class Games.CollectionModel : Object, ListModel {
items_changed (pos, 1, 0);
collection_removed (collection);
}
+
+ public void invalidate_sort () {
+ sequence.sort (Collection.compare);
+ items_changed (0, n_collections, n_collections);
+ }
}
diff --git a/src/ui/collections-main-page.vala b/src/ui/collections-main-page.vala
index b277f5769..cb43e71ba 100644
--- a/src/ui/collections-main-page.vala
+++ b/src/ui/collections-main-page.vala
@@ -102,6 +102,10 @@ private class Games.CollectionsMainPage : Gtk.Bin {
flow_box.invalidate_filter ();
}
+ public void invalidate_sort () {
+ collection_model.invalidate_sort ();
+ }
+
private bool collection_filter_func (Gtk.FlowBoxChild child) {
var collection_icon_view = child as CollectionIconView;
if (collection_icon_view == null)
diff --git a/src/ui/collections-page.vala b/src/ui/collections-page.vala
index 485de0a66..5b76fd88c 100644
--- a/src/ui/collections-page.vala
+++ b/src/ui/collections-page.vala
@@ -129,6 +129,10 @@ private class Games.CollectionsPage : Gtk.Bin {
collections_main_page.invalidate_filter ();
}
+ public void invalidate_sort () {
+ collections_main_page.invalidate_sort ();
+ }
+
public void remove_current_user_collection () {
if (!is_showing_user_collection || current_collection == null)
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]