Ticket #307: gtkui_update_main_window_torrents_menu.patch

File gtkui_update_main_window_torrents_menu.patch, 2.9 KB (added by sadrul, 16 years ago)
  • deluge/ui/gtkui/torrentview.py

     
    330330 
    331331        # Update the toolbar buttons just in case some state has changed 
    332332        component.get("ToolBar").update_buttons() 
     333        component.get("MenuBar").update() 
    333334         
    334335    def _on_get_torrents_status(self, status): 
    335336        """Callback function for get_torrents_status().  'status' should be a 
     
    431432        log.debug("on_selection_changed") 
    432433        component.get("TorrentDetails").update() 
    433434        component.get("ToolBar").update_buttons() 
    434          
     435        component.get("MenuBar").update() 
     436 
  • deluge/ui/gtkui/menubar.py

     
    201201        self.window.main_glade.get_widget("separatormenuitem").hide() 
    202202        self.window.main_glade.get_widget("menuitem_quitdaemon").hide() 
    203203 
     204    def update(self): 
     205        selected = component.get('TorrentView').get_selected_torrents() 
     206        if not selected or len(selected) == 0: 
     207            # No torrent is selected. Disable the 'Torrents' menu 
     208            self.menu_torrent.set_sensitive(False) 
     209            return 
     210 
     211        self.menu_torrent.set_sensitive(True) 
     212        # XXX: Should also update Pause/Resume/Remove menuitems. 
     213        # Any better way than duplicating toolbar.py:update_buttons in here? 
     214 
    204215    def add_torrentmenu_separator(self): 
    205216        sep = gtk.SeparatorMenuItem() 
    206217        self.torrentmenu.append(sep) 
  • deluge/ui/gtkui/signals.py

     
    9292        log.debug("torrent_paused signal received..") 
    9393        component.get("TorrentView").update() 
    9494        component.get("ToolBar").update_buttons() 
     95        component.get("MenuBar").update() 
    9596     
    9697    def torrent_resumed(self, torrent_id): 
    9798        log.debug("torrent_resumed signal received..") 
    9899        component.get("TorrentView").update() 
    99100        component.get("ToolBar").update_buttons() 
     101        component.get("MenuBar").update() 
    100102             
    101103    def torrent_all_paused(self): 
    102104        log.debug("torrent_all_paused signal received..") 
    103105        component.get("TorrentView").update() 
    104106        component.get("ToolBar").update_buttons() 
     107        component.get("MenuBar").update() 
    105108         
    106109    def torrent_all_resumed(self): 
    107110        log.debug("torrent_all_resumed signal received..") 
    108111        component.get("TorrentView").update() 
    109112        component.get("ToolBar").update_buttons() 
     113        component.get("MenuBar").update() 
    110114         
    111115    def config_value_changed(self, key, value): 
    112116        log.debug("config_value_changed signal received..")