def _on_destroy(self, *args): # Window callbacks for updating proxy comboboxes window_pref = app.get_app_window('Preferences') window_accounts = app.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_groupchat_join(_action, param): account, jid = param.get_strv() window = app.get_app_window(GroupchatJoin, account=account, jid=jid) if window is None: GroupchatJoin(account, jid) else: window.present()
def __init__(self, account): # 'account' can be None if we are about to create our first one if not account or app.connections[account].connected < 2: ErrorDialog( _('You are not connected to the server'), _('Without a connection, you can not synchronise your contacts.' )) raise GajimGeneralException('You are not connected to the server') self.account = account self.xml = get_builder('synchronise_select_account_dialog.ui') self.dialog = self.xml.get_object('synchronise_select_account_dialog') self.dialog.set_transient_for(app.get_app_window('AccountsWindow')) self.accounts_treeview = self.xml.get_object('accounts_treeview') model = Gtk.ListStore(str, str, bool) self.accounts_treeview.set_model(model) # columns renderer = Gtk.CellRendererText() self.accounts_treeview.insert_column_with_attributes(-1, _('Name'), renderer, text=0) renderer = Gtk.CellRendererText() self.accounts_treeview.insert_column_with_attributes(-1, _('Server'), renderer, text=1) self.xml.connect_signals(self) self.init_accounts() self.dialog.show_all()
def on_xml_console(action, param): account = param.get_string() window = app.get_app_window(XMLConsoleWindow, account) if window is None: XMLConsoleWindow(account) else: window.present()
def on_history_sync(action, param): account = param.get_string() window = app.get_app_window(HistorySyncAssistant, account) if window is None: HistorySyncAssistant(account, interface.roster.window) else: window.present()
def on_blocking_list(action, param): account = param.get_string() window = app.get_app_window(MamPreferences, account) if window is None: BlockingList(account) else: window.present()
def on_mam_preferences(action, param): account = param.get_string() window = app.get_app_window(MamPreferences, account) if window is None: MamPreferences(account) else: window.present()
def on_preferences_menuitem_activate(self, widget): from gajim.gtk.preferences import Preferences window = app.get_app_window(Preferences) if window is None: Preferences() else: window.present()
def on_add_contact(_action, param): account, jid = param.get_strv() if not jid: jid = None window = app.get_app_window(AddNewContactWindow, account) if window is None: AddNewContactWindow(account, jid) else: window.present()
def on_advanced_button_clicked(self, widget): from gajim.accounts_window import AccountsWindow window = app.get_app_window(AccountsWindow) if window is None: window = AccountsWindow() else: window.present() window.select_account(self.account) self.window.destroy()
def on_new_chat(_action, param): search_text = param.get_string() window = app.get_app_window(StartChatDialog) if window is None: window = StartChatDialog() else: window.present() if search_text: window.set_search_text(search_text)
def on_accounts(action, param): window = app.get_app_window(AccountsWindow) if window is None: window = AccountsWindow() else: window.present() account = param.get_string() if account: window.select_account(account)
def _on_remove_success(self, res): # action of unregistration has failed, we don't remove the account # Error message is send by connect_and_auth() if not res: ConfirmationDialogDoubleRadio( _('Connection to server %s failed') % self.account, _('What would you like to do?'), _('Remove only from Gajim'), _('Don\'t remove anything. I\'ll try again later'), on_response_ok=self.on_remove_response_ok, is_modal=False, transient_for=self._ui.remove_account_window) return # Close all opened windows app.interface.roster.close_all(self.account, force=True) if self.account in app.connections: app.connections[self.account].disconnect(reconnect=False) app.connections[self.account].cleanup() del app.connections[self.account] app.logger.remove_roster(app.get_jid_from_account(self.account)) # Delete password must be before del_per() because it calls set_per() # which would recreate the account with defaults values if not found passwords.delete_password(self.account) app.config.del_per('accounts', self.account) del app.interface.instances[self.account] if self.account in app.nicks: del app.interface.minimized_controls[self.account] del app.nicks[self.account] del app.block_signed_in_notifications[self.account] del app.groups[self.account] app.contacts.remove_account(self.account) del app.gc_connected[self.account] del app.automatic_rooms[self.account] del app.to_be_removed[self.account] del app.newly_added[self.account] del app.sleeper_state[self.account] del app.last_message_time[self.account] del app.status_before_autoaway[self.account] del app.gajim_optional_features[self.account] del app.caps_hash[self.account] 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() app.app.remove_account_actions(self.account) gui_menu_builder.build_accounts_menu() window = app.get_app_window('AccountsWindow') if window is not None: window.remove_account(self.account) self._ui.remove_account_window.destroy()
def on_join_gc(action, param): account = None if param is None: if not app.get_connected_accounts(): return else: account = param.get_string() window = app.get_app_window(JoinGroupchatWindow) if window is None: JoinGroupchatWindow(account, None) else: window.present()
def create_vars(self, config): app.config.add_per('accounts', self.account) 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.connections[self.account].keepalives = app.config.get_per( 'accounts', self.account, 'keep_alive_every_foo_secs') 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.encrypted_chats[self.account] = [] app.last_message_time[self.account] = {} app.status_before_autoaway[self.account] = '' app.transport_avatar[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 = app.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_join_gc(_action, param): account, jid = None, None if param is None: if not app.get_connected_accounts(): return else: account, jid = param.get_strv() if not jid: jid = None window = app.get_app_window(JoinGroupchatWindow) if window is None: JoinGroupchatWindow(account, jid) else: window.present()
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 = app.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 _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 = app.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.type_id == message_control.TYPE_GC: self.redraw_tab(ctrl, 'active') else: # NOTE: we do not send any chatstate to preserve # inactive, gone, etc. self.redraw_tab(ctrl)
def on_preferences(action, param): window = app.get_app_window(Preferences) if window is None: Preferences() else: window.present()
def on_accounts(action, param): window = app.get_app_window(AccountsWindow) if window is None: AccountsWindow() else: window.present()
def on_manage_proxies_button_clicked(self, _widget): window = app.get_app_window(ManageProxies) if window is None: ManageProxies() else: window.present()
def _on_destroy(self, *args): self.window.destroy() window = app.get_app_window('Preferences') if window is not None: window.sounds_preferences = None
def on_manage_proxies_window_destroy(self, widget): window = app.get_app_window('AccountsWindow') if window is not None: window.update_proxy_list() del app.interface.instances['manage_proxies']
def _on_destroy(*args): window = app.get_app_window('Preferences') if window is not None: window.update_theme_list()
def on_manage_theme_button_clicked(self, widget): window = app.get_app_window(Themes) if window is None: Themes(self) else: window.present()
def on_open_advanced_editor_button_clicked(self, _widget): window = app.get_app_window(AdvancedConfig) if window is None: AdvancedConfig() else: window.present()
def on_create_gc(_action, param): window = app.get_app_window(CreateGroupchatWindow) if window is None: CreateGroupchatWindow(param.get_string() or None) else: window.present()
def on_manage_proxies(action, param): window = app.get_app_window(ManageProxies) if window is None: ManageProxies() else: window.present()
def on_add_contact(action, param): window = app.get_app_window(AddNewContactWindow) if window is None: AddNewContactWindow(param.get_string()) else: window.present()