[gnome-games] game-icon-view: Subclass Gtk.FlowBoxChild
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] game-icon-view: Subclass Gtk.FlowBoxChild
- Date: Mon, 10 Feb 2020 20:48:41 +0000 (UTC)
commit 30be0ebb95bd1f9663a917c40b4f4a285fee0ec1
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Tue Feb 11 01:47:49 2020 +0500
game-icon-view: Subclass Gtk.FlowBoxChild
Make the code a little cleaner by removing extra get_child().
data/ui/game-icon-view.ui | 33 +++++++++++++++++++--------------
src/ui/collection-icon-view.vala | 4 ++--
src/ui/game-icon-view.vala | 2 +-
3 files changed, 22 insertions(+), 17 deletions(-)
---
diff --git a/data/ui/game-icon-view.ui b/data/ui/game-icon-view.ui
index a496cd0d..0aaab4bf 100644
--- a/data/ui/game-icon-view.ui
+++ b/data/ui/game-icon-view.ui
@@ -1,23 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.24"/>
- <template class="GamesGameIconView" parent="GtkBox">
+ <template class="GamesGameIconView" parent="GtkFlowBoxChild">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
<child>
- <object class="GamesGameThumbnail" id="thumbnail">
+ <object class="GtkBox">
<property name="visible">True</property>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="title">
- <property name="visible">True</property>
- <property name="ellipsize">middle</property>
- <property name="justify">center</property>
- <property name="lines">2</property>
- <property name="max-width-chars">0</property>
- <property name="wrap">True</property>
- <property name="wrap-mode">word-char</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GamesGameThumbnail" id="thumbnail">
+ <property name="visible">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="title">
+ <property name="visible">True</property>
+ <property name="ellipsize">middle</property>
+ <property name="justify">center</property>
+ <property name="lines">2</property>
+ <property name="max-width-chars">0</property>
+ <property name="wrap">True</property>
+ <property name="wrap-mode">word-char</property>
+ </object>
+ </child>
</object>
</child>
</template>
diff --git a/src/ui/collection-icon-view.vala b/src/ui/collection-icon-view.vala
index c92b5c9a..6164aee4 100644
--- a/src/ui/collection-icon-view.vala
+++ b/src/ui/collection-icon-view.vala
@@ -158,7 +158,7 @@ private class Games.CollectionIconView : Gtk.Bin {
[GtkCallback]
private void on_child_activated (Gtk.FlowBoxChild child) {
- var game_view = child.get_child () as GameIconView;
+ var game_view = child as GameIconView;
game_activated (game_view.game);
}
@@ -177,7 +177,7 @@ private class Games.CollectionIconView : Gtk.Bin {
}
private bool filter_box (Gtk.FlowBoxChild child) {
- var game_view = child.get_child () as GameIconView;
+ var game_view = child as GameIconView;
if (game_view == null)
return false;
diff --git a/src/ui/game-icon-view.vala b/src/ui/game-icon-view.vala
index 40f720ca..5763151e 100644
--- a/src/ui/game-icon-view.vala
+++ b/src/ui/game-icon-view.vala
@@ -1,7 +1,7 @@
// This file is part of GNOME Games. License: GPL-3.0+.
[GtkTemplate (ui = "/org/gnome/Games/ui/game-icon-view.ui")]
-private class Games.GameIconView : Gtk.Box {
+private class Games.GameIconView : Gtk.FlowBoxChild {
[GtkChild]
private GameThumbnail thumbnail;
[GtkChild]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]