X-Git-Url: http://git.maemo.org/git/?p=jamaendo;a=blobdiff_plain;f=jamaui%2Falbumlist.py;h=ce1671aa4af705c480263ba036879e816538be17;hp=e851cdb0851088c437ec6fdf9287474f9ed5ff08;hb=facd2a5710fb05ac80d55ed8e1af8184fb496c02;hpb=44b759cfcfb80d94ddac5ea11302a6f94cb307b4 diff --git a/jamaui/albumlist.py b/jamaui/albumlist.py index e851cdb..ce1671a 100644 --- a/jamaui/albumlist.py +++ b/jamaui/albumlist.py @@ -66,5 +66,36 @@ class TrackList(gtk.TreeView): def get_track_id(self, path): treeiter = self.__store.get_iter(path) + _, _, _id = self.__store.get(treeiter, 0, 1, 2) + return _id + +class RadioList(gtk.TreeView): + def __init__(self): + gtk.TreeView.__init__(self) + self.__store = gtk.ListStore(str, int) + self.set_model(self.__store) + + col = gtk.TreeViewColumn('Name') + self.append_column(col) + cell = gtk.CellRendererText() + col.pack_start(cell, True) + col.add_attribute(cell, 'text', 0) + + self.set_search_column(0) + col.set_sort_column_id(0) + + def add_radio(self, radio): + self.__store.append([self.radio_name(radio), radio.ID]) + + def get_radio_id(self, path): + treeiter = self.__store.get_iter(path) _, _id = self.__store.get(treeiter, 0, 1) return _id + + def radio_name(self, radio): + if radio.idstr: + return radio.idstr.capitalize() + elif radio.name: + return radio.name + else: + return "Radio #%s" % (radio.ID)