gpodder/share/gpodder/extensions/gtk_statusicon.py
Bernd Schlapsi d5eae16b9f Improvements to the extension system
- Add category metadata in every extension
- Show this category in the extension list gui
- Add "mandatory_in" and "disable-in" configuration for an extension
- Add Ubuntu unity check to enable/disable unity specific extensions
- Move "gpodder.win32" and "gpodder.osx" setting to the "gpodder.ui" namespace to be able to use it in the extensions category settings
- Only show metadata information in the right-click dialog of an extension
2012-12-07 10:30:28 +01:00

47 lines
1.2 KiB
Python

# -*- 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.')
__category__ = 'desktop-integration'
__only_for__ = 'gtk'
__disable_in__ = 'unity'
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