apply config to minimized controls too. Fixes #5515

This commit is contained in:
Yann Leboulanger 2009-12-28 22:41:05 +01:00
parent 1188713660
commit e6b4382aaf
2 changed files with 35 additions and 40 deletions

View File

@ -382,7 +382,8 @@ class PreferencesWindow:
# Default Status messages
self.default_msg_tree = self.xml.get_widget('default_msg_treeview')
col2 = self.default_msg_tree.rc_get_style().bg[gtk.STATE_ACTIVE].to_string()
col2 = self.default_msg_tree.rc_get_style().bg[gtk.STATE_ACTIVE].\
to_string()
# (status, translated_status, message, enabled)
model = gtk.ListStore(str, str, str, bool)
self.default_msg_tree.set_model(model)
@ -576,37 +577,43 @@ class PreferencesWindow:
w.set_sensitive(widget.get_active())
gajim.interface.save_config()
def _get_all_controls(self):
for ctrl in gajim.interface.msg_win_mgr.get_controls():
yield ctrl
for account in gajim.connections:
for ctrl in gajim.interface.minimized_controls[account].values():
yield ctrl
def _get_all_muc_controls(self):
for ctrl in gajim.interface.msg_win_mgr.get_controls(
message_control.TYPE_GC):
yield ctrl
for account in gajim.connections:
for ctrl in gajim.interface.minimized_controls[account].values():
yield ctrl
def on_sort_by_show_in_roster_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'sort_by_show_in_roster')
gajim.interface.roster.setup_and_draw_roster()
def on_sort_by_show_in_muc_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'sort_by_show_in_muc')
# Redraw connected groupchats
for account in gajim.connections:
if gajim.connections[account].connected:
for gc_control in gajim.interface.msg_win_mgr.get_controls(
message_control.TYPE_GC) + \
gajim.interface.minimized_controls[account].values():
gc_control.draw_roster()
# Redraw groupchats
for ctrl in self._get_all_muc_controls():
ctrl.draw_roster()
def on_show_avatars_in_roster_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'show_avatars_in_roster')
gajim.interface.roster.setup_and_draw_roster()
# Redraw connected groupchats (in an ugly way)
for account in gajim.connections:
if gajim.connections[account].connected:
for gc_control in gajim.interface.msg_win_mgr.get_controls(
message_control.TYPE_GC) + \
gajim.interface.minimized_controls[account].values():
gc_control.draw_roster()
# Redraw groupchats (in an ugly way)
for ctrl in self._get_all_muc_controls():
ctrl.draw_roster()
def on_show_status_msgs_in_roster_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'show_status_msgs_in_roster')
gajim.interface.roster.setup_and_draw_roster()
for ctl in gajim.interface.msg_win_mgr.controls():
if ctl.type_id == message_control.TYPE_GC:
ctl.update_ui()
for ctrl in self._get_all_muc_controls():
ctrl.update_ui()
def on_show_mood_in_roster_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'show_mood_in_roster')
@ -641,8 +648,8 @@ class PreferencesWindow:
"""
Update emoticons state in Opened Chat Windows
"""
for win in gajim.interface.msg_win_mgr.windows():
win.toggle_emoticons()
for ctrl in self._get_all_controls():
ctrl.toggle_emoticons()
def on_one_window_type_combo_changed(self, widget):
active = widget.get_active()
@ -653,8 +660,8 @@ class PreferencesWindow:
def on_compact_view_checkbutton_toggled(self, widget):
active = widget.get_active()
for ctl in gajim.interface.msg_win_mgr.controls():
ctl.chat_buttons_set_visible(active)
for ctrl in self._get_all_controls():
ctrl.chat_buttons_set_visible(active)
gajim.config.set('compact_view', active)
gajim.interface.save_config()
@ -663,7 +670,7 @@ class PreferencesWindow:
helpers.update_optional_features()
def apply_speller(self):
for ctrl in gajim.interface.msg_win_mgr.controls():
for ctrl in self._get_all_controls():
if isinstance(ctrl, chat_control.ChatControlBase):
try:
spell_obj = gtkspell.get_from_text_view(ctrl.msg_textview)
@ -674,7 +681,7 @@ class PreferencesWindow:
ctrl.set_speller()
def remove_speller(self):
for ctrl in gajim.interface.msg_win_mgr.controls():
for ctrl in self._get_all_controls():
if isinstance(ctrl, chat_control.ChatControlBase):
try:
spell_obj = gtkspell.get_from_text_view(ctrl.msg_textview)
@ -837,8 +844,8 @@ class PreferencesWindow:
"""
Update color tags in opened chat windows
"""
for win in gajim.interface.msg_win_mgr.windows():
win.update_tags()
for ctrl in self._get_all_controls():
ctrl.update_tags()
def on_preference_widget_color_set(self, widget, text):
color = widget.get_color()
@ -860,8 +867,8 @@ class PreferencesWindow:
"""
Update text font in opened chat windows
"""
for win in gajim.interface.msg_win_mgr.windows():
win.update_font()
for ctrl in self._get_all_controls():
ctrl.update_font()
def on_incoming_nick_colorbutton_color_set(self, widget):
self.on_preference_widget_color_set(widget, 'inmsgcolor')

View File

@ -661,18 +661,6 @@ class MessageWindow(object):
def get_origin(self):
return self.window.window.get_origin()
def toggle_emoticons(self):
for ctrl in self.controls():
ctrl.toggle_emoticons()
def update_font(self):
for ctrl in self.controls():
ctrl.update_font()
def update_tags(self):
for ctrl in self.controls():
ctrl.update_tags()
def get_control(self, key, acct):
"""
Return the MessageControl for jid or n, where n is a notebook page index.