[gnome-robots] move theme selection to more appropriate place
- From: Andrey Kutejko <akutejko src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-robots] move theme selection to more appropriate place
- Date: Tue, 6 Oct 2020 19:31:42 +0000 (UTC)
commit 2ae2e65c4d328c5f7f93cab9e07ba9e1d6d99164
Author: Andrey Kutejko <andy128k gmail com>
Date: Sun Sep 27 15:09:07 2020 +0200
move theme selection to more appropriate place
src/properties-dialog.vala | 13 -------------
src/robots.vala | 6 +++++-
src/themes.vala | 12 +++++++++++-
3 files changed, 16 insertions(+), 15 deletions(-)
---
diff --git a/src/properties-dialog.vala b/src/properties-dialog.vala
index 9dabdd9..50314a8 100644
--- a/src/properties-dialog.vala
+++ b/src/properties-dialog.vala
@@ -253,16 +253,3 @@ public void show_properties_dialog (Properties properties) {
keyboard_set (properties.keys);
}
-public Theme get_theme_from_properties (Properties properties) throws Error {
- var themes = get_themes ();
- var iter = themes.find_best_match (properties.theme);
-
- string theme_name;
- string theme_path;
- themes.get_values (iter, out theme_name, out theme_path);
-
- properties.theme = theme_name;
-
- return new Theme.from_file (theme_path, theme_name);
-}
-
diff --git a/src/robots.vala b/src/robots.vala
index 7caf520..add195f 100644
--- a/src/robots.vala
+++ b/src/robots.vala
@@ -340,8 +340,12 @@ class RobotsApplication : Gtk.Application {
private GameArea? create_game_area (Properties properties) {
try {
+ Themes themes = get_themes ();
+ Theme theme = themes.find_best_match (properties.theme);
+
+ properties.theme = theme.name;
+
game = new Game ();
- Theme theme = get_theme_from_properties (properties);
Bubble yahoo_bubble = new Bubble.from_data_file ("yahoo.png");
Bubble aieee_bubble = new Bubble.from_data_file ("aieee.png");
Bubble splat_bubble = new Bubble.from_data_file ("splat.png");
diff --git a/src/themes.vala b/src/themes.vala
index 702421d..be452ce 100644
--- a/src/themes.vala
+++ b/src/themes.vala
@@ -108,7 +108,7 @@ public class Themes : Gtk.ListStore {
path = path_value.get_string ();
}
- public Gtk.TreeIter find_best_match (string name) throws Error {
+ public Gtk.TreeIter find_best_match_iter (string name) throws Error {
const string DEFAULT_THEME = "robots.svg";
var iter = find_iter_by_name (name);
@@ -127,6 +127,16 @@ public class Themes : Gtk.ListStore {
throw new FileError.NOENT ("No theme was found.");
}
}
+
+ public Theme find_best_match (string name) throws Error {
+ var iter = find_best_match_iter (name);
+
+ string theme_name;
+ string theme_path;
+ themes.get_values (iter, out theme_name, out theme_path);
+
+ return new Theme.from_file (theme_path, theme_name);
+ }
}
string remove_suffix (string filename) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]