diff --git a/src/common/config.py b/src/common/config.py index ebbdc8ab8..39aed3d25 100644 --- a/src/common/config.py +++ b/src/common/config.py @@ -128,7 +128,7 @@ class Config: 'confirm_close_muc': [opt_bool, True], # confirm closing MUC window 'notify_on_file_complete': [opt_bool, True], # notif. on file complete 'file_transfers_port': [opt_int, 28011], # port, used for file transfers - 'conversation_font': [opt_str, 'Sans 10'], + 'conversation_font': [opt_str, ''], # IEC standard says KiB = 1024 bytes KB = 1000 bytes 'use_kib_mib': [opt_bool, False], 'notify_on_all_muc_messages': [opt_bool, False], diff --git a/src/config.py b/src/config.py index 9f0c3c6ef..386a50ed4 100644 --- a/src/config.py +++ b/src/config.py @@ -239,6 +239,12 @@ class PreferencesWindow: #Font for messages font = gajim.config.get('conversation_font') + # try to set default font for the current desktop env + if font == '': + font = gtkgui_helpers.get_default_font() + if font is None: + font = 'Sans 10' + gajim.config.set('conversation_font', font) self.xml.get_widget('conversation_fontbutton').set_font_name(font) # on new message diff --git a/src/gtkgui_helpers.py b/src/gtkgui_helpers.py index f0a8ab326..8199e692c 100644 --- a/src/gtkgui_helpers.py +++ b/src/gtkgui_helpers.py @@ -28,6 +28,16 @@ i18n.init() _ = i18n._ from common import gajim +def get_default_font(): + ''' Get the desktop setting for application font. + (Currently it works only for Gnome) ''' + try: + import gconf + client = gconf.client_get_default() + except: + return None + return client.get_string('/desktop/gnome/interface/font_name') + def reduce_chars_newlines(text, max_chars = 0, max_lines = 0, widget = None): ''' Cut the chars after 'max_chars' on each line