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()
|
self.check_relogin()
|
||||||
app.ged.remove_event_handler(
|
app.ged.remove_event_handler(
|
||||||
'our-show', ged.GUI2, self._nec_our_status)
|
'our-show', ged.GUI2, self._nec_our_status)
|
||||||
del app.interface.instances['accounts']
|
|
||||||
|
|
||||||
def on_child_visible(self, stack, *args):
|
def on_child_visible(self, stack, *args):
|
||||||
page = stack.get_visible_child_name()
|
page = stack.get_visible_child_name()
|
||||||
|
|
|
@ -22,7 +22,7 @@ from gajim.common.exceptions import GajimGeneralException
|
||||||
from gajim import config
|
from gajim import config
|
||||||
from gajim import dialogs
|
from gajim import dialogs
|
||||||
from gajim.gtk import shortcuts_window
|
from gajim.gtk import shortcuts_window
|
||||||
from gajim import accounts_window
|
from gajim.accounts_window import AccountsWindow
|
||||||
import gajim.plugins.gui
|
import gajim.plugins.gui
|
||||||
from gajim import disco
|
from gajim import disco
|
||||||
from gajim.gtk.history_sync import HistorySyncAssistant
|
from gajim.gtk.history_sync import HistorySyncAssistant
|
||||||
|
@ -66,10 +66,11 @@ def on_plugins(action, param):
|
||||||
|
|
||||||
|
|
||||||
def on_accounts(action, param):
|
def on_accounts(action, param):
|
||||||
if 'accounts' in app.interface.instances:
|
window = app.get_app_window(AccountsWindow)
|
||||||
app.interface.instances['accounts'].present()
|
if window is None:
|
||||||
|
AccountsWindow()
|
||||||
else:
|
else:
|
||||||
app.interface.instances['accounts'] = accounts_window.AccountsWindow()
|
window.present()
|
||||||
|
|
||||||
|
|
||||||
def on_history_manager(action, param):
|
def on_history_manager(action, param):
|
||||||
|
|
|
@ -104,9 +104,9 @@ class ManageProxiesWindow:
|
||||||
self.xml.get_object('proxytype_combobox').set_active(0)
|
self.xml.get_object('proxytype_combobox').set_active(0)
|
||||||
|
|
||||||
def on_manage_proxies_window_destroy(self, widget):
|
def on_manage_proxies_window_destroy(self, widget):
|
||||||
if 'accounts' in app.interface.instances:
|
window = app.get_app_window('AccountsWindow')
|
||||||
app.interface.instances['accounts'].\
|
if window is not None:
|
||||||
update_proxy_list()
|
window.update_proxy_list()
|
||||||
del app.interface.instances['manage_proxies']
|
del app.interface.instances['manage_proxies']
|
||||||
|
|
||||||
def on_add_proxy_button_clicked(self, widget):
|
def on_add_proxy_button_clicked(self, widget):
|
||||||
|
@ -691,8 +691,10 @@ class RemoveAccountWindow:
|
||||||
app.interface.roster.setup_and_draw_roster()
|
app.interface.roster.setup_and_draw_roster()
|
||||||
app.app.remove_account_actions(self.account)
|
app.app.remove_account_actions(self.account)
|
||||||
gui_menu_builder.build_accounts_menu()
|
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()
|
self.window.destroy()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -927,7 +927,7 @@ class SynchroniseSelectAccountDialog:
|
||||||
self.account = account
|
self.account = account
|
||||||
self.xml = gtkgui_helpers.get_gtk_builder('synchronise_select_account_dialog.ui')
|
self.xml = gtkgui_helpers.get_gtk_builder('synchronise_select_account_dialog.ui')
|
||||||
self.dialog = self.xml.get_object('synchronise_select_account_dialog')
|
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')
|
self.accounts_treeview = self.xml.get_object('accounts_treeview')
|
||||||
model = Gtk.ListStore(str, str, bool)
|
model = Gtk.ListStore(str, str, bool)
|
||||||
self.accounts_treeview.set_model(model)
|
self.accounts_treeview.set_model(model)
|
||||||
|
|
|
@ -482,11 +482,12 @@ class AccountCreationWizard:
|
||||||
|
|
||||||
def on_advanced_button_clicked(self, widget):
|
def on_advanced_button_clicked(self, widget):
|
||||||
from gajim.accounts_window import AccountsWindow
|
from gajim.accounts_window import AccountsWindow
|
||||||
if 'accounts' in app.interface.instances:
|
window = app.get_app_window(AccountsWindow)
|
||||||
app.interface.instances['accounts'].present()
|
if window is None:
|
||||||
|
window = AccountsWindow()
|
||||||
else:
|
else:
|
||||||
app.interface.instances['accounts'] = AccountsWindow()
|
window.present()
|
||||||
app.interface.instances['accounts'].select_account(self.account)
|
window.select_account(self.account)
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
def on_finish_button_clicked(self, widget):
|
def on_finish_button_clicked(self, widget):
|
||||||
|
@ -590,8 +591,9 @@ class AccountCreationWizard:
|
||||||
# action must be added before account window is updated
|
# action must be added before account window is updated
|
||||||
app.app.add_account_actions(self.account)
|
app.app.add_account_actions(self.account)
|
||||||
# refresh accounts window
|
# refresh accounts window
|
||||||
if 'accounts' in app.interface.instances:
|
window = app.get_app_window('AccountsWindow')
|
||||||
app.interface.instances['accounts'].add_account(self.account)
|
if window is not None:
|
||||||
|
window.add_account(self.account)
|
||||||
# refresh roster
|
# refresh roster
|
||||||
if len(app.connections) >= 2:
|
if len(app.connections) >= 2:
|
||||||
# Do not merge accounts if only one exists
|
# Do not merge accounts if only one exists
|
||||||
|
|
|
@ -49,7 +49,6 @@ from enum import IntEnum, unique
|
||||||
|
|
||||||
from gajim import dialogs
|
from gajim import dialogs
|
||||||
from gajim import vcard
|
from gajim import vcard
|
||||||
from gajim import config
|
|
||||||
from gajim import disco
|
from gajim import disco
|
||||||
from gajim import gtkgui_helpers
|
from gajim import gtkgui_helpers
|
||||||
from gajim import gui_menu_builder
|
from gajim import gui_menu_builder
|
||||||
|
@ -57,6 +56,7 @@ from gajim import cell_renderer_image
|
||||||
from gajim import tooltips
|
from gajim import tooltips
|
||||||
from gajim import message_control
|
from gajim import message_control
|
||||||
from gajim import adhoc_commands
|
from gajim import adhoc_commands
|
||||||
|
from gajim.accounts_window import AccountsWindow
|
||||||
from gajim.gtk import JoinGroupchatWindow
|
from gajim.gtk import JoinGroupchatWindow
|
||||||
from gajim.gtk import ConfirmationDialogCheck
|
from gajim.gtk import ConfirmationDialogCheck
|
||||||
from gajim.gtk import ConfirmationDialog
|
from gajim.gtk import ConfirmationDialog
|
||||||
|
@ -3163,11 +3163,12 @@ class RosterWindow:
|
||||||
self.remove_groupchat(jid, account, maximize=True)
|
self.remove_groupchat(jid, account, maximize=True)
|
||||||
|
|
||||||
def on_edit_account(self, widget, account):
|
def on_edit_account(self, widget, account):
|
||||||
if 'accounts' in app.interface.instances:
|
window = app.get_app_window(AccountsWindow)
|
||||||
app.interface.instances['accounts'].present()
|
if window is None:
|
||||||
|
window = AccountsWindow()
|
||||||
else:
|
else:
|
||||||
app.interface.instances['accounts'] = config.AccountsWindow()
|
window.present()
|
||||||
app.interface.instances['accounts'].select_account(account)
|
window.select_account(account)
|
||||||
|
|
||||||
def on_change_status_message_activate(self, widget, account):
|
def on_change_status_message_activate(self, widget, account):
|
||||||
show = app.SHOW_LIST[app.connections[account].connected]
|
show = app.SHOW_LIST[app.connections[account].connected]
|
||||||
|
|
Loading…
Reference in New Issue