[gnome-music/wip/merge: 338/343] view: Set icon name for star renderer of Songs view only once



commit 5c90387fa4bffe6abcb9863bb25ad273e0bab844
Author: Arnel A. Borja <arnelborja src gnome org>
Date:   Wed Jul 24 12:09:07 2013 +0800

    view: Set icon name for star renderer of Songs view only once
    
    Since this value do not change, we could just set this during construction
    then map the visibility of the renderer to the list store column storing
    whether it should be visible or not.

 gnomemusic/view.py |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/gnomemusic/view.py b/gnomemusic/view.py
index e4d68d5..a1bcc25 100644
--- a/gnomemusic/view.py
+++ b/gnomemusic/view.py
@@ -344,10 +344,12 @@ class Songs(ViewContainer):
                                  self._on_list_widget_title_render, None)
 
         star_renderer = Gtk.CellRendererPixbuf(
-            xpad=32
+            xpad=32,
+            icon_name=self.starIconName
         )
         list_widget.add_renderer(star_renderer,
                                  self._on_list_widget_star_render, None)
+        cols[0].add_attribute(star_renderer, 'visible', 9)
 
         duration_renderer = Gd.StyledTextRenderer(
             xpad=32,
@@ -378,11 +380,7 @@ class Songs(ViewContainer):
         cell.set_property("text", albumArtCache.get_media_title(item))
 
     def _on_list_widget_star_render(self, col, cell, model, itr, data):
-        showstar = model.get_value(itr, 9)
-        if(showstar):
-            cell.set_property("icon_name", self.starIconName)
-        else:
-            cell.set_property("pixbuf", None)
+        pass
 
     def _on_list_widget_duration_render(self, col, cell, model, itr, data):
         item = model.get_value(itr, 5)


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