Skip to content

Commit

Permalink
Flattr: Flattr-on-play for QML UI, fixes for Gtk UI
Browse files Browse the repository at this point in the history
  • Loading branch information
thp committed Jul 24, 2012
1 parent 2d01c50 commit 7894ab2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
11 changes: 7 additions & 4 deletions share/gpodder/ui/qml/Main.qml
Expand Up @@ -103,10 +103,13 @@ Image {
}

function togglePlayback(episode) {
if (episode !== undefined && episode.qfiletype == 'video') {
controller.playVideo(episode)
} else {
mediaPlayer.togglePlayback(episode)
if (episode !== undefined) {
if (episode.qfiletype == 'video') {
controller.playVideo(episode);
} else {
mediaPlayer.togglePlayback(episode);
}
controller.onPlayback(episode);
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/gpodder/gtkui/main.py
Expand Up @@ -1908,9 +1908,11 @@ def error_handler(filename, err):
logger.error('Calling Panucci using D-Bus', exc_info=True)

# flattr episode if auto-flattr is enabled
if self.config.flattr.token and self.config.flattr.flattr_on_play:
if (episode.payment_url and self.config.flattr.token and
self.config.flattr.flattr_on_play):
success, message = self.flattr.flattr_url(episode.payment_url)
self.show_message(message, title=_('Flattr status'), important=not success)
self.show_message(message, title=_('Flattr status'),
important=not success)

groups[player].append(filename)

Expand Down
8 changes: 8 additions & 0 deletions src/gpodder/qmlui/__init__.py
Expand Up @@ -168,6 +168,14 @@ def getFlattrButtonText(self):
flattrButtonText = Property(unicode, getFlattrButtonText,
setFlattrButtonText, notify=flattrButtonTextChanged)

@Slot(QObject)
def onPlayback(self, qepisode):
if (qepisode.payment_url and self.root.config.flattr.token and
self.root.config.flattr.flattr_on_play):
success, message = self._flattr.flattr_url(qepisode.payment_url)
if not success:
logger.warn('Flattr message on playback action: %s', message)

@Slot(QObject)
def updateFlattrButtonText(self, qepisode):
self.setFlattrButtonText('')
Expand Down

0 comments on commit 7894ab2

Please sign in to comment.