[gnome-games] collection-icon-view: Add checkbox for selection support
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] collection-icon-view: Add checkbox for selection support
- Date: Tue, 25 Aug 2020 11:11:56 +0000 (UTC)
commit d5f78c143a7eae761c4c8eda731bb57a31f413ab
Author: Neville <nevilleantony98 gmail com>
Date: Fri Aug 21 14:10:34 2020 +0530
collection-icon-view: Add checkbox for selection support
Also style disabled collection-icon-views as dimmed/transparent.
data/gtk-style.css | 9 +++++++++
data/ui/collection-icon-view.ui | 25 ++++++++++++++++++++++++-
src/ui/collection-icon-view.vala | 15 +++++++++++++++
3 files changed, 48 insertions(+), 1 deletion(-)
---
diff --git a/data/gtk-style.css b/data/gtk-style.css
index 2ab081243..d87e8e8d8 100644
--- a/data/gtk-style.css
+++ b/data/gtk-style.css
@@ -41,6 +41,15 @@
padding: 6px 32px;
}
+.collection-icon-view {
+ transition: opacity 250ms;
+ }
+
+.collection-icon-view:disabled {
+ opacity: 0.5;
+ background: none;
+}
+
gamescollectionsmainpage flowboxchild stack {
background: mix(@theme_base_color, @theme_bg_color, 0.5);
border-radius: 6px;
diff --git a/data/ui/collection-icon-view.ui b/data/ui/collection-icon-view.ui
index c73cead4c..a4db4917f 100644
--- a/data/ui/collection-icon-view.ui
+++ b/data/ui/collection-icon-view.ui
@@ -9,8 +9,31 @@
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
- <object class="GamesCollectionThumbnail" id="thumbnail">
+ <object class="GtkOverlay">
<property name="visible">True</property>
+ <child>
+ <object class="GamesCollectionThumbnail" id="thumbnail">
+ <property name="visible">True</property>
+ </object>
+ </child>
+ <child type="overlay">
+ <object class="GtkRevealer">
+ <property name="visible">True</property>
+ <property name="transition-type">crossfade</property>
+ <property name="reveal-child" bind-source="GamesCollectionIconView"
bind-property="is_selection_mode"/>
+ <child>
+ <object class="GtkCheckButton" id="checkbox">
+ <property name="visible">True</property>
+ <property name="halign">end</property>
+ <property name="valign">end</property>
+ <property name="active" bind-source="GamesCollectionIconView" bind-property="checked"
bind-flags="bidirectional"/>
+ <style>
+ <class name="check"/>
+ </style>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
</child>
<child>
diff --git a/src/ui/collection-icon-view.vala b/src/ui/collection-icon-view.vala
index 4a6652d88..8857111df 100644
--- a/src/ui/collection-icon-view.vala
+++ b/src/ui/collection-icon-view.vala
@@ -7,6 +7,9 @@ private class Games.CollectionIconView : Gtk.FlowBoxChild {
[GtkChild]
private CollectionThumbnail thumbnail;
+ public bool checked { get; set; }
+ public bool is_selection_mode { get; set; }
+
private Collection _collection;
public Collection collection {
get { return _collection; }
@@ -18,7 +21,19 @@ private class Games.CollectionIconView : Gtk.FlowBoxChild {
}
}
+ construct {
+ get_style_context ().add_class ("collection-icon-view");
+ }
+
public CollectionIconView (Collection collection) {
Object (collection: collection);
}
+
+ public static uint hash (CollectionIconView key) {
+ return Collection.hash (key.collection);
+ }
+
+ public static bool equal (CollectionIconView a, CollectionIconView b) {
+ return Collection.equal (a.collection, b.collection);
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]