def _on_destroy(*args): # Window callbacks for updating proxy comboboxes window_pref = get_app_window('Preferences') window_accounts = get_app_window('AccountsWindow') if window_pref is not None: window_pref.update_proxy_list() if window_accounts is not None: window_accounts.update_proxy_list()
def on_browse_history(_action, param): jid, account = None, None if param is not None: dict_ = param.unpack() jid = dict_.get('jid') account = dict_.get('account') window = get_app_window(HistoryWindow) if window is None: HistoryWindow(jid, account) else: window.present() if jid is not None and account is not None: window.open_history(jid, account)
def create_vars(self, config): app.config.add_per('accounts', self.account) config['account_label'] = '%s@%s' % (config['name'], config['hostname']) if not config['savepass']: config['password'] = '' for opt in config: app.config.set_per('accounts', self.account, opt, config[opt]) # update variables app.interface.instances[self.account] = { 'infos': {}, 'disco': {}, 'gc_config': {}, 'search': {}, 'online_dialog': {}, 'sub_request': {}} app.interface.minimized_controls[self.account] = {} app.connections[self.account].connected = 0 app.groups[self.account] = {} app.contacts.add_account(self.account) app.gc_connected[self.account] = {} app.automatic_rooms[self.account] = {} app.newly_added[self.account] = [] app.to_be_removed[self.account] = [] app.nicks[self.account] = config['name'] app.block_signed_in_notifications[self.account] = True app.sleeper_state[self.account] = 'off' app.last_message_time[self.account] = {} app.status_before_autoaway[self.account] = '' app.gajim_optional_features[self.account] = [] app.caps_hash[self.account] = '' helpers.update_optional_features(self.account) # action must be added before account window is updated app.app.add_account_actions(self.account) # refresh accounts window window = get_app_window('AccountsWindow') if window is not None: window.add_account(self.account) # refresh roster if len(app.connections) >= 2: # Do not merge accounts if only one exists app.interface.roster.regroup = app.config.get('mergeaccounts') else: app.interface.roster.regroup = False app.interface.roster.setup_and_draw_roster() gui_menu_builder.build_accounts_menu()
def _on_window_focus(self, widget, event): # on destroy() the window that was last focused gets the focus # again. if destroy() is called from the StartChat Dialog, this # Window is not yet focused, because present() seems to be asynchron # at least on KDE, and takes time. start_chat = get_app_window('StartChatDialog') if start_chat is not None and start_chat.ready_to_destroy: start_chat.destroy() # window received focus, so if we had urgency REMOVE IT # NOTE: we do not have to read the message (it maybe in a bg tab) # to remove urgency hint so this functions does that set_urgency_hint(self.window, False) ctrl = self.get_active_control() if ctrl: ctrl.set_control_active(True) # Undo "unread" state display, etc. if ctrl.is_groupchat: self.redraw_tab(ctrl, 'active') else: # NOTE: we do not send any chatstate to preserve # inactive, gone, etc. self.redraw_tab(ctrl)
def _on_destroy(*args): window = get_app_window('Preferences') if window is not None: window.sounds_preferences = None