Make the Maemo 5 shownotes window view-only
This removes all the progress bars and action buttons (except "Visit website") from the dialog, as this functionality is going to be moved in a separate dialog for easier access.
This commit is contained in:
parent
58ce37d759
commit
fed0cbc545
|
@ -1,36 +1,13 @@
|
|||
<?xml version="1.0"?>
|
||||
<interface>
|
||||
<object class="HildonStackableWindow" id="gPodderShownotes">
|
||||
<property name="title" translatable="yes">Shownotes</property>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="border_width">6</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">0</property>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox_actions">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="HildonButton" id="button_play">
|
||||
<property name="title" translatable="yes">Play</property>
|
||||
<property name="arrangement">HILDON_BUTTON_ARRANGEMENT_VERTICAL</property>
|
||||
<property name="size">HILDON_SIZE_FINGER_HEIGHT</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="HildonButton" id="button_delete">
|
||||
<property name="title" translatable="yes">Delete</property>
|
||||
<property name="arrangement">HILDON_BUTTON_ARRANGEMENT_VERTICAL</property>
|
||||
<property name="size">HILDON_SIZE_FINGER_HEIGHT</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="HildonPannableArea" id="scrolled_window">
|
||||
<property name="visible">True</property>
|
||||
|
@ -48,8 +25,15 @@
|
|||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkProgressBar" id="download_progress">
|
||||
<property name="visible">False</property>
|
||||
<object class="GtkHBox" id="hbox_actions">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="HildonButton" id="button_visit_website">
|
||||
<property name="visible">True</property>
|
||||
<property name="arrangement">HILDON_BUTTON_ARRANGEMENT_VERTICAL</property>
|
||||
<property name="size">HILDON_SIZE_FINGER_HEIGHT</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
@ -58,47 +42,8 @@
|
|||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkAction" id="action_play">
|
||||
<property name="stock_id">gtk-media-play</property>
|
||||
<signal name="activate" handler="on_play_button_clicked"/>
|
||||
</object>
|
||||
<object class="GtkAction" id="action_download">
|
||||
<property name="label" translatable="yes">Download</property>
|
||||
<property name="stock_id">gtk-go-down</property>
|
||||
<signal name="activate" handler="on_download_button_clicked"/>
|
||||
</object>
|
||||
<object class="GtkAction" id="action_pause">
|
||||
<property name="label" translatable="yes">Pause download</property>
|
||||
<property name="stock_id">gtk-media-pause</property>
|
||||
<signal name="activate" handler="on_pause_download_button_clicked"/>
|
||||
</object>
|
||||
<object class="GtkAction" id="action_resume">
|
||||
<property name="label" translatable="yes">Resume download</property>
|
||||
<signal name="activate" handler="on_resume_download_button_clicked"/>
|
||||
</object>
|
||||
<object class="GtkAction" id="action_cancel">
|
||||
<property name="label" translatable="yes">Cancel download</property>
|
||||
<property name="stock_id">gtk-cancel</property>
|
||||
<signal name="activate" handler="on_cancel_button_clicked"/>
|
||||
</object>
|
||||
<object class="GtkAction" id="action_delete">
|
||||
<property name="stock_id">gtk-delete</property>
|
||||
<signal name="activate" handler="on_delete_button_clicked"/>
|
||||
</object>
|
||||
<object class="GtkAction" id="action_visit_website">
|
||||
<property name="label" translatable="yes">Visit website</property>
|
||||
<signal name="activate" handler="on_visit_website_button_clicked"/>
|
||||
</object>
|
||||
<object class="GtkAction" id="action_close">
|
||||
<property name="stock_id">gtk-close</property>
|
||||
<signal name="activate" handler="on_close_button_clicked"/>
|
||||
</object>
|
||||
<object class="GtkAction" id="action_mark_as_new">
|
||||
<property name="label" translatable="yes">Mark as new</property>
|
||||
<signal name="activate" handler="on_mark_as_new_button_clicked"/>
|
||||
</object>
|
||||
<object class="GtkAction" id="action_mark_as_old">
|
||||
<property name="label" translatable="yes">Remove new mark</property>
|
||||
<signal name="activate" handler="on_do_not_download_button_clicked"/>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
|
@ -144,7 +144,7 @@ class gPodderEpisodes(BuilderWidget):
|
|||
else:
|
||||
self.action_delete.set_property('visible', False)
|
||||
self.action_keep.set_property('visible', False)
|
||||
self.action_download.set_property('visible', True)
|
||||
self.action_download.set_property('visible', not self.episode_is_downloading(episode))
|
||||
|
||||
if episode.is_locked:
|
||||
self.action_keep.set_property('label', _('Do not keep'))
|
||||
|
|
|
@ -41,29 +41,10 @@ class gPodderShownotes(gPodderShownotesBase):
|
|||
weight=pango.WEIGHT_BOLD)
|
||||
self.text_buffer.create_tag('subheading', scale=pango.SCALE_SMALL)
|
||||
self.textview.set_buffer(self.text_buffer)
|
||||
# Create the menu and set it for this window (Maybe move
|
||||
# this to the .ui file if GtkBuilder allows this)
|
||||
|
||||
import hildon
|
||||
appmenu = hildon.AppMenu()
|
||||
for action in (self.action_download, \
|
||||
self.action_pause, \
|
||||
self.action_resume, \
|
||||
self.action_cancel, \
|
||||
self.action_mark_as_new, \
|
||||
self.action_mark_as_old, \
|
||||
self.action_visit_website):
|
||||
button = gtk.Button()
|
||||
action.connect_proxy(button)
|
||||
appmenu.append(button)
|
||||
appmenu.show_all()
|
||||
self.main_window.set_app_menu(appmenu)
|
||||
|
||||
# Work around Maemo bug #4718
|
||||
self.button_play.set_name('HildonButton-finger')
|
||||
self.button_delete.set_name('HildonButton-finger')
|
||||
self.action_play.connect_proxy(self.button_play)
|
||||
self.action_delete.connect_proxy(self.button_delete)
|
||||
self.button_visit_website.set_name('HildonButton-finger')
|
||||
self.action_visit_website.connect_proxy(self.button_visit_website)
|
||||
|
||||
def _on_key_press_event(self, widget, event):
|
||||
# Override to provide support for all hardware keys
|
||||
|
@ -98,9 +79,8 @@ class gPodderShownotes(gPodderShownotesBase):
|
|||
vsb.set_value(vsb.get_value() - step)
|
||||
|
||||
def on_show_window(self):
|
||||
self.download_progress.set_fraction(0)
|
||||
self.download_progress.set_text('')
|
||||
self.main_window.set_title(self.episode.title)
|
||||
self.action_visit_website.set_property('visible', \
|
||||
self.episode.has_website_link())
|
||||
|
||||
def on_display_text(self):
|
||||
heading = self.episode.title
|
||||
|
@ -121,37 +101,3 @@ class gPodderShownotes(gPodderShownotesBase):
|
|||
self.episode = None
|
||||
self.text_buffer.set_text('')
|
||||
|
||||
def on_episode_status_changed(self):
|
||||
downloaded = self.episode.was_downloaded(and_exists=True)
|
||||
downloading = self.task is not None and self.task.status in \
|
||||
(self.task.QUEUED, self.task.DOWNLOADING, self.task.PAUSED)
|
||||
can_set_new_mark = not downloaded and not downloading
|
||||
|
||||
self.download_progress.set_property('visible', \
|
||||
self.task is not None and \
|
||||
self.task.status != self.task.CANCELLED)
|
||||
self.action_play.set_visible(downloaded or self._streaming_possible)
|
||||
self.action_delete.set_visible(downloaded)
|
||||
self.action_download.set_visible(\
|
||||
(self.task is None and not downloaded) or \
|
||||
(self.task is not None and \
|
||||
self.task.status in (self.task.CANCELLED, self.task.FAILED)))
|
||||
self.action_pause.set_visible(self.task is not None and \
|
||||
self.task.status in (self.task.QUEUED, self.task.DOWNLOADING))
|
||||
self.action_resume.set_visible(self.task is not None and \
|
||||
self.task.status == self.task.PAUSED)
|
||||
self.action_cancel.set_visible(downloading)
|
||||
self.action_mark_as_new.set_visible(can_set_new_mark and not self.episode_is_new())
|
||||
self.action_mark_as_old.set_visible(can_set_new_mark and self.episode_is_new())
|
||||
self.action_visit_website.set_visible(self.episode is not None and \
|
||||
self.episode.link is not None and \
|
||||
self.episode.link != self.episode.url)
|
||||
|
||||
def on_download_status_progress(self):
|
||||
if self.task:
|
||||
self.download_progress.set_fraction(self.task.progress)
|
||||
self.download_progress.set_text('%s: %d%% (%s/s)' % ( \
|
||||
self.task.STATUS_MESSAGE[self.task.status], \
|
||||
100.*self.task.progress, \
|
||||
util.format_filesize(self.task.speed)))
|
||||
|
||||
|
|
|
@ -633,6 +633,9 @@ class PodcastEpisode(PodcastModelObject):
|
|||
|
||||
return self
|
||||
|
||||
def has_website_link(self):
|
||||
return bool(self.link) and (self.link != self.url)
|
||||
|
||||
@staticmethod
|
||||
def from_feedparser_entry( entry, channel):
|
||||
episode = PodcastEpisode( channel)
|
||||
|
|
Loading…
Reference in New Issue