diff options
author | antialias <antialias@leap.se> | 2012-09-18 18:07:46 -0400 |
---|---|---|
committer | antialias <antialias@leap.se> | 2012-09-18 18:07:46 -0400 |
commit | c4509cf794a79fc7922d47765154148de8eacf46 (patch) | |
tree | 197f67c2aadfa6758f87855db349a53a60593a67 /src | |
parent | cfb7f5a2e9bae74dd60067a399a222d62e81da2c (diff) |
removed checks and changes involving systray-whitelist and unity because
it works without them on Ubuntu 11.10 & 12.04.
Diffstat (limited to 'src')
-rw-r--r-- | src/leap/app.py | 2 | ||||
-rw-r--r-- | src/leap/baseapp/unitychecks.py | 96 |
2 files changed, 0 insertions, 98 deletions
diff --git a/src/leap/app.py b/src/leap/app.py index b721468f..5ce40ccb 100644 --- a/src/leap/app.py +++ b/src/leap/app.py @@ -7,7 +7,6 @@ from PyQt4.QtGui import (QApplication, QSystemTrayIcon, QMessageBox) from leap import __version__ as VERSION from leap.baseapp.mainwindow import LeapWindow -from leap.baseapp import unitychecks def main(): @@ -49,7 +48,6 @@ def main(): logger.info('Running client version %s', VERSION) app = QApplication(sys.argv) - unitychecks.do_check() if not QSystemTrayIcon.isSystemTrayAvailable(): QMessageBox.critical(None, "Systray", diff --git a/src/leap/baseapp/unitychecks.py b/src/leap/baseapp/unitychecks.py deleted file mode 100644 index 2d06f629..00000000 --- a/src/leap/baseapp/unitychecks.py +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/python2 -# vim: tabstop=8 expandtab shiftwidth=5 softtabstop=4 -""" -modified from code from the starcal2 project -copyright Saeed Rasooli -License: GPL -""" -import logging -import platform -import sys -from subprocess import Popen, PIPE - -logger = logging.getLogger(__name__) - -from leap.base.constants import APP_NAME -from leap.baseapp.dialogs import ErrorDialog - -get_whitelist = lambda: eval( - Popen(['gsettings', 'get', 'com.canonical.Unity.Panel', - 'systray-whitelist'], stdout=PIPE).communicate()[0]) - -set_whitelist = lambda ls: Popen( - ['gsettings', 'set', - 'com.canonical.Unity.Panel', 'systray-whitelist', repr(ls)]) - - -def add_to_whitelist(): - ls = get_whitelist() - if not APP_NAME in ls: - ls.append(APP_NAME) - set_whitelist(ls) - - -def remove_from_whitelist(): - ls = get_whitelist() - if APP_NAME in ls: - ls.remove(APP_NAME) - set_whitelist(ls) - - -def is_unity_running(): - #XXX use psutil instead - (output, error) = Popen( - 'ps aux | grep [u]nity-panel-service', - stdout=PIPE, shell=True).communicate() - output = bool(str(output)) - if not output: - (output, error) = Popen( - 'ps aux | grep [u]nity-2d-panel', - stdout=PIPE, shell=True).communicate() - output = bool(str(output)) - return output - - -def need_to_add(): - if is_unity_running(): - wlist = get_whitelist() - if not (APP_NAME in wlist or 'all' in wlist): - logger.debug('need to add') - return True - return False - - -def add_and_restart(): - add_to_whitelist() - Popen('LANG=en_US.UTF-8 unity', shell=True) - - -MSG = ("Seems that you are using a Unity desktop " - "and %s is not allowed to use Tray icon. " - "Press OK to add %s to Unity's white list " - "and then restart Unity" % (APP_NAME, APP_NAME)) - - -def do_check(): - if platform.system() == "Linux" and need_to_add(): - dialog = ErrorDialog() - dialog.confirmMessage( - MSG, - "add to systray?", - add_and_restart) - - -if __name__ == '__main__': - if len(sys.argv) > 1: - cmd = sys.argv[1] - if cmd == 'add': - add_to_whitelist() - elif cmd == 'rm': - remove_from_whitelist() - elif cmd == 'print': - print get_whitelist() - elif cmd == "check": - from PyQt4.QtGui import QApplication - app = QApplication(sys.argv) - do_check() |