[four-in-a-row] Fix changing theme.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [four-in-a-row] Fix changing theme.
- Date: Mon, 19 Aug 2019 15:40:03 +0000 (UTC)
commit 350e608b1d5b81e364e5df8dd303f2e801667158
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Mon Aug 19 00:09:37 2019 +0200
Fix changing theme.
src/game-board-view.vala | 2 +-
src/prefs.vala | 15 ++++++---------
2 files changed, 7 insertions(+), 10 deletions(-)
---
diff --git a/src/game-board-view.vala b/src/game-board-view.vala
index 89dcaf2..112db2f 100644
--- a/src/game-board-view.vala
+++ b/src/game-board-view.vala
@@ -40,7 +40,7 @@ class GameBoardView : Gtk.DrawingArea {
events = Gdk.EventMask.EXPOSURE_MASK |
Gdk.EventMask.BUTTON_PRESS_MASK |
Gdk.EventMask.BUTTON_RELEASE_MASK;
- Prefs.instance.notify["theme_id"].connect(() =>{
+ Prefs.instance.theme_changed.connect(() =>{
change_theme();
});
load_pixmaps();
diff --git a/src/prefs.vala b/src/prefs.vala
index 56de6be..0e5eb3b 100644
--- a/src/prefs.vala
+++ b/src/prefs.vala
@@ -49,7 +49,7 @@ class Prefs : Object {
level[PlayerID.PLAYER2] = (Level) settings.get_int("opponent");
theme_id = settings.get_int("theme-id");
- settings.changed.connect(settings_changed_cb);
+ settings.changed ["theme-id"].connect(theme_id_changed_cb);
settings.bind("sound", this, "do_sound", SettingsBindFlags.DEFAULT);
settings.bind("theme-id", this, "theme-id", SettingsBindFlags.DEFAULT);
settings.bind("key-drop", this, "keypress_drop", SettingsBindFlags.DEFAULT);
@@ -76,14 +76,11 @@ class Prefs : Object {
*/
public signal void theme_changed(int theme_id);
- public void settings_changed_cb(string key) {
- if (key == "theme-id") {
- int val = sane_theme_id(settings.get_int("theme-id"));
- if (val != theme_id) {
- theme_id = val;
- theme_changed(theme_id);
- }
- }
+ private void theme_id_changed_cb (string key) {
+ int val = sane_theme_id(settings.get_int("theme-id"));
+ if (val != theme_id)
+ theme_id = val;
+ theme_changed(theme_id);
}
public int get_n_human_players() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]