[elrodeo] font button for roster font in prefs window. see #2633
This commit is contained in:
parent
ea496bdace
commit
ee4e96c4ad
|
@ -309,6 +309,7 @@
|
|||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
|
@ -316,6 +317,59 @@
|
|||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox2901">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">12</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="font_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Roster Font:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="mnemonic_widget">roster_fontbutton</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkFontButton" id="roster_fontbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="show_style">True</property>
|
||||
<property name="show_size">True</property>
|
||||
<property name="use_font">False</property>
|
||||
<property name="use_size">False</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="font_set" handler="on_roster_fontbutton_font_set" last_modification_time="Sun, 07 Aug 2005 18:04:12 GMT"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
|
|
@ -162,6 +162,7 @@ class Config:
|
|||
'file_transfers_port': [opt_int, 28011],
|
||||
'ft_override_host_to_send': [opt_str, '', _('Overrides the host we send for File Transfer in case of address translation/port forwarding.')],
|
||||
'conversation_font': [opt_str, ''],
|
||||
'roster_font': [opt_str, ''],
|
||||
'use_kib_mib': [opt_bool, False, _('IEC standard says KiB = 1024 bytes, KB = 1000 bytes.')],
|
||||
'notify_on_all_muc_messages': [opt_bool, False],
|
||||
'trayicon_notification_on_new_messages': [opt_bool, True],
|
||||
|
|
|
@ -268,6 +268,16 @@ class PreferencesWindow:
|
|||
else:
|
||||
fontbutton.set_font_name(font)
|
||||
|
||||
#Font for roster
|
||||
roster_font = gajim.config.get('roster_font')
|
||||
# try to set default font for the current desktop env
|
||||
if roster_font == '':
|
||||
roster_font = gtkgui_helpers.get_default_font()
|
||||
if roster_font is None:
|
||||
roster_font = 'Sans 10'
|
||||
gajim.config.set('roster_font', roster_font)
|
||||
self.xml.get_widget('roster_fontbutton').set_font_name(roster_font)
|
||||
|
||||
# on new message
|
||||
only_in_roster = True
|
||||
if gajim.config.get('notify_on_new_message'):
|
||||
|
@ -737,19 +747,20 @@ class PreferencesWindow:
|
|||
self.update_text_tags()
|
||||
gajim.interface.save_config()
|
||||
|
||||
def on_preference_widget_font_set(self, widget, text):
|
||||
def on_preference_widget_font_set(self, widget, config_name):
|
||||
if widget:
|
||||
font = widget.get_font_name()
|
||||
else:
|
||||
font = ''
|
||||
gajim.config.set(text, font)
|
||||
gajim.config.set(config_name, font)
|
||||
self.update_text_font()
|
||||
gajim.interface.save_config()
|
||||
|
||||
def update_text_font(self):
|
||||
'''Update text font in Opened Chat Windows'''
|
||||
'''Update text font in Opened Chat Windows and in roster'''
|
||||
for win in gajim.interface.msg_win_mgr.windows():
|
||||
win.update_font()
|
||||
gajim.interface.roster.update_font()
|
||||
|
||||
def on_incoming_msg_colorbutton_color_set(self, widget):
|
||||
self.on_preference_widget_color_set(widget, 'inmsgcolor')
|
||||
|
@ -775,6 +786,9 @@ class PreferencesWindow:
|
|||
font_widget.set_sensitive(True)
|
||||
self.on_preference_widget_font_set(font_widget, 'conversation_font')
|
||||
|
||||
def on_roster_fontbutton_font_set(self, widget):
|
||||
self.on_preference_widget_font_set(widget, 'roster_font')
|
||||
|
||||
def on_reset_colors_button_clicked(self, widget):
|
||||
for i in ('inmsgcolor', 'outmsgcolor', 'statusmsgcolor', 'urlmsgcolor'):
|
||||
gajim.config.set(i, gajim.interface.default_values[i])
|
||||
|
|
|
@ -21,6 +21,7 @@ import os
|
|||
import sys
|
||||
import time
|
||||
import urllib
|
||||
import pango
|
||||
|
||||
import common.sleepy
|
||||
import history_window
|
||||
|
@ -1048,6 +1049,11 @@ class RosterWindow:
|
|||
if ctrl.type_id == message_control.TYPE_GC:
|
||||
ctrl.update_ui()
|
||||
|
||||
def update_font(self):
|
||||
'''update the font used inthe roster'''
|
||||
font = pango.FontDescription(gajim.config.get('roster_font'))
|
||||
self.tree.modify_font(font)
|
||||
|
||||
def draw_roster(self):
|
||||
'''clear and draw roster'''
|
||||
# clear the model, only if it is not empty
|
||||
|
@ -4160,6 +4166,7 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
|
|||
|
||||
self.collapsed_rows = gajim.config.get('collapsed_rows').split('\t')
|
||||
self.tooltip = tooltips.RosterTooltip()
|
||||
self.update_font()
|
||||
self.draw_roster()
|
||||
|
||||
## Music Track notifications
|
||||
|
|
Loading…
Reference in New Issue