Commits

Damián Nohales committed b00829d

The "No songs found" message now is styled

Comments (0)

Files changed (3)

lib/SearchResultList.py

 from AbstractSongList import AbstractSongList
 import gtk
+import glib
     
 class SearchResultList(AbstractSongList):
     """
     def append_song(self, song):
         self.get_full_model().append([
             song,
-            song.get_title(),
+            glib.markup_escape_text(song.get_title()),
             song.get_artist(),
             song.get_album()
         ])
         self.get_view().get_selection().set_mode(gtk.SELECTION_MULTIPLE)
         
         rendererText = gtk.CellRendererText()
-        column = gtk.TreeViewColumn(_("Title"), rendererText, text = 1)
+        column = gtk.TreeViewColumn(_("Title"), rendererText, markup = 1)
         self.get_view().append_column(column)
         column.set_resizable(True)
         column.set_max_width(300)
         self.mainmenu = builder.get_object('mainmenu')
         
         self.vbox_results = builder.get_object('vbox_results')
+        self.hbox_filter = builder.get_object('hbox_filter')
         
         self.button_play = builder.get_object('button_play')
         self.widget_image_play = builder.get_object('widget_image_play')
         
         self.on_playlist_row_changed(self.playlist.get_model())
         self.set_playing_song(None)
+        self.set_search_sensitivity(False)
 
 
     def on_init_thread_success(self):
         """
         dialog = guihelpers.PreferencesDialog(self)
         dialog.show_all()
-
+    
+    def set_search_sensitivity(self, sens):
+        self.vbox_results.set_sensitive(sens)
+        self.hbox_filter.set_sensitive(sens)
+        self.result.get_view().set_headers_visible(sens)
+        self.result.get_view().get_column(1).set_visible(sens)
+        self.result.get_view().get_column(2).set_visible(sens)
+    
     def on_search_grooveshark(self, widget, data = None):
         """
         Starts the search thread
         self.app.entry_search.set_sensitive(True)
         self.app.result.clear()
         if results and len(results) > 0:
-            self.app.vbox_results.set_sensitive(True)
-            self.app.entry_filter.set_sensitive(True)
-            self.app.result.get_view().set_headers_visible(True)
+            self.app.set_search_sensitivity(True)
             for song_data in results:
                 self.app.result.append_song(Song(song_data))
         else:
-            self.app.vbox_results.set_sensitive(False)
-            self.app.entry_filter.set_sensitive(False)
-            self.app.result.get_view().set_headers_visible(False)
+            self.app.set_search_sensitivity(False)
             self.app.result.get_full_model().append([
                 None,
-                _("No songs found"),
+                "<span foreground='#555555'>%s</span>" % _("No songs found"),
                 "",
                 ""
             ])