Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Maemo 5: New episodes notification (Maemo bug 11130)
Replace the focus-stealing method of opening the new episodes window with a pynotify-based "yellow" notification bubble that opens the new episodes list when clicked.
- Loading branch information
Showing
4 changed files
with
107 additions
and
4 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# gPodder - A media aggregator and podcast client | ||
# Copyright (c) 2005-2010 Thomas Perl and the gPodder Team | ||
# | ||
# gPodder is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# gPodder is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
|
||
import gtk | ||
import gobject | ||
import hildon | ||
|
||
import gpodder | ||
|
||
_ = gpodder.gettext | ||
|
||
class ProgressIndicator(object): | ||
# Delayed time until window is shown (for short operations) | ||
DELAY = 500 | ||
|
||
def __init__(self, title, subtitle=None, cancellable=False, parent=None): | ||
self.title = title | ||
self.subtitle = subtitle | ||
self.cancellable = cancellable | ||
self.parent = parent | ||
self.dialog = None | ||
self.indicator = None | ||
self._progress_set = False | ||
self._progress = 0. | ||
self._message_set = False | ||
self._message = '' | ||
self.source_id = gobject.timeout_add(self.DELAY, self._create_progress) | ||
|
||
def _create_progress(self): | ||
self.dialog = hildon.hildon_banner_show_animation(self.parent, \ | ||
'qgn_indi_pball_a', self.title) | ||
self._update_label() | ||
|
||
gobject.source_remove(self.source_id) | ||
self.source_id = None | ||
return False | ||
|
||
def _update_label(self): | ||
if self.dialog is not None: | ||
text = [] | ||
text.append(self.title) | ||
if self._message_set: | ||
text.append('\n') | ||
text.append(self._message) | ||
if self._progress_set: | ||
text.append(' (%.0f%%)' % (self._progress*100.,)) | ||
self.dialog.set_text(''.join(text)) | ||
|
||
def on_message(self, message): | ||
self._message_set = True | ||
self._message = message | ||
self._update_label() | ||
|
||
def on_progress(self, progress): | ||
self._progress_set = True | ||
self._progress = progress | ||
self._update_label() | ||
|
||
def on_finished(self): | ||
if self.dialog is not None: | ||
self.dialog.destroy() | ||
|
||
if self.source_id is not None: | ||
gobject.source_remove(self.source_id) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters