Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def on_preference_widget_font_set(self, widget, text):
if widget:
font = widget.get_font_name()
else:
font = ''
gajim.config.set(text, font)
self.update_text_font()
gajim.interface.save_config()
self.xml.get_widget('custom_apps_frame').hide()
elif widget.get_active() == 1:
self.xml.get_widget('custom_apps_frame').hide()
gajim.config.set('openwith', 'open')
elif widget.get_active() == 2:
self.xml.get_widget('custom_apps_frame').show()
gajim.config.set('openwith', 'custom')
else:
if widget.get_active() == 4:
self.xml.get_widget('custom_apps_frame').show()
gajim.config.set('openwith', 'custom')
else:
if widget.get_active() == 0:
gajim.config.set('autodetect_browser_mailer', True)
elif widget.get_active() == 1:
gajim.config.set('openwith', 'gnome-open')
elif widget.get_active() == 2:
gajim.config.set('openwith', 'kfmclient exec')
elif widget.get_active() == 3:
gajim.config.set('openwith', 'exo-open')
self.xml.get_widget('custom_apps_frame').hide()
gajim.interface.save_config()
def on_preference_widget_color_set(self, widget, text):
color = widget.get_color()
color_string = gtkgui_helpers.make_color_string(color)
gajim.config.set(text, color_string)
self.update_text_tags()
gajim.interface.save_config()
def deactivate(self):
gajim.config.set('chat_avatar_height', self.config['old_chat_avatar_height'])
if len(self.xmls) == 1: # only one tab when we asked to remove
# so destroy window
# we check and possibly save positions here, because Ctrl+W, Escape
# etc.. call remove_tab so similar code in delete_event callbacks
# is not enough
if gajim.config.get('saveposition'):
if kind == 'chats':
x, y = self.window.get_position()
gajim.config.set('chat-x-position', x)
gajim.config.set('chat-y-position', y)
width, height = self.window.get_size()
gajim.config.set('chat-width', width)
gajim.config.set('chat-height', height)
elif kind == 'gc':
gajim.config.set('gc-hpaned-position', self.hpaned_position)
x, y = self.window.get_position()
gajim.config.set('gc-x-position', x)
gajim.config.set('gc-y-position', y)
width, height = self.window.get_size()
gajim.config.set('gc-width', width)
gajim.config.set('gc-height', height)
self.window.destroy()
else:
if self.nb_unread[jid] > 0:
self.nb_unread[jid] = 0
if gajim.interface.systray_enabled:
gajim.interface.systray.remove_jid(jid, self.account,
self.get_message_type(jid))
if self.print_time_timeout_id.has_key(jid):
gobject.source_remove(self.print_time_timeout_id[jid])
def save_pos(self):
if gajim.config.get('saveposition'):
# save the window size and position
x, y = self.window.get_position()
gajim.config.set('single-msg-x-position', x)
gajim.config.set('single-msg-y-position', y)
width, height = self.window.get_size()
gajim.config.set('single-msg-width', width)
gajim.config.set('single-msg-height', height)
gajim.interface.save_config()
self.update_config_to_01114()
if old < [0, 11, 1, 5] and new >= [0, 11, 1, 5]:
self.update_config_to_01115()
if old < [0, 11, 2, 1] and new >= [0, 11, 2, 1]:
self.update_config_to_01121()
if old < [0, 11, 4, 1] and new >= [0, 11, 4, 1]:
self.update_config_to_01141()
if old < [0, 11, 4, 2] and new >= [0, 11, 4, 2]:
self.update_config_to_01142()
if old < [0, 11, 4, 3] and new >= [0, 11, 4, 3]:
self.update_config_to_01143()
if old < [0, 11, 4, 4] and new >= [0, 11, 4, 4]:
self.update_config_to_01144()
gajim.logger.init_vars()
gajim.config.set('version', new_version)
gajim.capscache.load_from_db()
def on_preference_widget_color_set(self, widget, text):
color = widget.get_color()
color_string = gtkgui_helpers.make_color_string(color)
gajim.config.set(text, color_string)
self.update_text_tags()
gajim.interface.save_config()
def on_preference_widget_font_set(self, widget, text):
if widget:
font = widget.get_font_name()
else:
font = ''
gajim.config.set(text, font)
self.update_text_font()
gajim.interface.save_config()
def on_displayed_chat_states_combobox_changed(self, widget):
active = widget.get_active()
if active == 0: # all
gajim.config.set('displayed_chat_state_notifications', 'all')
elif active == 1: # only composing
gajim.config.set('displayed_chat_state_notifications',
'composing_only')
else: # disabled
gajim.config.set('displayed_chat_state_notifications', 'disabled')