diff options
author | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-12-10 17:18:33 (GMT) |
---|---|---|
committer | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-12-14 10:27:49 (GMT) |
commit | 28e2f57867b71c01feb379ce11261daabccb7387 (patch) | |
tree | a11991bcaeef706303d6932ce16a5dbfe8460230 | |
parent | 85ec4fdb9468aa3590d8b12d62ab18cfa8ee70a7 (diff) |
Factor out setup_locale function
Simplifies the messy main.
-rwxr-xr-x | src/jarabe/main.py | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/jarabe/main.py b/src/jarabe/main.py index d84b224..71127b1 100755 --- a/src/jarabe/main.py +++ b/src/jarabe/main.py @@ -176,6 +176,18 @@ def cleanup_temporary_files(): # sugar from starting if (for example) the disk is full or read-only. print 'temporary files cleanup failed: %s' % e +def setup_locale(): + # NOTE: This needs to happen early because some modules register + # translatable strings in the module scope. + gettext.bindtextdomain('sugar', config.locale_path) + gettext.bindtextdomain('sugar-toolkit', config.locale_path) + gettext.textdomain('sugar') + + client = GConf.Client.get_default() + timezone = client.get_string('/desktop/sugar/date/timezone') + if timezone is not None and timezone: + os.environ['TZ'] = timezone + def main(): GLib.threads_init() Gdk.threads_init() @@ -184,23 +196,15 @@ def main(): cleanup_temporary_files() - # NOTE: This needs to happen so early because some modules register - # translatable strings in the module scope. - gettext.bindtextdomain('sugar', config.locale_path) - gettext.bindtextdomain('sugar-toolkit', config.locale_path) - gettext.textdomain('sugar') - logger.cleanup() logger.start('shell') + setup_locale() + client = GConf.Client.get_default() client.set_string('/apps/metacity/general/mouse_button_modifier', '<Super>') - timezone = client.get_string('/desktop/sugar/date/timezone') - if timezone is not None and timezone: - os.environ['TZ'] = timezone - set_fonts() set_theme() |