Thanks to HellPaso now we have default font

in xfce
This commit is contained in:
Dimitur Kirov 2005-08-12 00:33:48 +00:00
parent a2cccb8d25
commit c85fa3584b
1 changed files with 19 additions and 1 deletions

View File

@ -30,7 +30,25 @@ from common import gajim
def get_default_font(): def get_default_font():
''' Get the desktop setting for application font. ''' Get the desktop setting for application font.
(Currently it works only for Gnome) ''' (Currently it works only for Gnome and Xfce) '''
# try to get xfce default font
# Xfce 4.2 adopts freedesktop.org's Base Directory Specification
# see http://www.xfce.org/~benny/xfce/file-locations.html
# and http://freedesktop.org/Standards/basedir-spec
xdg_config_home = os.environ.get('XDG_CONFIG_HOME', '')
if xdg_config_home == '':
xdg_config_home = os.path.expanduser('~/.config') # default
xfce_config_file = os.path.join(xdg_config_home, 'xfce4/mcs_settings/gtk.xml')
if os.path.exists(xfce_config_file):
try:
for line in file(xfce_config_file):
if line.find('name="Gtk/FontName"') != -1:
start = line.find('value="') + 7
return line[start:line.find('"', start)]
except:
print _('error: cannot open %s for reading\n') % (xfce_config_file)
try: try:
import gconf import gconf
client = gconf.client_get_default() client = gconf.client_get_default()