Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Flattr integration (bug 1576)
  • Loading branch information
brot authored and thp committed Jul 13, 2012
1 parent dd125da commit beaf1a6
Show file tree
Hide file tree
Showing 21 changed files with 707 additions and 46 deletions.
4 changes: 3 additions & 1 deletion README
Expand Up @@ -61,7 +61,8 @@
- Qt Quick Components http://qt.gitorious.org/qt-components

The QML UI depends on the QtMultimediaKit QML bindings for playing
back audio (libdeclarative-multimedia in Debian).
back audio (libdeclarative-multimedia in Debian) and on the WebKit QML
bindings for Flattr integration (libqtwebkit-qmlwebkitplugin in Debian).

The QML UI now also depends on Qt Quick Components. On MeeGo 1.2 Harmattan,
these components are pre-installed. You can install them on your Desktop by
Expand All @@ -78,6 +79,7 @@

- Bluetooth file sending: gnome-obex-send or bluetooth-sendto
- HTML shownotes: python-webkit
- Flattr integration: python-webkit
- Size detection on Windows: PyWin32
- Native OS X support: ige-mac-integration

Expand Down
Binary file added share/gpodder/images/button-flattr-grey.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added share/gpodder/images/button-flattr.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added share/gpodder/images/button-flattred.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
75 changes: 75 additions & 0 deletions share/gpodder/ui/gtk/gpodderchannel.ui
Expand Up @@ -416,6 +416,81 @@
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkHSeparator" id="hseparator_flattr">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_flattr">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&lt;b&gt;Flattr&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">6</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_flattr_info">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">The feed do not include flattr information. Maybe the feed provides the information on the episodes!</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">start</property>
<property name="position">7</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hboxFlattr">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">10</property>
<property name="spacing">5</property>
<child>
<object class="GtkButton" id="flattr_button">
<property name="label" translatable="yes">Flattr this</property>
<property name="visible">True</property>
<signal name="clicked" handler="on_flattr_button_clicked"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">start</property>
</packing>
</child>
<child>
<object class="GtkImage" id="flattr_image">
<property name="visible">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">start</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">start</property>
<property name="position">8</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
Expand Down
56 changes: 56 additions & 0 deletions share/gpodder/ui/gtk/gpodderflattrsignin.ui
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<!--*- mode: xml -*-->
<interface>
<object class="GtkDialog" id="gPodderFlattrSignIn">
<property name="visible">True</property>
<property name="has_separator">False</property>
<property name="title" translatable="yes">Sign in to Flattr</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="modal">True</property>
<property name="default_width">700</property>
<property name="default_height">570</property>
<property name="destroy_with_parent">False</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="vbox_flattr">
<property name="visible">True</property>
<property name="spacing">0</property>
<property name="border_width">0</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow_web">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
</child>
</object>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btn_close">
<property name="visible">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<signal handler="on_btn_close_clicked" name="clicked"/>
</object>
<packing>
<property name="padding">15</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</object>
</child>
</object>
</interface>
49 changes: 49 additions & 0 deletions share/gpodder/ui/gtk/gpodderpreferences.ui
Expand Up @@ -176,6 +176,55 @@
<property name="tab-label" translatable="yes">Extensions</property>
</packing>
</child>
<child>
<object class="GtkTable" id="flattr_config">
<property name="border_width">6</property>
<property name="column_spacing">6</property>
<property name="n_columns">3</property>
<property name="n_rows">3</property>
<property name="row_spacing">6</property>
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="label_flattr">
<property name="label" translatable="yes">Please sign in with Flattr and Support Publishers</property>
<property name="use_markup">True</property>
<property name="visible">True</property>
</object>
<packing>
<property name="bottom_attach">2</property>
<property name="top_attach">1</property>
<property name="x_options">fill</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button_flattr_login">
<property name="label" translatable="yes">Sign in</property>
<property name="visible">True</property>
<signal handler="on_button_flattr_login" name="clicked"/>
</object>
<packing>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="checkbutton_flattr_on_play">
<property name="label" translatable="yes">Automatically flattr episodes on playback</property>
<property name="visible">True</property>
<signal handler="on_check_flattr_on_play" name="toggled"/>
</object>
<packing>
<property name="bottom_attach">4</property>
<property name="top_attach">3</property>
</packing>
</child>
</object>
<packing>
<property name="tab-label" translatable="yes">Flattr</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkTable" id="mygpo_config">
<property name="border_width">6</property>
Expand Down
114 changes: 80 additions & 34 deletions share/gpodder/ui/gtk/gpoddershownotes.ui
Expand Up @@ -48,56 +48,102 @@
<property name="position">2</property>
</packing>
</child>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="gpodderepisode-action_area">
<property name="border_width">5</property>
<property name="layout_style">end</property>
<property name="spacing">6</property>
<child>
<object class="GtkHBox" id="gpodderepisode-footer-area">
<property name="visible">True</property>
<child>
<object class="GtkButton" id="btnPlay">
<property name="label">gtk-media-play</property>
<property name="use_stock">True</property>
<property name="visible">True</property>
<signal handler="on_play_button_clicked" name="clicked"/>
</object>
</child>
<child>
<object class="GtkButton" id="btnDownload">
<property name="label" translatable="yes">_Download</property>
<property name="use_underline">True</property>
<property name="visible">True</property>
<signal handler="on_download_button_clicked" name="clicked"/>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btnCancel">
<property name="label" translatable="yes">C_ancel download</property>
<property name="use_underline">True</property>
<object class="GtkHButtonBox" id="gpodderepisode-flattr_area">
<property name="visible">True</property>
<signal handler="on_cancel_button_clicked" name="clicked"/>
<property name="can_focus">False</property>
<property name="border_width">10</property>
<property name="spacing">5</property>
<child>
<object class="GtkButton" id="flattr_button">
<property name="label" translatable="yes">Flattr this</property>
<property name="visible">True</property>
<signal name="clicked" handler="on_flattr_button_clicked"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkImage" id="flattr_image">
<property name="visible">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="position">2</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">start</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btnClose">
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<object class="GtkHButtonBox" id="gpodderepisode-action_area">
<property name="border_width">5</property>
<property name="layout_style">end</property>
<property name="spacing">6</property>
<property name="visible">True</property>
<signal handler="on_close_button_clicked" name="clicked"/>
<child>
<object class="GtkButton" id="btnPlay">
<property name="label">gtk-media-play</property>
<property name="use_stock">True</property>
<property name="visible">True</property>
<signal handler="on_play_button_clicked" name="clicked"/>
</object>
</child>
<child>
<object class="GtkButton" id="btnDownload">
<property name="label" translatable="yes">_Download</property>
<property name="use_underline">True</property>
<property name="visible">True</property>
<signal handler="on_download_button_clicked" name="clicked"/>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btnCancel">
<property name="label" translatable="yes">C_ancel download</property>
<property name="use_underline">True</property>
<property name="visible">True</property>
<signal handler="on_cancel_button_clicked" name="clicked"/>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btnClose">
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="visible">True</property>
<signal handler="on_close_button_clicked" name="clicked"/>
</object>
<packing>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="position">3</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
</packing>
</child>
Expand Down
5 changes: 5 additions & 0 deletions src/gpodder/config.py
Expand Up @@ -183,6 +183,11 @@
'extensions': {
'enabled': [],
},

'flattr': {
'token': '',
'flattr_on_play': False,
},
}

# The sooner this goes away, the better
Expand Down
4 changes: 4 additions & 0 deletions src/gpodder/core.py
Expand Up @@ -28,6 +28,7 @@
from gpodder import dbsqlite
from gpodder import extensions
from gpodder import model
from gpodder import flattr


class Core(object):
Expand All @@ -52,6 +53,9 @@ def __init__(self,
# Update the current device in the configuration
self.config.mygpo.device.type = util.detect_device_type()

# Initialize Flattr integration
self.flattr = flattr.Flattr(self.config.flattr)

def shutdown(self):
# Notify all extensions that we are being shut down
gpodder.user_extensions.shutdown()
Expand Down

0 comments on commit beaf1a6

Please sign in to comment.