[gnome-games/wip/exalm/tnum: 18/24] collection-view: Refactor favorite_action()
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/tnum: 18/24] collection-view: Refactor favorite_action()
- Date: Wed, 19 Aug 2020 18:22:24 +0000 (UTC)
commit 67c6b3bc11ec33eb8df4c1bcbfc09bed6c5618a1
Author: Neville <nevilleantony98 gmail com>
Date: Tue Aug 11 23:09:36 2020 +0530
collection-view: Refactor favorite_action()
Reuse existing get_currently_selected_games()
src/ui/collection-view.vala | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
---
diff --git a/src/ui/collection-view.vala b/src/ui/collection-view.vala
index cd6f67a0d..8be154108 100644
--- a/src/ui/collection-view.vala
+++ b/src/ui/collection-view.vala
@@ -396,20 +396,15 @@ private class Games.CollectionView : Gtk.Box, UiView {
}
private void favorite_action () {
- if (viewstack.visible_child == games_page)
- collection_manager.toggle_favorite (games_page.get_selected_games ());
- else if (viewstack.visible_child == platforms_page)
- collection_manager.toggle_favorite (platforms_page.get_selected_games ());
- else {
- collection_manager.toggle_favorite (collections_page.get_selected_games ());
+ collection_manager.toggle_favorite (get_currently_selected_games ());
- var current_collection = collections_page.current_collection;
- if (current_collection != null && current_collection.get_id () == "Favorites") {
- collections_page.update_is_collection_empty ();
- select_none ();
- toggle_select ();
- return;
- }
+ if (viewstack.visible_child == collections_page &&
+ collections_page.is_subpage_open &&
+ collections_page.current_collection.get_id () == "Favorites") {
+ collections_page.update_is_collection_empty ();
+ select_none ();
+ toggle_select ();
+ return;
}
update_selection_action_bar ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]