set default font from the desktop default
application font setting (only Gnome for now)
This commit is contained in:
parent
0d68d8152a
commit
ead3e5557e
3 changed files with 17 additions and 1 deletions
|
@ -128,7 +128,7 @@ class Config:
|
||||||
'confirm_close_muc': [opt_bool, True], # confirm closing MUC window
|
'confirm_close_muc': [opt_bool, True], # confirm closing MUC window
|
||||||
'notify_on_file_complete': [opt_bool, True], # notif. on file complete
|
'notify_on_file_complete': [opt_bool, True], # notif. on file complete
|
||||||
'file_transfers_port': [opt_int, 28011], # port, used for file transfers
|
'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
|
# IEC standard says KiB = 1024 bytes KB = 1000 bytes
|
||||||
'use_kib_mib': [opt_bool, False],
|
'use_kib_mib': [opt_bool, False],
|
||||||
'notify_on_all_muc_messages': [opt_bool, False],
|
'notify_on_all_muc_messages': [opt_bool, False],
|
||||||
|
|
|
@ -239,6 +239,12 @@ class PreferencesWindow:
|
||||||
|
|
||||||
#Font for messages
|
#Font for messages
|
||||||
font = gajim.config.get('conversation_font')
|
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)
|
self.xml.get_widget('conversation_fontbutton').set_font_name(font)
|
||||||
|
|
||||||
# on new message
|
# on new message
|
||||||
|
|
|
@ -28,6 +28,16 @@ i18n.init()
|
||||||
_ = i18n._
|
_ = i18n._
|
||||||
from common import gajim
|
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,
|
def reduce_chars_newlines(text, max_chars = 0, max_lines = 0,
|
||||||
widget = None):
|
widget = None):
|
||||||
''' Cut the chars after 'max_chars' on each line
|
''' Cut the chars after 'max_chars' on each line
|
||||||
|
|
Loading…
Add table
Reference in a new issue