diff options
author | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-12-10 18:20:19 (GMT) |
---|---|---|
committer | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-12-14 11:13:08 (GMT) |
commit | 1f211ae9d2ddcf646b17a2cf34fba251b217cae6 (patch) | |
tree | afbf979ecabbeb8544c88cc7674df34d64818273 | |
parent | d67cb5e3cd7d584fbd3d7e3cca819421577ea882 (diff) |
Use underscore consistently
-rwxr-xr-x | src/jarabe/main.py | 67 |
1 files changed, 32 insertions, 35 deletions
diff --git a/src/jarabe/main.py b/src/jarabe/main.py index a117fd9..f73b28e 100755 --- a/src/jarabe/main.py +++ b/src/jarabe/main.py @@ -67,17 +67,17 @@ from jarabe.intro.window import IntroWindow from jarabe import frame from jarabe.view.service import UIService -def unfreeze_dcon_cb(): +def _unfreeze_dcon_cb(): logging.debug('STARTUP: unfreeze_dcon_cb') screen.set_dcon_freeze(0) -def check_software_updates(): +def _check_software_updates(): logging.debug('STARTUP: check_software_updates') if os.path.isfile(os.path.expanduser('~/.sugar-update')): home_window = homewindow.get_instance() home_window.get_home_box().show_software_updates_alert() -def setup_window_manager(): +def _setup_window_manager(): logging.debug('STARTUP: window_manager') if subprocess.call('metacity-message disable-keybindings', @@ -88,8 +88,17 @@ def setup_window_manager(): shell=True): logging.warning('Can not disable metacity mouse button modifiers') -def bootstrap(): - setup_window_manager() +def _window_manager_changed_cb(screen): + _check_for_window_manager(screen) + +def _check_for_window_manager(screen): + wm_name = screen.get_window_manager_name() + if wm_name is not None: + screen.disconnect_by_func(_window_manager_changed_cb) + _bootstrap() + +def _bootstrap(): + _setup_window_manager() launcher.setup() keyboard.setup() @@ -102,16 +111,16 @@ def bootstrap(): journalactivity.start() - check_software_updates() + _check_software_updates() -def setup_fonts(): +def _setup_fonts(): client = GConf.Client.get_default() face = client.get_string('/desktop/sugar/font/default_face') size = client.get_float('/desktop/sugar/font/default_size') settings = Gtk.Settings.get_default() settings.set_property("gtk-font-name", "%s %f" % (face, size)) -def setup_theme(): +def _setup_theme(): settings = Gtk.Settings.get_default() sugar_theme = 'sugar-72' if 'SUGAR_SCALING' in os.environ: @@ -123,7 +132,7 @@ def setup_theme(): icons_path = os.path.join(config.data_path, 'icons') Gtk.IconTheme.get_default().append_search_path(icons_path) -def start_home(): +def _start_home(): ui_service = UIService() session_manager = get_session_manager() @@ -134,13 +143,13 @@ def start_home(): home_window.show() screen = Wnck.Screen.get_default() - screen.connect('window-manager-changed', __window_manager_changed_cb) + screen.connect('window-manager-changed', _window_manager_changed_cb) _check_for_window_manager(screen) -def intro_window_done_cb(window): - start_home() +def _intro_window_done_cb(window): + _start_home() -def cleanup_temporary_files(): +def _cleanup_temporary_files(): try: # Remove temporary files. See http://bugs.sugarlabs.org/ticket/1876 data_dir = os.path.join(env.get_profile_path(), 'data') @@ -151,7 +160,7 @@ 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(): +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) @@ -163,26 +172,26 @@ def setup_locale(): if timezone is not None and timezone: os.environ['TZ'] = timezone -def main(): +def _main(): GLib.threads_init() Gdk.threads_init() dbus.glib.threads_init() Gst.init(sys.argv) - cleanup_temporary_files() + _cleanup_temporary_files() - setup_locale() + _setup_locale() client = GConf.Client.get_default() client.set_string('/apps/metacity/general/mouse_button_modifier', '<Super>') - setup_fonts() - setup_theme() + _setup_fonts() + _setup_theme() # this must be added early, so that it executes and unfreezes the screen # even when we initially get blocked on the intro screen - GObject.idle_add(unfreeze_dcon_cb) + GObject.idle_add(_unfreeze_dcon_cb) cursortracker.setup() # make sure we have the correct cursor in the intro screen @@ -196,26 +205,14 @@ def main(): if not intro.check_profile(): win = IntroWindow() - win.connect("done", intro_window_done_cb) + win.connect("done", _intro_window_done_cb) win.show_all() else: - start_home() + _start_home() try: Gtk.main() except KeyboardInterrupt: print 'Ctrl+C pressed, exiting...' - -def __window_manager_changed_cb(screen): - _check_for_window_manager(screen) - - -def _check_for_window_manager(screen): - wm_name = screen.get_window_manager_name() - if wm_name is not None: - screen.disconnect_by_func(__window_manager_changed_cb) - bootstrap() - - -main() +_main() |