[gnome-games/wip/exalm/developers: 8/8] sidebar-list-item: Merge into PlatformListItem
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/developers: 8/8] sidebar-list-item: Merge into PlatformListItem
- Date: Thu, 2 May 2019 18:44:23 +0000 (UTC)
commit 1e1f870b7077a98ccccc50e384b39a32c000d46d
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Wed May 1 20:52:28 2019 +0500
sidebar-list-item: Merge into PlatformListItem
Similarly to SidebarView, simplify this one.
data/org.gnome.Games.gresource.xml | 2 +-
data/ui/{sidebar-list-item.ui => platform-list-item.ui} | 2 +-
src/meson.build | 1 -
src/ui/platform-list-item.vala | 12 +++++-------
src/ui/platforms-view.vala | 7 +++++--
src/ui/sidebar-list-item.vala | 9 ---------
6 files changed, 12 insertions(+), 21 deletions(-)
---
diff --git a/data/org.gnome.Games.gresource.xml b/data/org.gnome.Games.gresource.xml
index 5c32b72a..86311a84 100644
--- a/data/org.gnome.Games.gresource.xml
+++ b/data/org.gnome.Games.gresource.xml
@@ -31,6 +31,7 @@
<file preprocess="xml-stripblanks">ui/media-menu-button.ui</file>
<file preprocess="xml-stripblanks">ui/media-selector.ui</file>
<file preprocess="xml-stripblanks">ui/platforms-view.ui</file>
+ <file preprocess="xml-stripblanks">ui/platform-list-item.ui</file>
<file preprocess="xml-stripblanks">ui/preferences-page.ui</file>
<file preprocess="xml-stripblanks">ui/preferences-page-controllers.ui</file>
<file preprocess="xml-stripblanks">ui/preferences-page-platforms.ui</file>
@@ -49,6 +50,5 @@
<file preprocess="xml-stripblanks">ui/resume-failed-dialog.ui</file>
<file preprocess="xml-stripblanks">ui/search-bar.ui</file>
<file preprocess="xml-stripblanks">ui/shortcuts-window.ui</file>
- <file preprocess="xml-stripblanks">ui/sidebar-list-item.ui</file>
</gresource>
</gresources>
diff --git a/data/ui/sidebar-list-item.ui b/data/ui/platform-list-item.ui
similarity index 86%
rename from data/ui/sidebar-list-item.ui
rename to data/ui/platform-list-item.ui
index 72867754..95c6f336 100644
--- a/data/ui/sidebar-list-item.ui
+++ b/data/ui/platform-list-item.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.24"/>
- <template class="GamesSidebarListItem" parent="GtkListBoxRow">
+ <template class="GamesPlatformListItem" parent="GtkListBoxRow">
<property name="visible">true</property>
<child>
<object class="GtkLabel" id="label">
diff --git a/src/meson.build b/src/meson.build
index f9ebc312..2ca5bb3c 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -179,7 +179,6 @@ vala_sources = [
'ui/resume-failed-dialog.vala',
'ui/search-bar.vala',
'ui/shortcuts-window.vala',
- 'ui/sidebar-list-item.vala',
'ui/ui-view.vala',
'utils/composite-cover.vala',
diff --git a/src/ui/platform-list-item.vala b/src/ui/platform-list-item.vala
index 365b2571..ff4c9837 100644
--- a/src/ui/platform-list-item.vala
+++ b/src/ui/platform-list-item.vala
@@ -1,6 +1,10 @@
// This file is part of GNOME Games. License: GPL-3.0+.
-private class Games.PlatformListItem : Games.SidebarListItem {
+[GtkTemplate (ui = "/org/gnome/Games/ui/platform-list-item.ui")]
+private class Games.PlatformListItem : Gtk.ListBoxRow {
+ [GtkChild]
+ protected Gtk.Label label;
+
private Platform _platform;
public Platform platform {
get { return _platform; }
@@ -14,12 +18,6 @@ private class Games.PlatformListItem : Games.SidebarListItem {
Object (platform: platform);
}
- public override bool has_game (Game game) {
- string game_platform = game.get_platform ().get_name ();
-
- return (game_platform == platform.get_name ());
- }
-
public static int compare (PlatformListItem a, PlatformListItem b) {
return a.platform.get_name ().collate (b.platform.get_name ());
}
diff --git a/src/ui/platforms-view.vala b/src/ui/platforms-view.vala
index 5510f769..b24f93e6 100644
--- a/src/ui/platforms-view.vala
+++ b/src/ui/platforms-view.vala
@@ -249,12 +249,15 @@ private class Games.PlatformsView : Gtk.Box {
}
foreach (var row in list_box.get_children ()) {
- var sidebar_item = row as SidebarListItem;
+ var platform_item = row as PlatformListItem;
+ var platform = platform_item.platform;
// Assume row doesn't have any games to show
var is_row_visible = false;
foreach (var game in visible_games) {
- if (sidebar_item.has_game (game)) {
+ var game_platform = game.get_platform ().get_name ();
+
+ if (game_platform == platform.get_name ()) {
is_row_visible = true;
break;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]