Philipp Hörist pushed to branch master at gajim / gajim

Commits:

6 changed files:

Changes:

  • gajim/accounts_window.py
    ... ... @@ -75,7 +75,6 @@ class AccountsWindow(Gtk.ApplicationWindow):
    75 75
             self.check_relogin()
    
    76 76
             app.ged.remove_event_handler(
    
    77 77
                 'our-show', ged.GUI2, self._nec_our_status)
    
    78
    -        del app.interface.instances['accounts']
    
    79 78
     
    
    80 79
         def on_child_visible(self, stack, *args):
    
    81 80
             page = stack.get_visible_child_name()
    

  • gajim/app_actions.py
    ... ... @@ -22,7 +22,7 @@ from gajim.common.exceptions import GajimGeneralException
    22 22
     from gajim import config
    
    23 23
     from gajim import dialogs
    
    24 24
     from gajim.gtk import shortcuts_window
    
    25
    -from gajim import accounts_window
    
    25
    +from gajim.accounts_window import AccountsWindow
    
    26 26
     import gajim.plugins.gui
    
    27 27
     from gajim import disco
    
    28 28
     from gajim.gtk.history_sync import HistorySyncAssistant
    
    ... ... @@ -66,10 +66,11 @@ def on_plugins(action, param):
    66 66
     
    
    67 67
     
    
    68 68
     def on_accounts(action, param):
    
    69
    -    if 'accounts' in app.interface.instances:
    
    70
    -        app.interface.instances['accounts'].present()
    
    69
    +    window = app.get_app_window(AccountsWindow)
    
    70
    +    if window is None:
    
    71
    +        AccountsWindow()
    
    71 72
         else:
    
    72
    -        app.interface.instances['accounts'] = accounts_window.AccountsWindow()
    
    73
    +        window.present()
    
    73 74
     
    
    74 75
     
    
    75 76
     def on_history_manager(action, param):
    

  • gajim/config.py
    ... ... @@ -104,9 +104,9 @@ class ManageProxiesWindow:
    104 104
             self.xml.get_object('proxytype_combobox').set_active(0)
    
    105 105
     
    
    106 106
         def on_manage_proxies_window_destroy(self, widget):
    
    107
    -        if 'accounts' in app.interface.instances:
    
    108
    -            app.interface.instances['accounts'].\
    
    109
    -                    update_proxy_list()
    
    107
    +        window = app.get_app_window('AccountsWindow')
    
    108
    +        if window is not None:
    
    109
    +            window.update_proxy_list()
    
    110 110
             del app.interface.instances['manage_proxies']
    
    111 111
     
    
    112 112
         def on_add_proxy_button_clicked(self, widget):
    
    ... ... @@ -691,8 +691,10 @@ class RemoveAccountWindow:
    691 691
             app.interface.roster.setup_and_draw_roster()
    
    692 692
             app.app.remove_account_actions(self.account)
    
    693 693
             gui_menu_builder.build_accounts_menu()
    
    694
    -        if 'accounts' in app.interface.instances:
    
    695
    -            app.interface.instances['accounts'].remove_account(self.account)
    
    694
    +
    
    695
    +        window = app.get_app_window('AccountsWindow')
    
    696
    +        if window is not None:
    
    697
    +            window.remove_account(self.account)
    
    696 698
             self.window.destroy()
    
    697 699
     
    
    698 700
     
    

  • gajim/dialogs.py
    ... ... @@ -927,7 +927,7 @@ class SynchroniseSelectAccountDialog:
    927 927
             self.account = account
    
    928 928
             self.xml = gtkgui_helpers.get_gtk_builder('synchronise_select_account_dialog.ui')
    
    929 929
             self.dialog = self.xml.get_object('synchronise_select_account_dialog')
    
    930
    -        self.dialog.set_transient_for(app.interface.instances['accounts'])
    
    930
    +        self.dialog.set_transient_for(app.get_app_window('AccountsWindow'))
    
    931 931
             self.accounts_treeview = self.xml.get_object('accounts_treeview')
    
    932 932
             model = Gtk.ListStore(str, str, bool)
    
    933 933
             self.accounts_treeview.set_model(model)
    

  • gajim/gtk/account_wizard.py
    ... ... @@ -482,11 +482,12 @@ class AccountCreationWizard:
    482 482
     
    
    483 483
         def on_advanced_button_clicked(self, widget):
    
    484 484
             from gajim.accounts_window import AccountsWindow
    
    485
    -        if 'accounts' in app.interface.instances:
    
    486
    -            app.interface.instances['accounts'].present()
    
    485
    +        window = app.get_app_window(AccountsWindow)
    
    486
    +        if window is None:
    
    487
    +            window = AccountsWindow()
    
    487 488
             else:
    
    488
    -            app.interface.instances['accounts'] = AccountsWindow()
    
    489
    -        app.interface.instances['accounts'].select_account(self.account)
    
    489
    +            window.present()
    
    490
    +        window.select_account(self.account)
    
    490 491
             self.window.destroy()
    
    491 492
     
    
    492 493
         def on_finish_button_clicked(self, widget):
    
    ... ... @@ -590,8 +591,9 @@ class AccountCreationWizard:
    590 591
             # action must be added before account window is updated
    
    591 592
             app.app.add_account_actions(self.account)
    
    592 593
             # refresh accounts window
    
    593
    -        if 'accounts' in app.interface.instances:
    
    594
    -            app.interface.instances['accounts'].add_account(self.account)
    
    594
    +        window = app.get_app_window('AccountsWindow')
    
    595
    +        if window is not None:
    
    596
    +            window.add_account(self.account)
    
    595 597
             # refresh roster
    
    596 598
             if len(app.connections) >= 2:
    
    597 599
                 # Do not merge accounts if only one exists
    

  • gajim/roster_window.py
    ... ... @@ -49,7 +49,6 @@ from enum import IntEnum, unique
    49 49
     
    
    50 50
     from gajim import dialogs
    
    51 51
     from gajim import vcard
    
    52
    -from gajim import config
    
    53 52
     from gajim import disco
    
    54 53
     from gajim import gtkgui_helpers
    
    55 54
     from gajim import gui_menu_builder
    
    ... ... @@ -57,6 +56,7 @@ from gajim import cell_renderer_image
    57 56
     from gajim import tooltips
    
    58 57
     from gajim import message_control
    
    59 58
     from gajim import adhoc_commands
    
    59
    +from gajim.accounts_window import AccountsWindow
    
    60 60
     from gajim.gtk import JoinGroupchatWindow
    
    61 61
     from gajim.gtk import ConfirmationDialogCheck
    
    62 62
     from gajim.gtk import ConfirmationDialog
    
    ... ... @@ -3163,11 +3163,12 @@ class RosterWindow:
    3163 3163
             self.remove_groupchat(jid, account, maximize=True)
    
    3164 3164
     
    
    3165 3165
         def on_edit_account(self, widget, account):
    
    3166
    -        if 'accounts' in app.interface.instances:
    
    3167
    -            app.interface.instances['accounts'].present()
    
    3166
    +        window = app.get_app_window(AccountsWindow)
    
    3167
    +        if window is None:
    
    3168
    +            window = AccountsWindow()
    
    3168 3169
             else:
    
    3169
    -            app.interface.instances['accounts'] = config.AccountsWindow()
    
    3170
    -        app.interface.instances['accounts'].select_account(account)
    
    3170
    +            window.present()
    
    3171
    +        window.select_account(account)
    
    3171 3172
     
    
    3172 3173
         def on_change_status_message_activate(self, widget, account):
    
    3173 3174
             show = app.SHOW_LIST[app.connections[account].connected]