[gnome-games] [lightsoff] Move more code into global ThemeLoader
- From: Tim Horton <hortont src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-games] [lightsoff] Move more code into global ThemeLoader
- Date: Thu, 16 Jul 2009 22:33:17 +0000 (UTC)
commit fa6a3d82b2f5390036aa8e70fe4c46a509a89a20
Author: Tim Horton <hortont424 gmail com>
Date: Sat Jul 11 22:36:21 2009 -0400
[lightsoff] Move more code into global ThemeLoader
lightsoff/src/Settings.js | 16 +---------------
lightsoff/src/ThemeLoader.js | 17 +++++++++++++++++
2 files changed, 18 insertions(+), 15 deletions(-)
---
diff --git a/lightsoff/src/Settings.js b/lightsoff/src/Settings.js
index 1f5b8bf..316e79d 100644
--- a/lightsoff/src/Settings.js
+++ b/lightsoff/src/Settings.js
@@ -12,9 +12,7 @@ var theme, score;
var default_theme = "Tango";
// Map theme names to themes
-var themes = {};
-
-load_themes();
+var themes = ThemeLoader.load_themes();
try
{
@@ -32,18 +30,6 @@ catch(e)
score = 1;
}
-function load_themes()
-{
- file = Gio.file_new_for_path(main.file_prefix + "/themes");
- enumerator = file.enumerate_children("standard::name");
-
- while((child = enumerator.next_file()))
- {
- var c_theme = imports.themes[child.get_name()].theme;
- themes[c_theme.name] = c_theme;
- }
-}
-
// Settings Event Handler
SettingsWatcher = new GType({
diff --git a/lightsoff/src/ThemeLoader.js b/lightsoff/src/ThemeLoader.js
index f5374ab..cae4caa 100644
--- a/lightsoff/src/ThemeLoader.js
+++ b/lightsoff/src/ThemeLoader.js
@@ -1,4 +1,5 @@
Clutter = imports.gi.Clutter;
+Gio = imports.gi.Gio;
function load_svg(theme, file)
{
@@ -19,3 +20,19 @@ function load_theme(stage, theme)
for(actor in theme.textures)
stage.add_actor(theme.textures[actor]);
}
+
+function load_themes()
+{
+ themes = {};
+
+ file = Gio.file_new_for_path(imports.path.file_prefix + "/themes");
+ enumerator = file.enumerate_children("standard::name");
+
+ while((child = enumerator.next_file()))
+ {
+ var c_theme = imports.themes[child.get_name()].theme;
+ themes[c_theme.name] = c_theme;
+ }
+
+ return themes;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]