Skip to content

Commit

Permalink
Add flattr option to the episode context menu
Browse files Browse the repository at this point in the history
  • Loading branch information
brot committed Dec 22, 2012
1 parent c381914 commit 6eab50a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/gpodder/gtkui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1664,6 +1664,7 @@ def treeview_available_show_context_menu(self, treeview, event=None):
episodes = self.get_selected_episodes()
any_locked = any(e.archive for e in episodes)
any_new = any(e.is_new for e in episodes)
any_flattrable = any(e.payment_url for e in episodes)
downloaded = all(e.was_downloaded(and_exists=True) for e in episodes)
downloading = any(e.downloading for e in episodes)

Expand Down Expand Up @@ -1745,6 +1746,12 @@ def treeview_available_show_context_menu(self, treeview, event=None):
item.set_active(any_locked)
item.connect('activate', lambda w: self.on_item_toggle_lock_activate( w, False, not any_locked))
menu.append(item)

if any_flattrable and self.config.flattr.token:
menu.append(gtk.SeparatorMenuItem())
item = gtk.MenuItem(_('Flattr this'))
item.connect('activate', self.flattr_selected_episodes)
menu.append(item)

menu.append(gtk.SeparatorMenuItem())
# Single item, add episode information menu item
Expand Down Expand Up @@ -2633,6 +2640,15 @@ def mark_selected_episodes_old(self):
for episode in self.get_selected_episodes():
episode.mark_old()
self.on_selected_episodes_status_changed()

def flattr_selected_episodes(self, w=None):
if not self.config.flattr.token:
return

for episode in [e for e in self.get_selected_episodes() if e.payment_url]:
success, message = self.flattr.flattr_url(episode.payment_url)
self.show_message(message, title=_('Flattr status'),
important=not success)

def on_item_toggle_played_activate( self, widget, toggle = True, new_value = False):
for episode in self.get_selected_episodes():
Expand Down

0 comments on commit 6eab50a

Please sign in to comment.