Filters for Podcasts and Episodes on Maemo 5
[gpodder.git] / src / gpodder / gtkui / frmntl / podcasts.py
blob76a1bc2bf21e7622a44d9023de353be933bfccca
1 # -*- coding: utf-8 -*-
3 # gPodder - A media aggregator and podcast client
4 # Copyright (c) 2005-2009 Thomas Perl and the gPodder Team
6 # gPodder is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
11 # gPodder is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 import gtk
21 import hildon
23 import gpodder
25 _ = gpodder.gettext
27 from gpodder.gtkui.interface.common import BuilderWidget
28 from gpodder.gtkui.model import PodcastListModel
30 class gPodderPodcasts(BuilderWidget):
31 def new(self):
32 appmenu = hildon.AppMenu()
33 for action in (self.action_update_feeds, \
34 self.action_subscribe):
35 button = gtk.Button()
36 action.connect_proxy(button)
37 appmenu.append(button)
38 for filter in (self.item_view_podcasts_all, \
39 self.item_view_podcasts_downloaded, \
40 self.item_view_podcasts_unplayed):
41 button = gtk.ToggleButton()
42 filter.connect_proxy(button)
43 appmenu.add_filter(button)
44 appmenu.show_all()
45 self.main_window.set_app_menu(appmenu)
46 # Work around Maemo bug #4718
47 #self.button_subscribe.set_name('HildonButton-finger')
49 def on_update_feeds_button_clicked(self, button):
50 self.on_itemUpdate_activate(button)
52 def on_subscribe_button_clicked(self, button):
53 self.on_itemAddChannel_activate(button)
55 def on_podcast_selected(self, treeview, path, column):
56 model = treeview.get_model()
57 channel = model.get_value(model.get_iter(path), \
58 PodcastListModel.C_CHANNEL)
59 self.show_podcast_episodes(channel)
61 def on_delete_event(self, widget, event):
62 self.main_window.hide()
63 return True
65 def show(self):
66 self.main_window.show()