Remove unnecessary calls to update_buttons()

This commit is contained in:
Andrew Resch 2008-05-19 02:26:10 +00:00
parent 6dca7958a2
commit 95d0b65785
2 changed files with 4 additions and 11 deletions

View File

@ -88,27 +88,22 @@ class Signals(component.Component):
# Remove the torrent from the treeview # Remove the torrent from the treeview
component.get("TorrentView").remove_row(torrent_id) component.get("TorrentView").remove_row(torrent_id)
component.get("TorrentDetails").clear() component.get("TorrentDetails").clear()
component.get("ToolBar").update_buttons()
def torrent_paused(self, torrent_id): def torrent_paused(self, torrent_id):
log.debug("torrent_paused signal received..") log.debug("torrent_paused signal received..")
component.get("TorrentView").update() component.get("TorrentView").update()
component.get("ToolBar").update_buttons("paused", torrent_id)
def torrent_resumed(self, torrent_id): def torrent_resumed(self, torrent_id):
log.debug("torrent_resumed signal received..") log.debug("torrent_resumed signal received..")
component.get("TorrentView").update() component.get("TorrentView").update()
component.get("ToolBar").update_buttons("resumed", torrent_id)
def torrent_all_paused(self): def torrent_all_paused(self):
log.debug("torrent_all_paused signal received..") log.debug("torrent_all_paused signal received..")
component.get("TorrentView").update() component.get("TorrentView").update()
component.get("ToolBar").update_buttons("paused")
def torrent_all_resumed(self): def torrent_all_resumed(self):
log.debug("torrent_all_resumed signal received..") log.debug("torrent_all_resumed signal received..")
component.get("TorrentView").update() component.get("TorrentView").update()
component.get("ToolBar").update_buttons("resumed")
def config_value_changed(self, key, value): def config_value_changed(self, key, value):
log.debug("config_value_changed signal received..") log.debug("config_value_changed signal received..")

View File

@ -78,8 +78,7 @@ class ToolBar(component.Component):
for widget in self.change_sensitivity: for widget in self.change_sensitivity:
self.window.main_glade.get_widget(widget).set_sensitive(True) self.window.main_glade.get_widget(widget).set_sensitive(True)
self.update_buttons() self.update_buttons()
gobject.idle_add(self.update_buttons)
def stop(self): def stop(self):
for widget in self.change_sensitivity: for widget in self.change_sensitivity:
self.window.main_glade.get_widget(widget).set_sensitive(False) self.window.main_glade.get_widget(widget).set_sensitive(False)
@ -103,9 +102,7 @@ class ToolBar(component.Component):
toolbutton.set_icon_widget(image) toolbutton.set_icon_widget(image)
# Set the tooltip # Set the tooltip
if tooltip is not None: if tooltip is not None:
tip = gtk.Tooltips() toolbutton.set_tooltip_text(tooltip)
tip.set_tip(toolbutton, tooltip)
# Connect the 'clicked' event callback # Connect the 'clicked' event callback
toolbutton.connect("clicked", callback) toolbutton.connect("clicked", callback)
@ -172,7 +169,7 @@ class ToolBar(component.Component):
def on_toolbutton_queue_down_clicked(self, data): def on_toolbutton_queue_down_clicked(self, data):
log.debug("on_toolbutton_queue_down_clicked") log.debug("on_toolbutton_queue_down_clicked")
component.get("MenuBar").on_menuitem_queue_down_activate(data) component.get("MenuBar").on_menuitem_queue_down_activate(data)
def update_buttons(self, action=None, torrent_id=None): def update_buttons(self, action=None, torrent_id=None):
if action == None: if action == None:
# If all the selected torrents are paused, then disable the 'Pause' # If all the selected torrents are paused, then disable the 'Pause'
@ -206,6 +203,7 @@ class ToolBar(component.Component):
("toolbutton_resume", resume), ("toolbutton_resume", resume),
("toolbutton_remove", remove)): ("toolbutton_remove", remove)):
self.window.main_glade.get_widget(name).set_sensitive(sensitive) self.window.main_glade.get_widget(name).set_sensitive(sensitive)
return False return False