Changeset 520be1


Ignore:
Timestamp:
06/10/2009 10:50:57 PM (16 years ago)
Author:
Andrew Resch <andrewresch@gmail.com>
Branches:
2.0.x, develop, extjs4-port, master
Children:
ca7f33d
Parents:
e36ca0
Message:

Fix turning off Classic mode dialog
Fix showing the connection manager icon on the toolbar depending on classic mode setting

Location:
deluge/ui/gtkui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • deluge/ui/gtkui/gtkui.py

    re36ca0 r520be1  
    238238                client.start_classic_mode()
    239239            except deluge.error.DaemonRunningError:
    240                 response = dialogs.YesNoDialog(
     240                d = dialogs.YesNoDialog(
    241241                    _("Turn off Classic Mode?"),
    242242                    _("It appears that a Deluge daemon process (deluged) is already running.\n\n\
     
    244244
    245245                self.started_in_classic = False
    246                 if response != gtk.RESPONSE_YES:
    247                     # The user does not want to turn Classic Mode off, so just quit
    248                     reactor.stop()
    249                     return
    250                 # Turning off classic_mode
    251                 self.config["classic_mode"] = False
     246                def on_dialog_response(response):
     247                    if response != gtk.RESPONSE_YES:
     248                        # The user does not want to turn Classic Mode off, so just quit
     249                        reactor.stop()
     250                        return
     251                    # Turning off classic_mode
     252                    self.config["classic_mode"] = False
     253                    self.__start_non_classic()
     254
     255                d.addCallback(on_dialog_response)
    252256            else:
    253257                component.start()
    254258                return
    255259
    256         # Autoconnect to a host
    257         if self.config["autoconnect"]:
    258             for host in self.connectionmanager.config["hosts"]:
    259                 if host[0] == self.config["autoconnect_host_id"]:
    260                     def on_connect(connector):
    261                         component.start()
    262                     client.connect(*host[1:]).addCallback(on_connect)
    263 
    264         if self.config["show_connection_manager_on_start"]:
    265             # XXX: We need to call a simulate() here, but this could be a bug in twisted
    266             reactor.simulate()
    267             self.connectionmanager.show()
     260        else:
     261            self.__start_non_classic()
     262
     263    def __start_non_classic(self):
     264            # Autoconnect to a host
     265            if self.config["autoconnect"]:
     266                for host in self.connectionmanager.config["hosts"]:
     267                    if host[0] == self.config["autoconnect_host_id"]:
     268                        def on_connect(connector):
     269                            component.start()
     270                        client.connect(*host[1:]).addCallback(on_connect)
     271
     272            if self.config["show_connection_manager_on_start"]:
     273                # XXX: We need to call a simulate() here, but this could be a bug in twisted
     274                reactor.simulate()
     275                self.connectionmanager.show()
    268276
    269277
  • deluge/ui/gtkui/toolbar.py

    re36ca0 r520be1  
    7575        ]
    7676
    77         if self.config["classic_mode"]:
    78             self.window.main_glade.get_widget("toolbutton_connectionmanager").hide()
     77        self.config.register_set_function("classic_mode", self._on_classic_mode, True)
    7978
    8079        # Hide if necessary
     
    8281
    8382    def start(self):
     83        if not self.config["classic_mode"]:
     84            self.window.main_glade.get_widget("toolbutton_connectionmanager").show()
     85
    8486        for widget in self.change_sensitivity:
    8587            self.window.main_glade.get_widget(widget).set_sensitive(True)
     
    177179        log.debug("on_toolbutton_queue_down_clicked")
    178180        component.get("MenuBar").on_menuitem_queue_down_activate(data)
     181
     182    def _on_classic_mode(self, key, value):
     183        w = self.window.main_glade.get_widget("toolbutton_connectionmanager")
     184        if value:
     185            w.hide()
     186        else:
     187            w.show()
Note: See TracChangeset for help on using the changeset viewer.