-
-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New extension: Gtk status icon (bug 1495)
- Loading branch information
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
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,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 | ||
|
||
|