Add code to use kpackagekit or gnome-packagekit according to DESKTOP_SESSION environment variable
This commit is contained in:
parent
7a19d554b3
commit
90ff748b8e
@ -14,7 +14,7 @@ from PyQt4 import QtCore
|
||||
class SystemTrayIcon(QtGui.QSystemTrayIcon):
|
||||
|
||||
def __init__(self, icon, parent=None):
|
||||
global w, menu, contatore, srpm, lista, NetsrpmsArg, nOre
|
||||
global w, menu, contatore, srpm, lista, NetsrpmsArg, nOre, desktop_session
|
||||
nOre = 2
|
||||
srpm = ["skype", "flashplugin", "win32codecs", "msttcorefonts", "b43-firmware"]
|
||||
NetsrpmsArg = "-c"
|
||||
@ -23,7 +23,13 @@ class SystemTrayIcon(QtGui.QSystemTrayIcon):
|
||||
w = parent
|
||||
QtGui.QSystemTrayIcon.__init__(self, icon, parent)
|
||||
menu = QtGui.QMenu(parent)
|
||||
|
||||
|
||||
desktop_session = QtCore.QString(os.getenv('DESKTOP_SESSION'))
|
||||
if desktop_session == 'default':
|
||||
desktop_session = QtCore.QString('kde')
|
||||
if desktop_session.left(3) == 'kde':
|
||||
desktop_session = QtCore.QString('kde')
|
||||
|
||||
# refresh packages cache timer
|
||||
global refreshPackagesTimer, refreshPackagesCacheProcess, checkSRPMSUpdatesTimer, SRPMUpdateProcess
|
||||
refreshPackagesTimer = QtCore.QTimer(self)
|
||||
@ -119,11 +125,16 @@ class SystemTrayIcon(QtGui.QSystemTrayIcon):
|
||||
return result
|
||||
|
||||
def softwareManager(self):
|
||||
softwareManagerProcess.execute("/opt/kde/bin/kpackagekit")
|
||||
if desktop_session == 'kde':
|
||||
softwareManagerProcess.execute("/opt/kde/bin/kpackagekit")
|
||||
else:
|
||||
softwareManagerProcess.execute("/usr/bin/gpk-application")
|
||||
|
||||
def softwareCheckUpgrades(self):
|
||||
softwareCheckUpgradesProcess.start("/opt/kde/bin/kpackagekit", ['--updates'])
|
||||
|
||||
if desktop_session == 'kde':
|
||||
softwareCheckUpgradesProcess.start("/opt/kde/bin/kpackagekit", ['--updates'])
|
||||
else:
|
||||
softwareCheckUpgradesProcess.start("/usr/bin/gpk-update-viewer")
|
||||
def refreshPackagesCache(self):
|
||||
refreshPackagesTimer.stop()
|
||||
refreshPackagesCacheProcess.start("/usr/bin/pkcon", ['refresh'])
|
||||
|
Loading…
Reference in New Issue
Block a user