Ticket #1584: 0001-Configure-fonts-through-GConf.patch

File 0001-Configure-fonts-through-GConf.patch, 2.8 KB (added by dsd, 14 years ago)

sugar patch

  • bin/sugar-session

    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(): 
    207207    if sys.modules.has_key('xklavier'):
    208208        gobject.idle_add(setup_keyboard_cb)
    209209
     210def 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
    210217def main():
    211218    cleanup_logs()
    212219    logger.start('shell')
    def main(): 
    219226    if timezone is not None and timezone:
    220227        os.environ['TZ'] = timezone
    221228
     229    set_fonts()
     230
    222231    intro.check_profile()
    223232
    224233    start_ui_service()
  • data/gtkrc.em

    diff --git a/data/gtkrc.em b/data/gtkrc.em
    index b9eeb7d..d4e1a7c 100644
    a b else: 
    66}@
    77gtk-theme-name = "sugar-@scaling"
    88gtk-icon-theme-name = "sugar"
    9 gtk-font-name = "Sans Serif 10"
    109gtk-cursor-theme-name = "sugar"
    1110gtk-toolbar-style = GTK_TOOLBAR_ICONS
    1211gtk-icon-sizes = "@icon_sizes"
  • data/sugar.schemas.in

    diff --git a/data/sugar.schemas.in b/data/sugar.schemas.in
    index 8c43930..48770de 100644
    a b  
    216216      </locale>
    217217    </schema>
    218218
     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
    219242
    220243  </schemalist>
    221244</gconfschemafile>