From ae4d79763b63507c68083d8c4e1d69ea7108fb0a Mon Sep 17 00:00:00 2001 From: Clement Lefebvre Date: Tue, 29 Mar 2011 18:50:33 +0100 Subject: [PATCH] DE detected in mintmenu, passed to plugins --- usr/lib/linuxmint/mintMenu/mintMenu.py | 13 ++++++++++++- .../linuxmint/mintMenu/plugins/applications.py | 4 +++- usr/lib/linuxmint/mintMenu/plugins/places.py | 16 +++------------- usr/lib/linuxmint/mintMenu/plugins/recent.py | 3 ++- .../mintMenu/plugins/system_management.py | 3 ++- 5 files changed, 22 insertions(+), 17 deletions(-) diff --git a/usr/lib/linuxmint/mintMenu/mintMenu.py b/usr/lib/linuxmint/mintMenu/mintMenu.py index 86bd24e..4e2fad4 100755 --- a/usr/lib/linuxmint/mintMenu/mintMenu.py +++ b/usr/lib/linuxmint/mintMenu/mintMenu.py @@ -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 @@ -202,6 +204,15 @@ class MainWindow( object ): opacity = float(self.opacity) / float(100) 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 = [ ] @@ -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" diff --git a/usr/lib/linuxmint/mintMenu/plugins/applications.py b/usr/lib/linuxmint/mintMenu/plugins/applications.py index 7ed19ad..d738195 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/applications.py +++ b/usr/lib/linuxmint/mintMenu/plugins/applications.py @@ -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" ) diff --git a/usr/lib/linuxmint/mintMenu/plugins/places.py b/usr/lib/linuxmint/mintMenu/plugins/places.py index 9050333..c38c1f8 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/places.py +++ b/usr/lib/linuxmint/mintMenu/plugins/places.py @@ -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" ) @@ -65,18 +66,7 @@ class pluginclass( object ): self.GetGconfEntries() - 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 + self.content_holder.set_size_request( self.width, self.height ) def wake (self) : if ( self.showtrash == True ): diff --git a/usr/lib/linuxmint/mintMenu/plugins/recent.py b/usr/lib/linuxmint/mintMenu/plugins/recent.py index 009fc1d..7db1a2e 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/recent.py +++ b/usr/lib/linuxmint/mintMenu/plugins/recent.py @@ -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" ) diff --git a/usr/lib/linuxmint/mintMenu/plugins/system_management.py b/usr/lib/linuxmint/mintMenu/plugins/system_management.py index 3247125..2006093 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/system_management.py +++ b/usr/lib/linuxmint/mintMenu/plugins/system_management.py @@ -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" )