diff options
author | Marco Pesenti Gritti <mpg@redhat.com> | 2008-03-30 11:01:36 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <mpg@redhat.com> | 2008-03-30 11:01:36 (GMT) |
commit | 457540e27e11ad2640aba8f306200a8ad8926bfb (patch) | |
tree | aeb897b2a7f98de2968d4f06d23be4f167182b8d /src | |
parent | 4a5ca910c4ec721e08f59b7e293f68f2d4d2059c (diff) |
Setup xsettings dinamically so that we can take
screen size and dpi into account. It will need
some tweaking for resolutions that I'm not able
to test at the moment.
Diffstat (limited to 'src')
-rwxr-xr-x | src/emulator.py | 9 | ||||
-rw-r--r-- | src/main.py | 19 |
2 files changed, 19 insertions, 9 deletions
diff --git a/src/emulator.py b/src/emulator.py index 23ceea1..f54bdf2 100755 --- a/src/emulator.py +++ b/src/emulator.py @@ -131,15 +131,6 @@ def main(): else: os.environ['SUGAR_XO_STYLE'] = 'no' - if options.xo_style: - gtkrc_filename = 'sugar-xo.gtkrc' - else: - gtkrc_filename = 'sugar.gtkrc' - os.environ['SUGAR_XO_STYLE'] = 'no' - - gtkrc_path = os.path.join(config.data_path, gtkrc_filename) - os.environ['GTK2_RC_FILES'] = gtkrc_path - command = ['dbus-launch', 'dbus-launch', '--exit-with-session'] if not args: diff --git a/src/main.py b/src/main.py index e785707..f41c451 100644 --- a/src/main.py +++ b/src/main.py @@ -31,6 +31,7 @@ import gobject from sugar import env from sugar import logger from sugar.profile import get_profile +from sugar.graphics import style from view.Shell import Shell from model.shellmodel import ShellModel @@ -65,6 +66,23 @@ def _save_session_info(): f.close() +def _setup_screen_settings(): + settings = gtk.settings_get_default() + ctx = 'sugar-shell' + + if gtk.gdk.screen_width() > 1024: + theme = 'sugar-xo' + else: + theme = 'sugar' + settings.set_string_property('gtk-theme-name', 'sugar', ctx) + + font = 'Sans Serif %d' % style.FONT_SIZE + settings.set_string_property('gtk-font-name', font, ctx) + + settings.set_string_property('gtk-icon-theme-name', 'sugar', ctx) + settings.set_string_property('gtk-cursor-theme-name', 'sugar', ctx) + settings.set_long_property('gtk-toolbar-style', gtk.TOOLBAR_ICONS, ctx) + def _setup_translations(): locale_path = os.path.join(config.prefix, 'share', 'locale') domain = 'sugar' @@ -98,6 +116,7 @@ def main(): _save_session_info() _start_matchbox() _setup_translations() + _setup_screen_settings() hw_manager = hardwaremanager.get_manager() hw_manager.startup() |