summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuo Jinghua <sunmoon1997@gmail.com>2009-09-24 18:30:32 +0800
committerLuo Jinghua <sunmoon1997@gmail.com>2009-09-24 18:30:32 +0800
commit04ef8fc29adfbd7ac20471755080bf1a04315b0b (patch)
treed943b71f4fdb19870badf620ee48bb5ba3a5d7e7
parent556e322a606f72280a7fe1ed61e97cb2644e42a6 (diff)
totem: don't popup confirm dialog if list is empty
-rw-r--r--totem/plugin/sopcast.py23
1 files changed, 11 insertions, 12 deletions
diff --git a/totem/plugin/sopcast.py b/totem/plugin/sopcast.py
index fd97ed4..049748e 100644
--- a/totem/plugin/sopcast.py
+++ b/totem/plugin/sopcast.py
@@ -336,14 +336,15 @@ class Sopcast (totem.Plugin):
self.add_to_playlist (name, location)
def on_reset_channel (self, action):
- dialog = gtk.MessageDialog (type = gtk.MESSAGE_WARNING,
- buttons = gtk.BUTTONS_OK_CANCEL)
- dialog.set_markup (_("Are you sure to reset personal channel list to defaults?\n\n"
- "If you clicked the ok button, your changes will be discarded!"))
- response_id = dialog.run ()
- dialog.destroy ()
- if response_id != gtk.RESPONSE_OK:
- return
+ if len(self.liststore['playlist']):
+ dialog = gtk.MessageDialog (type = gtk.MESSAGE_WARNING,
+ buttons = gtk.BUTTONS_OK_CANCEL)
+ dialog.set_markup (_("Are you sure to reset personal channel list to defaults?\n\n"
+ "If you clicked the ok button, your changes will be discarded!"))
+ response_id = dialog.run ()
+ dialog.destroy ()
+ if response_id != gtk.RESPONSE_OK:
+ return
if os.path.exists (sc_playlist):
os.unlink (sc_playlist)
self.load_personal_channels ()
@@ -681,18 +682,16 @@ class Sopcast (totem.Plugin):
button = None
count = selection.count_selected_rows ()
- if not count:
- return False
action_group = self.ui_manager.get_action_groups () [0]
action = action_group.get_action ("copy-location")
action.set_sensitive (count == 1)
action = action_group.get_action ("add-to-channel-list")
- action.set_sensitive (treeview_name == 'channels')
+ action.set_sensitive (treeview_name == 'channels' and count != 0)
action = action_group.get_action ("remove-from-channel-list")
- action.set_sensitive (treeview_name == 'playlist')
+ action.set_sensitive (treeview_name == 'playlist' and count != 0)
action = action_group.get_action ("add-channel")
action.set_sensitive (treeview_name == 'playlist')