Skip to content

Commit

Permalink
New extension: Gtk status icon (bug 1495)
Browse files Browse the repository at this point in the history
  • Loading branch information
thp committed Aug 16, 2012
1 parent 1438f11 commit bf5536a
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions share/gpodder/extensions/gtk_statusicon.py
@@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
#
# Gtk Status Icon (gPodder bug 1495)
# Thomas Perl <thp@gpodder.org>; 2012-07-31
#

import gpodder

_ = gpodder.gettext

__title__ = _('Gtk Status Icon')
__description__ = _('Show a status icon for Gtk-based Desktops.')
__only_for__ = 'gtk'

import gtk

class gPodderExtension:
def __init__(self, container):
self.container = container
self.status_icon = None
self.gpodder = None

def on_load(self):
self.status_icon = gtk.status_icon_new_from_icon_name('gpodder')
self.status_icon.connect('activate', self.on_toggle_visible)

def on_toggle_visible(self, status_icon):
if self.gpodder is None:
return

if self.gpodder.main_window.get_property('visible'):
self.gpodder.main_window.hide()
else:
self.gpodder.main_window.show()

def on_unload(self):
if self.status_icon is not None:
self.status_icon.hide()
self.status_icon = None

def on_ui_object_available(self, name, ui_object):
if name == 'gpodder-gtk':
self.gpodder = ui_object


0 comments on commit bf5536a

Please sign in to comment.