From db0cb818c87cf5697f57828222c655b2fa818284 Mon Sep 17 00:00:00 2001
From: Daniel Drake <dsd@laptop.org>
Date: Fri, 27 Nov 2009 11:34:59 +0000
Subject: [PATCH] Configure fonts through GConf
Sugar currently configures fonts through gtkrc and through the
sugar.graphics.style class, both of which are hard to modify by
implementors/deployers.
Move this into GConf and apply these settings to the sugar shell
at startup.
In the longer term, Sayamindu's efforts to create a settings manager
will build on this work.
---
bin/sugar-session | 9 +++++++++
data/gtkrc.em | 1 -
data/sugar.schemas.in | 23 +++++++++++++++++++++++
3 files changed, 32 insertions(+), 1 deletions(-)
diff --git a/bin/sugar-session b/bin/sugar-session
index f06479d..ef22db0 100644
a
|
b
|
def bootstrap(): |
207 | 207 | if sys.modules.has_key('xklavier'): |
208 | 208 | gobject.idle_add(setup_keyboard_cb) |
209 | 209 | |
| 210 | def set_fonts(): |
| 211 | client = gconf.client_get_default() |
| 212 | face = client.get_string('/desktop/sugar/font/default_face') |
| 213 | size = client.get_float('/desktop/sugar/font/default_size') |
| 214 | settings = gtk.settings_get_default() |
| 215 | settings.set_property("gtk-font-name", "%s %f" % (face, size)) |
| 216 | |
210 | 217 | def main(): |
211 | 218 | cleanup_logs() |
212 | 219 | logger.start('shell') |
… |
… |
def main(): |
219 | 226 | if timezone is not None and timezone: |
220 | 227 | os.environ['TZ'] = timezone |
221 | 228 | |
| 229 | set_fonts() |
| 230 | |
222 | 231 | intro.check_profile() |
223 | 232 | |
224 | 233 | start_ui_service() |
diff --git a/data/gtkrc.em b/data/gtkrc.em
index b9eeb7d..d4e1a7c 100644
a
|
b
|
else: |
6 | 6 | }@ |
7 | 7 | gtk-theme-name = "sugar-@scaling" |
8 | 8 | gtk-icon-theme-name = "sugar" |
9 | | gtk-font-name = "Sans Serif 10" |
10 | 9 | gtk-cursor-theme-name = "sugar" |
11 | 10 | gtk-toolbar-style = GTK_TOOLBAR_ICONS |
12 | 11 | gtk-icon-sizes = "@icon_sizes" |
diff --git a/data/sugar.schemas.in b/data/sugar.schemas.in
index 8c43930..48770de 100644
a
|
b
|
|
216 | 216 | </locale> |
217 | 217 | </schema> |
218 | 218 | |
| 219 | <schema> |
| 220 | <key>/schemas/desktop/sugar/font/default_face</key> |
| 221 | <applyto>/desktop/sugar/font/default_face</applyto> |
| 222 | <owner>sugar</owner> |
| 223 | <type>string</type> |
| 224 | <default>Sans Serif</default> |
| 225 | <locale name="C"> |
| 226 | <short>Default font face</short> |
| 227 | <long>Font face that is used throughout the desktop.</long> |
| 228 | </locale> |
| 229 | </schema> |
| 230 | <schema> |
| 231 | <key>/schemas/desktop/sugar/font/default_size</key> |
| 232 | <applyto>/desktop/sugar/font/default_size</applyto> |
| 233 | <owner>sugar</owner> |
| 234 | <type>float</type> |
| 235 | <default>10</default> |
| 236 | <locale name="C"> |
| 237 | <short>Default font size</short> |
| 238 | <long>Font size that is used throughout the desktop.</long> |
| 239 | </locale> |
| 240 | </schema> |
| 241 | |
219 | 242 | |
220 | 243 | </schemalist> |
221 | 244 | </gconfschemafile> |