[gnome-games/wip/exalm/prefs: 21/24] preferences-page-video: Migrate to HdyPreferencesGroup
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/prefs: 21/24] preferences-page-video: Migrate to HdyPreferencesGroup
- Date: Tue, 2 Jun 2020 11:11:21 +0000 (UTC)
commit 5608248f866267028287257bb23be3470e566deb
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Tue May 12 22:53:07 2020 +0500
preferences-page-video: Migrate to HdyPreferencesGroup
data/ui/preferences-page-video.ui | 19 ++-----------------
src/ui/preferences-page-video.vala | 18 ++++++++++--------
2 files changed, 12 insertions(+), 25 deletions(-)
---
diff --git a/data/ui/preferences-page-video.ui b/data/ui/preferences-page-video.ui
index 27ebfb61..8355108b 100644
--- a/data/ui/preferences-page-video.ui
+++ b/data/ui/preferences-page-video.ui
@@ -4,24 +4,9 @@
<template class="GamesPreferencesPageVideo" parent="GamesPreferencesPage">
<property name="visible">True</property>
<child>
- <object class="GtkLabel">
+ <object class="HdyPreferencesGroup" id="filter_group">
<property name="visible">True</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes">Filter</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- </child>
- <child>
- <object class="GtkListBox" id="filter_list_box">
- <property name="visible">True</property>
- <property name="selection-mode">none</property>
- <signal name="row-activated" handler="filter_list_box_row_activated"/>
- <style>
- <class name="rounded"/>
- <class name="separators"/>
- </style>
+ <property name="title" translatable="yes">Filter</property>
</object>
</child>
</template>
diff --git a/src/ui/preferences-page-video.vala b/src/ui/preferences-page-video.vala
index b77cbcfb..780a9713 100644
--- a/src/ui/preferences-page-video.vala
+++ b/src/ui/preferences-page-video.vala
@@ -16,14 +16,16 @@ private class Games.PreferencesPageVideo : PreferencesPage {
}
}
+ [GtkChild]
+ private Hdy.PreferencesGroup filter_group;
+
// same as video-filters in gschema
/* Translators: These values are video filters applied to the screen. Smooth
* tries to smoothen the pixels, sharp displays the pixels square, and CRT
* emulates an old TV */
private string[] filter_display_names = { _("Smooth"), _("Sharp"), _("CRT") };
private string[] filter_names = { "smooth", "sharp", "crt" };
- [GtkChild]
- private Gtk.ListBox filter_list_box;
+
private Settings settings;
private Gtk.RadioButton filter_radios[3];
@@ -46,7 +48,12 @@ private class Games.PreferencesPageVideo : PreferencesPage {
row.add_prefix (filter_radios[i]);
row.activatable_widget = filter_radios[i];
row.show_all ();
- filter_list_box.add (row);
+
+ row.activated.connect (() => {
+ filter_active = filter_names[i];
+ });
+
+ filter_group.add (row);
}
settings = new Settings ("org.gnome.Games");
@@ -54,9 +61,4 @@ private class Games.PreferencesPageVideo : PreferencesPage {
SettingsBindFlags.DEFAULT);
title = _("Video");
}
-
- [GtkCallback]
- private void filter_list_box_row_activated (Gtk.ListBoxRow row_item) {
- filter_active = filter_names[row_item.get_index ()];
- }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]