[appindicator] Use better icons
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
[info]
|
[info]
|
||||||
name: Appindicator integration
|
name: Appindicator integration
|
||||||
short_name: appindicator_integration
|
short_name: appindicator_integration
|
||||||
version: 1.0.0
|
version: 1.0.1
|
||||||
description: This plugin integrates Gajim with the appindicator. You must have gir1.2-appindicator3-0.1 installed to enable this plugin.<br/>
|
description: This plugin integrates Gajim with the appindicator. You must have gir1.2-appindicator3-0.1 installed to enable this plugin.<br/>
|
||||||
Rewriten from Ubuntu Ayatana Integration plugin
|
Rewriten from Ubuntu Ayatana Integration plugin
|
||||||
homepage: https://dev.gajim.org/gajim/gajim-plugins/wikis/AppindicatorSupportPlugin
|
homepage: https://dev.gajim.org/gajim/gajim-plugins/wikis/AppindicatorSupportPlugin
|
||||||
|
|||||||
@@ -12,10 +12,16 @@ import os
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
gi.require_version('AppIndicator3', '0.1')
|
|
||||||
from gi.repository import AppIndicator3 as appindicator
|
|
||||||
from gi.repository import Gtk, GLib, Gdk
|
from gi.repository import Gtk, GLib, Gdk
|
||||||
|
|
||||||
|
try:
|
||||||
|
gi.require_version('AppIndicator3', '0.1')
|
||||||
|
from gi.repository import AppIndicator3 as appindicator
|
||||||
|
ERRORMSG = None
|
||||||
|
except (ValueError, ImportError):
|
||||||
|
ERRORMSG = _('Please install libappindicator3')
|
||||||
|
|
||||||
|
|
||||||
# Gajim
|
# Gajim
|
||||||
from gajim.common import app, ged
|
from gajim.common import app, ged
|
||||||
from gajim.plugins import GajimPlugin
|
from gajim.plugins import GajimPlugin
|
||||||
@@ -28,11 +34,10 @@ class AppindicatorIntegrationPlugin(GajimPlugin):
|
|||||||
|
|
||||||
@log_calls("AppindicatorIntegrationPlugin")
|
@log_calls("AppindicatorIntegrationPlugin")
|
||||||
def init(self):
|
def init(self):
|
||||||
#if ERRORMSG:
|
if ERRORMSG:
|
||||||
# self.activatable = False
|
self.activatable = False
|
||||||
# self.available_text += _(ERRORMSG)
|
self.available_text += ERRORMSG
|
||||||
# return
|
return
|
||||||
#else:
|
|
||||||
self.config_dialog = None
|
self.config_dialog = None
|
||||||
self.events_handlers = {'our-show': (ged.GUI2,
|
self.events_handlers = {'our-show': (ged.GUI2,
|
||||||
self.set_indicator_icon)}
|
self.set_indicator_icon)}
|
||||||
@@ -43,9 +48,8 @@ class AppindicatorIntegrationPlugin(GajimPlugin):
|
|||||||
|
|
||||||
self.events = {}
|
self.events = {}
|
||||||
|
|
||||||
self.attention_icon = "tray-message"
|
self.online_icon = 'org.gajim.Gajim'
|
||||||
self.online_icon = "tray-online"
|
self.offline_icon = 'org.gajim.Gajim-symbolic'
|
||||||
self.offline_icon = "tray-offline"
|
|
||||||
self.connected = 0
|
self.connected = 0
|
||||||
|
|
||||||
self.connect_menu_item = Gtk.MenuItem('Connect')
|
self.connect_menu_item = Gtk.MenuItem('Connect')
|
||||||
@@ -75,8 +79,9 @@ class AppindicatorIntegrationPlugin(GajimPlugin):
|
|||||||
|
|
||||||
self.indicator = appindicator.Indicator.new(
|
self.indicator = appindicator.Indicator.new(
|
||||||
'Gajim', self.offline_icon,
|
'Gajim', self.offline_icon,
|
||||||
appindicator.IndicatorCategory.APPLICATION_STATUS)
|
appindicator.IndicatorCategory.COMMUNICATIONS)
|
||||||
self.indicator.set_attention_icon(self.attention_icon)
|
self.indicator.set_icon_theme_path(app.ICONS_DIR)
|
||||||
|
self.indicator.set_attention_icon('mail-unread')
|
||||||
self.indicator.set_status(appindicator.IndicatorStatus.ACTIVE)
|
self.indicator.set_status(appindicator.IndicatorStatus.ACTIVE)
|
||||||
self.indicator.set_menu(self.menu)
|
self.indicator.set_menu(self.menu)
|
||||||
|
|
||||||
@@ -102,7 +107,7 @@ class AppindicatorIntegrationPlugin(GajimPlugin):
|
|||||||
elif event.new_window_state & Gdk.WindowState.WITHDRAWN:
|
elif event.new_window_state & Gdk.WindowState.WITHDRAWN:
|
||||||
self.windowstate = 'hidden'
|
self.windowstate = 'hidden'
|
||||||
|
|
||||||
def set_indicator_icon(self, obj=''):
|
def set_indicator_icon(self, *args):
|
||||||
is_connected = 0
|
is_connected = 0
|
||||||
for account in app.connections:
|
for account in app.connections:
|
||||||
if not app.config.get_per('accounts', account,
|
if not app.config.get_per('accounts', account,
|
||||||
@@ -114,10 +119,10 @@ class AppindicatorIntegrationPlugin(GajimPlugin):
|
|||||||
if self.connected != is_connected:
|
if self.connected != is_connected:
|
||||||
self.connected = is_connected
|
self.connected = is_connected
|
||||||
if self.connected == 1:
|
if self.connected == 1:
|
||||||
self.indicator.set_icon(self.online_icon)
|
self.indicator.set_icon_full(self.online_icon, _('Online'))
|
||||||
self.connect_menu_item.hide()
|
self.connect_menu_item.hide()
|
||||||
else:
|
else:
|
||||||
self.indicator.set_icon(self.offline_icon)
|
self.indicator.set_icon_full(self.offline_icon, _('Offline'))
|
||||||
self.connect_menu_item.show()
|
self.connect_menu_item.show()
|
||||||
|
|
||||||
@log_calls("AppindicatorPlugin")
|
@log_calls("AppindicatorPlugin")
|
||||||
|
|||||||
Reference in New Issue
Block a user