diff options
author | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-12-10 17:18:33 (GMT) |
---|---|---|
committer | Simon Schampijer <simon@laptop.org> | 2013-01-22 09:30:22 (GMT) |
commit | 18f4c36a593f54df9efc404b0520dcce6713ca1f (patch) | |
tree | cf5bbb447f1665a5897aecc927d3d9b9a87095bc | |
parent | d4e8f67adc7f1bd535fb6766bc8b7ee74f971826 (diff) |
Factor out setup_locale function
Simplifies the messy main.
Acked-by: Simon Schampijer <simon@laptop.org>
-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() |