[gnome-games] checkmark-item: Inherit from GtkListBoxRow



commit d768ed78884a20f88a608e74289e30f94ac015c9
Author: Yetizone <andreii lisita gmail com>
Date:   Sat Feb 9 18:41:37 2019 +0200

    checkmark-item: Inherit from GtkListBoxRow

 data/ui/checkmark-item.ui          | 31 ++++++++++++++++++-------------
 src/ui/checkmark-item.vala         |  2 +-
 src/ui/media-selector.vala         |  2 +-
 src/ui/preferences-page-video.vala |  2 +-
 4 files changed, 21 insertions(+), 16 deletions(-)
---
diff --git a/data/ui/checkmark-item.ui b/data/ui/checkmark-item.ui
index 027c97eb..b88a75c9 100644
--- a/data/ui/checkmark-item.ui
+++ b/data/ui/checkmark-item.ui
@@ -1,21 +1,26 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
-  <template class="GamesCheckmarkItem" parent="GtkBox">
-    <property name="margin">6</property>
-    <property name="spacing">12</property>
+  <template class="GamesCheckmarkItem" parent="GtkListBoxRow">
     <property name="visible">true</property>
     <child>
-      <object class="GtkLabel" id="title_label">
+      <object class="GtkBox">
+        <property name="margin">6</property>
+        <property name="spacing">12</property>
         <property name="visible">true</property>
-        <property name="vexpand">true</property>
-        <property name="wrap">true</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkImage" id="checkmark_image">
-        <property name="visible">False</property>
-        <property name="icon-name">object-select-symbolic</property>
-        <property name="valign">center</property>
+        <child>
+          <object class="GtkLabel" id="title_label">
+            <property name="visible">true</property>
+            <property name="vexpand">true</property>
+            <property name="wrap">true</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkImage" id="checkmark_image">
+            <property name="visible">False</property>
+            <property name="icon-name">object-select-symbolic</property>
+            <property name="valign">center</property>
+          </object>
+        </child>
       </object>
     </child>
   </template>
diff --git a/src/ui/checkmark-item.vala b/src/ui/checkmark-item.vala
index d28c96a1..8405845c 100644
--- a/src/ui/checkmark-item.vala
+++ b/src/ui/checkmark-item.vala
@@ -1,7 +1,7 @@
 // This file is part of GNOME Games. License: GPL-3.0+.
 
 [GtkTemplate (ui = "/org/gnome/Games/ui/checkmark-item.ui")]
-private class Games.CheckmarkItem: Gtk.Box {
+private class Games.CheckmarkItem: Gtk.ListBoxRow {
        [GtkChild]
        private Gtk.Label title_label;
        [GtkChild]
diff --git a/src/ui/media-selector.vala b/src/ui/media-selector.vala
index 48bbd01e..780720a4 100644
--- a/src/ui/media-selector.vala
+++ b/src/ui/media-selector.vala
@@ -68,7 +68,7 @@ private class Games.MediaSelector : Gtk.Popover {
                var i = 0;
                var row = list_box.get_row_at_index (i);
                while (row != null) {
-                       var checkmark_item = row.get_child () as CheckmarkItem;
+                       var checkmark_item = row as CheckmarkItem;
                        checkmark_item.checkmark_visible = (i == media_number);
 
                        row = list_box.get_row_at_index (++i);
diff --git a/src/ui/preferences-page-video.vala b/src/ui/preferences-page-video.vala
index 72d9f1fc..6f79df9c 100644
--- a/src/ui/preferences-page-video.vala
+++ b/src/ui/preferences-page-video.vala
@@ -7,7 +7,7 @@ private class Games.PreferencesPageVideo: PreferencesPage {
                set {
                        for (var i = 0; i < filter_names.length; i++) {
                                var row_item = filter_list_box.get_row_at_index (i);
-                               var checkmark_item = row_item.get_child () as CheckmarkItem;
+                               var checkmark_item = row_item as CheckmarkItem;
                                checkmark_item.checkmark_visible = (value == filter_names[i]);
                        }
                        _filter_active = value;


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