Dont use dict to keep track of window instances
GtkApplication maintains a store for all active ApplicationWindows, we dont need to replicate that.
This commit is contained in:
parent
71586e01d2
commit
f699df9bd6
|
@ -75,7 +75,6 @@ class AccountsWindow(Gtk.ApplicationWindow):
|
|||
self.check_relogin()
|
||||
app.ged.remove_event_handler(
|
||||
'our-show', ged.GUI2, self._nec_our_status)
|
||||
del app.interface.instances['accounts']
|
||||
|
||||
def on_child_visible(self, stack, *args):
|
||||
page = stack.get_visible_child_name()
|
||||
|
|
|
@ -22,7 +22,7 @@ from gajim.common.exceptions import GajimGeneralException
|
|||
from gajim import config
|
||||
from gajim import dialogs
|
||||
from gajim.gtk import shortcuts_window
|
||||
from gajim import accounts_window
|
||||
from gajim.accounts_window import AccountsWindow
|
||||
import gajim.plugins.gui
|
||||
from gajim import disco
|
||||
from gajim.gtk.history_sync import HistorySyncAssistant
|
||||
|
@ -66,10 +66,11 @@ def on_plugins(action, param):
|
|||
|
||||
|
||||
def on_accounts(action, param):
|
||||
if 'accounts' in app.interface.instances:
|
||||
app.interface.instances['accounts'].present()
|
||||
window = app.get_app_window(AccountsWindow)
|
||||
if window is None:
|
||||
AccountsWindow()
|
||||
else:
|
||||
app.interface.instances['accounts'] = accounts_window.AccountsWindow()
|
||||
window.present()
|
||||
|
||||
|
||||
def on_history_manager(action, param):
|
||||
|
|
|
@ -104,9 +104,9 @@ class ManageProxiesWindow:
|
|||
self.xml.get_object('proxytype_combobox').set_active(0)
|
||||
|
||||
def on_manage_proxies_window_destroy(self, widget):
|
||||
if 'accounts' in app.interface.instances:
|
||||
app.interface.instances['accounts'].\
|
||||
update_proxy_list()
|
||||
window = app.get_app_window('AccountsWindow')
|
||||
if window is not None:
|
||||
window.update_proxy_list()
|
||||
del app.interface.instances['manage_proxies']
|
||||
|
||||
def on_add_proxy_button_clicked(self, widget):
|
||||
|
@ -691,8 +691,10 @@ class RemoveAccountWindow:
|
|||
app.interface.roster.setup_and_draw_roster()
|
||||
app.app.remove_account_actions(self.account)
|
||||
gui_menu_builder.build_accounts_menu()
|
||||
if 'accounts' in app.interface.instances:
|
||||
app.interface.instances['accounts'].remove_account(self.account)
|
||||
|
||||
window = app.get_app_window('AccountsWindow')
|
||||
if window is not None:
|
||||
window.remove_account(self.account)
|
||||
self.window.destroy()
|
||||
|
||||
|
||||
|
|
|
@ -927,7 +927,7 @@ class SynchroniseSelectAccountDialog:
|
|||
self.account = account
|
||||
self.xml = gtkgui_helpers.get_gtk_builder('synchronise_select_account_dialog.ui')
|
||||
self.dialog = self.xml.get_object('synchronise_select_account_dialog')
|
||||
self.dialog.set_transient_for(app.interface.instances['accounts'])
|
||||
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)
|
||||
|
|
|
@ -482,11 +482,12 @@ class AccountCreationWizard:
|
|||
|
||||
def on_advanced_button_clicked(self, widget):
|
||||
from gajim.accounts_window import AccountsWindow
|
||||
if 'accounts' in app.interface.instances:
|
||||
app.interface.instances['accounts'].present()
|
||||
window = app.get_app_window(AccountsWindow)
|
||||
if window is None:
|
||||
window = AccountsWindow()
|
||||
else:
|
||||
app.interface.instances['accounts'] = AccountsWindow()
|
||||
app.interface.instances['accounts'].select_account(self.account)
|
||||
window.present()
|
||||
window.select_account(self.account)
|
||||
self.window.destroy()
|
||||
|
||||
def on_finish_button_clicked(self, widget):
|
||||
|
@ -590,8 +591,9 @@ class AccountCreationWizard:
|
|||
# action must be added before account window is updated
|
||||
app.app.add_account_actions(self.account)
|
||||
# refresh accounts window
|
||||
if 'accounts' in app.interface.instances:
|
||||
app.interface.instances['accounts'].add_account(self.account)
|
||||
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
|
||||
|
|
|
@ -49,7 +49,6 @@ from enum import IntEnum, unique
|
|||
|
||||
from gajim import dialogs
|
||||
from gajim import vcard
|
||||
from gajim import config
|
||||
from gajim import disco
|
||||
from gajim import gtkgui_helpers
|
||||
from gajim import gui_menu_builder
|
||||
|
@ -57,6 +56,7 @@ from gajim import cell_renderer_image
|
|||
from gajim import tooltips
|
||||
from gajim import message_control
|
||||
from gajim import adhoc_commands
|
||||
from gajim.accounts_window import AccountsWindow
|
||||
from gajim.gtk import JoinGroupchatWindow
|
||||
from gajim.gtk import ConfirmationDialogCheck
|
||||
from gajim.gtk import ConfirmationDialog
|
||||
|
@ -3163,11 +3163,12 @@ class RosterWindow:
|
|||
self.remove_groupchat(jid, account, maximize=True)
|
||||
|
||||
def on_edit_account(self, widget, account):
|
||||
if 'accounts' in app.interface.instances:
|
||||
app.interface.instances['accounts'].present()
|
||||
window = app.get_app_window(AccountsWindow)
|
||||
if window is None:
|
||||
window = AccountsWindow()
|
||||
else:
|
||||
app.interface.instances['accounts'] = config.AccountsWindow()
|
||||
app.interface.instances['accounts'].select_account(account)
|
||||
window.present()
|
||||
window.select_account(account)
|
||||
|
||||
def on_change_status_message_activate(self, widget, account):
|
||||
show = app.SHOW_LIST[app.connections[account].connected]
|
||||
|
|
Loading…
Reference in New Issue