[gnome-music] PlaylistDialog: Toggle Select Button on selection change



commit be4d6ff9a9a3f6036f1ba909f593acbf06f89d24
Author: Gaurav Narula <gnarula94 gmail com>
Date:   Thu Mar 10 00:49:57 2016 +0530

    PlaylistDialog: Toggle Select Button on selection change
    
    https://bugzilla.gnome.org/show_bug.cgi?id=744821

 gnomemusic/widgets.py |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/gnomemusic/widgets.py b/gnomemusic/widgets.py
index 03673c9..c2c4eeb 100644
--- a/gnomemusic/widgets.py
+++ b/gnomemusic/widgets.py
@@ -740,6 +740,7 @@ class PlaylistDialog():
 
         self.view = self.ui.get_object('treeview1')
         self.selection = self.ui.get_object('treeview-selection1')
+        self.selection.connect('changed', self._on_selection_changed)
         self._add_list_renderers()
         self.view.connect('row-activated', self._on_item_activated)
 
@@ -826,6 +827,12 @@ class PlaylistDialog():
         _iter = self.model.get_iter(path)
         if self.model.get_value(_iter, 1):
             self.view.set_cursor(path, column, True)
+
+    @log
+    def _on_selection_changed(self, selection):
+        model, _iter = self.selection.get_selected()
+
+        if _iter == None or self.model.get_value(_iter, 1):
             self._select_button.set_sensitive(False)
         else:
             self._select_button.set_sensitive(True)
@@ -885,7 +892,7 @@ class CellRendererClickablePixbuf(Gtk.CellRendererPixbuf):
             if self.show_star == 1:
                 self.set_property('icon_name', self.starIcon)
             elif self.show_star == 0:
-                   self.set_property('icon_name', self.nonStarIcon)
+                self.set_property('icon_name', self.nonStarIcon)
             else:
                 self.set_property('icon_name', '')
             self.show_star = value


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]