From 5e2481f59797ac8acc4f683e311392a230ff9f1e Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Mon, 20 Feb 2012 21:40:38 +0100 Subject: [PATCH] Gtk UI: Remove fallback notification widget code This was quite ugly anyway and had some problems with window stacking on platforms like windows, so it should go for now and might be replaced with better integration in future versions with different hook scripts. --- src/gpodder/__init__.py | 1 - src/gpodder/gtkui/interface/common.py | 16 ------------- src/gpodder/gtkui/widgets.py | 45 ----------------------------------- 3 files changed, 62 deletions(-) diff --git a/src/gpodder/__init__.py b/src/gpodder/__init__.py index dd810af6..46c765cb 100644 --- a/src/gpodder/__init__.py +++ b/src/gpodder/__init__.py @@ -129,7 +129,6 @@ credits_file = None icon_file = None images_folder = None user_extensions = None -notify = None # Episode states used in the database STATE_NORMAL, STATE_DOWNLOADED, STATE_DELETED = range(3) diff --git a/src/gpodder/gtkui/interface/common.py b/src/gpodder/gtkui/interface/common.py index 0fb2a9d5..4577ca34 100644 --- a/src/gpodder/gtkui/interface/common.py +++ b/src/gpodder/gtkui/interface/common.py @@ -29,8 +29,6 @@ from gpodder import util from gpodder.gtkui.base import GtkBuilderWidget -from gpodder.gtkui.widgets import NotificationWindow - class BuilderWidget(GtkBuilderWidget): def __init__(self, parent, **kwargs): @@ -132,20 +130,6 @@ class BuilderWidget(GtkBuilderWidget): dlg.destroy() elif config is not None and config.enable_notifications: gpodder.user_extensions.on_notification_show(title, message) - - ### TODO: check with thp what we should do with this implementation - # - #if gpodder.notify.is_initted(): - # if title is None: - # title = 'gPodder' - # notification = gpodder.user_extensions.on_notification_show(title, message) - #elif widget and isinstance(widget, gtk.Widget): - # if not widget.window: - # widget = self.main_window - # elif not gpodder.win32: - # widget = self.main_window - # notification = NotificationWindow(message, title, important=False, widget=widget) - # notification.show_timeout() def show_confirmation(self, message, title=None): dlg = gtk.MessageDialog(self.main_window, gtk.DIALOG_MODAL, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO) diff --git a/src/gpodder/gtkui/widgets.py b/src/gpodder/gtkui/widgets.py index 07d74ed6..f0ef57db 100644 --- a/src/gpodder/gtkui/widgets.py +++ b/src/gpodder/gtkui/widgets.py @@ -92,51 +92,6 @@ class SimpleMessageArea(gtk.HBox): rect.x, rect.y, rect.width, rect.height) return False -class NotificationWindow(gtk.Window): - """A quick substitution widget for pynotify notifications.""" - def __init__(self, message, title=None, important=False, widget=None): - gtk.Window.__init__(self, gtk.WINDOW_POPUP) - self._finished = False - message_area = SimpleMessageArea('') - arrow = gtk.image_new_from_stock(gtk.STOCK_GO_UP, \ - gtk.ICON_SIZE_BUTTON) - arrow.set_alignment(.5, 0.) - arrow.set_padding(6, 0) - message_area.pack_start(arrow, False) - message_area.reorder_child(arrow, 0) - if title is not None: - message_area.set_markup('%s\n%s' % (cgi.escape(title), cgi.escape(message))) - else: - message_area.set_markup(cgi.escape(message)) - self.add(message_area) - self.set_gravity(gtk.gdk.GRAVITY_NORTH_WEST) - self.show_all() - if widget is not None: - _x, _y, ww, hh, _depth = self.window.get_geometry() - parent = widget - while not isinstance(parent, gtk.Window): - parent = parent.get_parent() - x, y, _w, _h, _depth = parent.window.get_geometry() - rect = widget.allocation - w, h = rect.width, rect.height - x += rect.x - y += rect.y - arrow_rect = arrow.allocation - if h < hh or w < ww: - self.move(x+w/2-arrow_rect.x-arrow_rect.width/2, y+h-5) - else: - self.move(x+w/2-ww/2, y+h/2-hh/2+20) - message_area.remove(arrow) - - def show_timeout(self, timeout=8000): - gobject.timeout_add(timeout, self._hide_and_destroy) - self.show_all() - - def _hide_and_destroy(self): - if not self._finished: - self.destroy() - self._finished = True - return False class SpinningProgressIndicator(gtk.Image): # Progress indicator loading inspired by glchess from gnome-games-clutter -- 2.11.4.GIT