[rhythmbox/wip/python3: 30/35] context: remove the top five list



commit e0ca9aa722d556865faa169551a54d1d8325400d
Author: Jonathan Matthew <jonathan d14n org>
Date:   Sat Apr 20 23:23:19 2013 +1000

    context: remove the top five list

 plugins/context/ContextView.py | 71 ++----------------------------------------
 1 file changed, 3 insertions(+), 68 deletions(-)
---
diff --git a/plugins/context/ContextView.py b/plugins/context/ContextView.py
index b1c9c71..5222835 100644
--- a/plugins/context/ContextView.py
+++ b/plugins/context/ContextView.py
@@ -74,7 +74,6 @@ class ContextView (GObject.GObject):
         self.init_tabs()
 
         self.connect_signals ()
-        self.load_top_five (self.ds['artist'])
 
         # Set currently displayed tab
         # TODO: make this persistent via gsettings key
@@ -107,11 +106,9 @@ class ContextView (GObject.GObject):
             shell.remove_widget (self.vbox, RB.ShellUILocation.RIGHT_SIDEBAR)
             self.visible = False
         self.vbox = None
-        self.label = None
         self.webview = None
         self.websettings = None
         self.buttons = None
-        self.top_five_list = None
 
         app = shell.props.application
         app.remove_plugin_menu_item("view", "view-context-pane")
@@ -119,7 +116,6 @@ class ContextView (GObject.GObject):
     def connect_signals(self):
         self.player_cb_ids = ( self.sp.connect ('playing-changed', self.playing_changed_cb),
             self.sp.connect ('playing-song-changed', self.playing_changed_cb))
-        self.ds_cb_id = self.ds['artist'].connect ('artist-top-tracks-ready', self.load_top_five)
         self.tab_cb_ids = []
 
         # Listen for switch-tab signal from each tab
@@ -130,8 +126,6 @@ class ContextView (GObject.GObject):
         for id in self.player_cb_ids:
             self.sp.disconnect (id)
 
-        self.ds['artist'].disconnect (self.ds_cb_id)
-
         for key, id in self.tab_cb_ids:
             self.tab[key].disconnect (id)
 
@@ -168,21 +162,6 @@ class ContextView (GObject.GObject):
         self.view['links'] = lit.LinksView (self.shell, self.plugin, self.webview)
         self.tab['links']  = lit.LinksTab (self.shell, self.buttons, self.ds['links'], self.view['links'])
 
-    def load_top_five (self, ds):
-        top_tracks = ds.get_top_tracks ()
-        ## populate liststore
-        if top_tracks is None:
-            for i in range (0, 5):
-                self.top_five_list.append(["%d. " % (i+1), ""])
-        else:
-            num_tracks = len(top_tracks)
-            ## empty liststore
-            self.top_five_list.clear()
-            for i in range (0, 5):
-                if i >= num_tracks : track = ""
-                else : track = top_tracks[i]
-                self.top_five_list.append(["%d. " % (i+1), str(track)])
-
     def playing_changed_cb (self, playing, user_data):
         # this sometimes happens on a streaming thread, so we need to
         # move it to the main thread
@@ -198,12 +177,6 @@ class ContextView (GObject.GObject):
 
         playing_artist = playing_entry.get_string(RB.RhythmDBPropType.ARTIST)
 
-        if self.current_artist != playing_artist:
-            self.current_artist = playing_artist.replace ('&', '&amp;')
-            # Translators: 'top' here means 'most popular'.  %s is replaced by the artist name.
-            self.label.set_markup(_("Top songs by %s") % ('<i>' + self.current_artist + '</i>'))
-            self.ds['artist'].fetch_top_tracks (self.current_artist)
-
         self.tab[self.current].reload()
 
     def navigation_request_cb(self, view, frame, request):
@@ -233,39 +206,6 @@ class ContextView (GObject.GObject):
 
     def init_gui(self):
         self.vbox = Gtk.VBox()
-        frame = Gtk.Frame()
-        self.label = Gtk.Label(_("Nothing Playing"))
-        frame.set_shadow_type(Gtk.ShadowType.IN)
-        frame.set_label_align(0.0,0.0)
-        frame.set_label_widget(self.label)
-        self.label.set_use_markup(True)
-        self.label.set_padding(0,4)
-
-        #----- set up top 5 tree view -----#
-        self.top_five_list = Gtk.ListStore (GObject.TYPE_STRING, GObject.TYPE_STRING)
-        top_five_view = Gtk.TreeView.new_with_model(self.top_five_list)
-
-        top_five_tvc1 = Gtk.TreeViewColumn()
-        top_five_tvc2 = Gtk.TreeViewColumn()
-
-        top_five_view.append_column(top_five_tvc1)
-        top_five_view.append_column(top_five_tvc2)
-
-        crt = Gtk.CellRendererText()
-
-        top_five_tvc1.pack_start(crt, True)
-        top_five_tvc2.pack_start(crt, True)
-
-        top_five_tvc1.add_attribute(crt, 'text', 0)
-        top_five_tvc2.add_attribute(crt, 'text', 1)
-        
-        top_five_view.set_headers_visible( False )
-
-        scroll = Gtk.ScrolledWindow()
-        scroll.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.NEVER)
-        scroll.add(top_five_view)
-
-        frame.add (scroll)
 
         #---- set up webkit pane -----#
         self.webview = WebKit.WebView()
@@ -281,15 +221,10 @@ class ContextView (GObject.GObject):
         self.apply_font_settings()
         self.webview.connect("style-set", self.style_set_cb)
 
-        #----- set up button group -----#
-        vbox2 = Gtk.VBox()
-        self.buttons = Gtk.HBox()
-
         #---- pack everything into side pane ----#
-        self.vbox.pack_start  (frame, False, True, 0)
-        vbox2.pack_start (self.buttons, False, True, 0)
-        vbox2.pack_start (scroll, True, True, 0)
-        self.vbox.pack_start (vbox2, True, True, 0)
+        self.buttons = Gtk.HBox()
+        self.vbox.pack_start (self.buttons, False, True, 0)
+        self.vbox.pack_start (scroll, True, True, 0)
 
         self.vbox.show_all()
         self.vbox.set_size_request(200, -1)


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