Use icons from IconTheme for StatusIcon
This commit is contained in:
parent
dd12584fe6
commit
cb90d46996
1 changed files with 11 additions and 28 deletions
|
@ -85,17 +85,14 @@ class StatusIcon:
|
||||||
def show_icon(self):
|
def show_icon(self):
|
||||||
if not self.status_icon:
|
if not self.status_icon:
|
||||||
self.status_icon = Gtk.StatusIcon()
|
self.status_icon = Gtk.StatusIcon()
|
||||||
self.statusicon_size = '16'
|
|
||||||
if sys.platform == 'darwin':
|
|
||||||
self.statusicon_size = '24'
|
|
||||||
self.status_icon.set_property('has-tooltip', True)
|
self.status_icon.set_property('has-tooltip', True)
|
||||||
self.status_icon.connect('activate', self.on_status_icon_left_clicked)
|
self.status_icon.connect('activate',
|
||||||
|
self.on_status_icon_left_clicked)
|
||||||
self.status_icon.connect('popup-menu',
|
self.status_icon.connect('popup-menu',
|
||||||
self.on_status_icon_right_clicked)
|
self.on_status_icon_right_clicked)
|
||||||
self.status_icon.connect('query-tooltip',
|
self.status_icon.connect('query-tooltip',
|
||||||
self.on_status_icon_query_tooltip)
|
self.on_status_icon_query_tooltip)
|
||||||
self.status_icon.connect('size-changed',
|
self.status_icon.connect('size-changed', self.set_img)
|
||||||
self.on_status_icon_size_changed)
|
|
||||||
|
|
||||||
self.set_img()
|
self.set_img()
|
||||||
self.subscribe_events()
|
self.subscribe_events()
|
||||||
|
@ -126,40 +123,26 @@ class StatusIcon:
|
||||||
self.statusicon_size = '32'
|
self.statusicon_size = '32'
|
||||||
self.set_img()
|
self.set_img()
|
||||||
|
|
||||||
def set_img(self):
|
def set_img(self, *args):
|
||||||
"""
|
"""
|
||||||
Apart from image, we also update tooltip text here
|
Apart from image, we also update tooltip text here
|
||||||
"""
|
"""
|
||||||
def really_set_img():
|
|
||||||
if image.get_storage_type() == Gtk.ImageType.PIXBUF:
|
|
||||||
self.status_icon.set_from_pixbuf(image.get_pixbuf())
|
|
||||||
# FIXME: oops they forgot to support GIF animation?
|
|
||||||
# or they were lazy to get it to work under Windows! WTF!
|
|
||||||
elif image.get_storage_type() == Gtk.ImageType.ANIMATION:
|
|
||||||
self.status_icon.set_from_pixbuf(
|
|
||||||
image.get_animation().get_static_image())
|
|
||||||
# self.status_icon.set_from_animation(image.get_animation())
|
|
||||||
|
|
||||||
if not app.interface.systray_enabled:
|
if not app.interface.systray_enabled:
|
||||||
return
|
return
|
||||||
if app.config.get('trayicon') == 'always':
|
if app.config.get('trayicon') == 'always':
|
||||||
self.status_icon.set_visible(True)
|
self.status_icon.set_visible(True)
|
||||||
if app.events.get_nb_systray_events():
|
if app.events.get_nb_systray_events():
|
||||||
self.status_icon.set_visible(True)
|
self.status_icon.set_visible(True)
|
||||||
# if app.config.get('trayicon_blink'):
|
|
||||||
# self.status_icon.set_blinking(True)
|
icon_name = gtkgui_helpers.get_iconset_name_for('event')
|
||||||
# else:
|
self.status_icon.set_from_icon_name(icon_name)
|
||||||
image = gtkgui_helpers.load_icon('event')
|
|
||||||
really_set_img()
|
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
if app.config.get('trayicon') == 'on_event':
|
if app.config.get('trayicon') == 'on_event':
|
||||||
self.status_icon.set_visible(False)
|
self.status_icon.set_visible(False)
|
||||||
# self.status_icon.set_blinking(False)
|
|
||||||
|
|
||||||
image = app.interface.jabber_state_images[self.statusicon_size][
|
icon_name = gtkgui_helpers.get_iconset_name_for(self.status)
|
||||||
self.status]
|
self.status_icon.set_from_icon_name(icon_name)
|
||||||
really_set_img()
|
|
||||||
|
|
||||||
def change_status(self, global_status):
|
def change_status(self, global_status):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Add table
Reference in a new issue