diff --git a/src/chat.py b/src/chat.py
index 0bf8d87de..4ad9ab0d0 100644
--- a/src/chat.py
+++ b/src/chat.py
@@ -72,6 +72,15 @@ class Chat:
# we check that on opening new windows
self.always_compact_view = gajim.config.get('always_compact_view')
+ def update_font(self):
+ font = pango.FontDescription(gajim.config.get('conversation_font'))
+ for jid in self.tagIn:
+ conversation_textview = self.xmls[jid].get_widget(
+ 'conversation_textview')
+ conversation_textview.modify_font(font)
+ message_textview = self.xmls[jid].get_widget('message_textview')
+ message_textview.modify_font(font)
+
def update_tags(self):
for jid in self.tagIn:
self.tagIn[jid].set_property('foreground',
@@ -456,6 +465,7 @@ class Chat:
self.nb_unread[jid] = 0
gajim.last_message_time[self.account][jid] = 0
self.last_time_printout[jid] = 0.
+ font = pango.FontDescription(gajim.config.get('conversation_font'))
if gajim.config.get('use_speller') and 'gtkspell' in globals():
message_textview = self.xmls[jid].get_widget('message_textview')
@@ -467,6 +477,7 @@ class Chat:
conversation_textview = self.xmls[jid].get_widget(
'conversation_textview')
+ conversation_textview.modify_font(font)
conversation_buffer = conversation_textview.get_buffer()
end_iter = conversation_buffer.get_end_iter()
@@ -543,6 +554,7 @@ class Chat:
self.notebook.append_page(child, tab_hbox)
message_textview = self.xmls[jid].get_widget('message_textview')
+ message_textview.modify_font(font)
message_textview.connect('size-request', self.size_request,
self.xmls[jid])
#init new sent history for this conversation
diff --git a/src/common/config.py b/src/common/config.py
index 822bfaff4..1bf412882 100644
--- a/src/common/config.py
+++ b/src/common/config.py
@@ -126,6 +126,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'],
}
__options_per_key = {
diff --git a/src/config.py b/src/config.py
index aec5298ba..05b37e48c 100644
--- a/src/config.py
+++ b/src/config.py
@@ -236,6 +236,10 @@ class PreferencesWindow:
self.xml.get_widget('status_msg_colorbutton').set_color(
gtk.gdk.color_parse(colSt))
+ #Font for messages
+ font = gajim.config.get('conversation_font')
+ self.xml.get_widget('conversation_fontbutton').set_font_name(font)
+
# on new message
only_in_roster = True
if gajim.config.get('notify_on_new_message'):
@@ -680,12 +684,24 @@ class PreferencesWindow:
def update_text_tags(self):
'''Update color tags in Opened Chat Windows'''
for a in gajim.connections:
- window = self.plugin.windows[a]['chats']
- if window.has_key('tabbed'):
- window['tabbed'].update_tags()
- else:
- for jid in window.keys():
- window[jid].update_tags()
+ for kind in ['chats', 'gc']:
+ windows = self.plugin.windows[a][kind]
+ if windows.has_key('tabbed'):
+ windows['tabbed'].update_tags()
+ else:
+ for jid in windows.keys():
+ windows[jid].update_tags()
+
+ def update_text_font(self):
+ '''Update text font in Opened Chat Windows'''
+ for a in gajim.connections:
+ for kind in ['chats', 'gc']:
+ windows = self.plugin.windows[a][kind]
+ if windows.has_key('tabbed'):
+ windows['tabbed'].update_font()
+ else:
+ for jid in windows.keys():
+ windows[jid].update_font()
def on_preference_widget_color_set(self, widget, text):
color = widget.get_color()
@@ -693,6 +709,12 @@ class PreferencesWindow:
gajim.config.set(text, color_string)
self.update_text_tags()
self.plugin.save_config()
+
+ def on_preference_widget_font_set(self, widget, text):
+ font = widget.get_font_name()
+ gajim.config.set(text, text)
+ self.update_text_font()
+ self.plugin.save_config()
def on_incoming_msg_colorbutton_color_set(self, widget):
self.on_preference_widget_color_set(widget, 'inmsgcolor')
@@ -703,6 +725,9 @@ class PreferencesWindow:
def on_status_msg_colorbutton_color_set(self, widget):
self.on_preference_widget_color_set(widget, 'statusmsgcolor')
+ def on_conversation_fontbutton_font_set(self, widget):
+ self.on_preference_widget_font_set(widget, 'conversation_font')
+
def on_reset_colors_button_clicked(self, widget):
for i in ['inmsgcolor', 'outmsgcolor', 'statusmsgcolor']:
gajim.config.set(i, self.plugin.default_values[i])
diff --git a/src/gtkgui.glade b/src/gtkgui.glade
index 74089da5b..3a2ce0997 100644
--- a/src/gtkgui.glade
+++ b/src/gtkgui.glade
@@ -3724,7 +3724,7 @@
True
- 4
+ 5
2
False
6
@@ -3930,6 +3930,51 @@
0
2
+ 4
+ 5
+ fill
+
+
+
+
+
+
+ True
+ Font:
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0.5
+ 0
+ 0
+
+
+ 0
+ 1
+ 3
+ 4
+ fill
+
+
+
+
+
+
+ True
+ True
+ True
+ True
+ False
+ False
+ True
+
+
+
+ 1
+ 2
3
4
fill