1 # -*- coding: utf-8 -*-
3 # gPodder - A media aggregator and podcast client
4 # Copyright (c) 2005-2010 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/>.
22 # gpodder.gtkui.opml - Module for displaying OPML feeds (2009-08-13)
28 import xml
.sax
.saxutils
31 class OpmlListModel(gtk
.ListStore
):
32 C_SELECTED
, C_DESCRIPTION_MARKUP
, C_URL
= range(3)
34 def __init__(self
, importer
):
35 gtk
.ListStore
.__init
__(self
, bool, str, str)
36 for channel
in importer
.items
:
37 self
.append([False, self
._format
_channel
(channel
), channel
['url']])
39 def _format_channel(self
, channel
):
40 title
= xml
.sax
.saxutils
.escape(urllib
.unquote_plus(channel
['title']))
41 description
= xml
.sax
.saxutils
.escape(channel
['description'])
42 return '<b>%s</b>\n<span size="small">%s</span>' % (title
, description
)