DE detected in mintmenu, passed to plugins

This commit is contained in:
Clement Lefebvre 2011-03-29 18:50:33 +01:00
parent ee8889548a
commit ae4d79763b
5 changed files with 22 additions and 17 deletions

View File

@ -67,6 +67,8 @@ class MainWindow( object ):
self.path = PATH
sys.path.append( os.path.join( self.path, "plugins") )
self.detect_desktop_environment()
self.icon = ICON
self.toggle = toggleButton
@ -203,6 +205,15 @@ class MainWindow( object ):
print "Setting opacity to: " + str(opacity)
self.window.set_opacity(opacity)
def detect_desktop_environment (self):
self.de = "gnome"
try:
de = commands.getoutput("/usr/lib/linuxmint/mintMenu/detectDE")
if de in ["gnome", "kde", "xfce"]:
self.de = de
except Exception, detail:
print detail
def PopulatePlugins( self ):
self.panesToColor = [ ]
self.headingsToColor = [ ]
@ -233,7 +244,7 @@ class MainWindow( object ):
MyPlugin = X.pluginclass()
else:
# pass mintMenu and togglebutton instance so that the plugin can use it
MyPlugin = X.pluginclass( self, self.toggle )
MyPlugin = X.pluginclass( self, self.toggle, self.de )
if not MyPlugin.icon:
MyPlugin.icon = "gnome-logo-icon.png"

View File

@ -210,12 +210,14 @@ class pluginclass( object ):
fromFav = [ ( "FAVORITES", gtk.TARGET_SAME_APP, TARGET_TYPE_FAV ) ]
@print_timing
def __init__( self, mintMenuWin, toggleButton ):
def __init__( self, mintMenuWin, toggleButton, de ):
self.mintMenuWin = mintMenuWin
self.mainMenus = [ ]
self.toggleButton = toggleButton
self.de = de
# The Glade file for the plugin
self.gladefile = os.path.join( os.path.dirname( __file__ ), "applications.glade" )

View File

@ -21,10 +21,11 @@ gettext.install("mintmenu", "/usr/share/linuxmint/locale")
class pluginclass( object ):
def __init__( self, mintMenuWin, toggleButton ):
def __init__( self, mintMenuWin, toggleButton, de ):
self.mintMenuWin = mintMenuWin
self.toggleButton = toggleButton
self.de = de
# Read GLADE file
gladefile = os.path.join( os.path.dirname( __file__ ), "places.glade" )
@ -67,17 +68,6 @@ class pluginclass( object ):
self.content_holder.set_size_request( self.width, self.height )
self.detect_desktop_environment()
def detect_desktop_environment (self):
self.de = "gnome"
try:
de = commands.getoutput("/usr/lib/linuxmint/mintMenu/detectDE")
if de in ["gnome", "kde", "xfce"]:
self.de = de
except Exception, detail:
print detail
def wake (self) :
if ( self.showtrash == True ):
self.refreshTrash()

View File

@ -18,10 +18,11 @@ class pluginclass:
"""This is the main class for the plugin"""
"""It MUST be named pluginclass"""
def __init__( self, mintMenuWin, toggleButton ):
def __init__( self, mintMenuWin, toggleButton, de ):
self.Win = mintMenuWin
self.toggleButton = toggleButton
self.de = de
#The Glade file for the plugin
self.gladefile = os.path.join( os.path.dirname( __file__ ), "recent.glade" )

View File

@ -17,10 +17,11 @@ gettext.install("mintmenu", "/usr/share/linuxmint/locale")
class pluginclass( object ):
def __init__( self, mintMenuWin, toggleButton ):
def __init__( self, mintMenuWin, toggleButton, de ):
self.mintMenuWin = mintMenuWin
self.toggleButton = toggleButton
self.de = de
# Read GLADE file
gladefile = os.path.join( os.path.dirname( __file__ ), "system_management.glade" )