[gnome-games] collections-main-page: Enable selection on right click & long press



commit 2e051c6700aeba755dd4a9a77ef5552615935063
Author: Neville <nevilleantony98 gmail com>
Date:   Tue Aug 25 19:20:45 2020 +0530

    collections-main-page: Enable selection on right click & long press

 src/ui/collections-main-page.vala | 9 +++++++++
 src/ui/collections-page.ui        | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/src/ui/collections-main-page.vala b/src/ui/collections-main-page.vala
index e96892a8..22d43d63 100644
--- a/src/ui/collections-main-page.vala
+++ b/src/ui/collections-main-page.vala
@@ -80,6 +80,15 @@ private class Games.CollectionsMainPage : Gtk.Bin {
 
        private Gtk.Widget add_collection (Object item) {
                var collection_icon_view = new CollectionIconView (item as Collection);
+               collection_icon_view.secondary_click.connect (() => {
+                       if (is_selection_mode)
+                               return;
+
+                       is_selection_mode = true;
+                       if (item is UserCollection)
+                               collection_icon_view.activate ();
+               });
+
                if (item is UserCollection) {
                        bind_property ("is-selection-mode", collection_icon_view, "is-selection-mode", 
BindingFlags.DEFAULT);
                        collection_icon_view.notify["checked"].connect (() => {
diff --git a/src/ui/collections-page.ui b/src/ui/collections-page.ui
index 9cb520aa..44ae8c25 100644
--- a/src/ui/collections-page.ui
+++ b/src/ui/collections-page.ui
@@ -14,7 +14,7 @@
         <child>
           <object class="GamesCollectionsMainPage" id="collections_main_page">
             <property name="visible">True</property>
-            <property name="is-selection-mode" bind-source="GamesCollectionsPage" 
bind-property="is-selection-mode"/>
+            <property name="is-selection-mode" bind-source="GamesCollectionsPage" 
bind-property="is-selection-mode" bind-flags="bidirectional"/>
             <property name="is-search-mode" bind-source="GamesCollectionsPage" 
bind-property="is-search-mode"/>
             <property name="is-search-empty" bind-source="GamesCollectionsPage" 
bind-property="is-search-empty" bind-flags="bidirectional"/>
             <signal name="collection-activated" handler="on_collection_activated"/>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]