Switched support from Gnome/Bonobo to MATE/Component

This commit is contained in:
Clement Lefebvre 2011-11-18 10:42:20 +00:00
parent e83ea10fe4
commit 3b92de62d8
12 changed files with 105 additions and 118 deletions

4
debian/dirs vendored
View File

@ -1,6 +1,6 @@
usr/lib/linuxmint usr/lib/linuxmint
usr/lib/linuxmint/mintMenu usr/lib/linuxmint/mintMenu
usr/lib/linuxmint/mintMenu/plugins usr/lib/linuxmint/mintMenu/plugins
usr/lib/bonobo usr/lib/matecomponent
usr/lib/bonobo/servers usr/lib/matecomponent/servers

View File

@ -4,9 +4,9 @@ import sys, os
if len(sys.argv) > 1: if len(sys.argv) > 1:
if (sys.argv[1] in ["clean", "clear", "reset", "--clean", "--clear", "--reset"]): if (sys.argv[1] in ["clean", "clear", "reset", "--clean", "--clear", "--reset"]):
os.system("gconftool-2 --recursive-unset /apps/mintMenu") os.system("mateconftool-2 --recursive-unset /apps/mintMenu")
os.system("rm -rf ~/.linuxmint/mintMenu") os.system("rm -rf ~/.linuxmint/mintMenu")
os.system("gconftool-2 --recursive-unset /apps/mintMenu") os.system("mateconftool-2 --recursive-unset /apps/mintMenu")
os.system("rm -rf ~/.linuxmint/mintMenu") os.system("rm -rf ~/.linuxmint/mintMenu")
print "All mintMenu settings are now restored to default" print "All mintMenu settings are now restored to default"
else: else:

View File

@ -1,7 +0,0 @@
#!/bin/bash
if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde;
elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;
elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/null 2>&1` ; then DE=gnome;
elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
fi
echo $DE

View File

@ -7,9 +7,9 @@ try:
import pango import pango
import os import os
import commands import commands
import gnomeapplet import mateapplet
import gettext import gettext
import gnomevfs import matevfs
import traceback import traceback
import time import time
import gc import gc
@ -54,10 +54,9 @@ ICON = "/usr/lib/linuxmint/mintMenu/visualisation-logo.png"
sys.path.append( os.path.join( PATH , "plugins") ) sys.path.append( os.path.join( PATH , "plugins") )
# FIX: Get the window manager from the GDMSESSION environment variable, fallback to GNOME if it's not set windowManager = os.getenv("DESKTOP_SESSION")
windowManager = os.getenv("GDMSESSION")
if not windowManager: if not windowManager:
windowManager = "GNOME" windowManager = "MATE"
xdg.Config.setWindowManager( windowManager.upper() ) xdg.Config.setWindowManager( windowManager.upper() )
from easybuttons import iconManager from easybuttons import iconManager
@ -213,10 +212,10 @@ class MainWindow( object ):
self.window.set_opacity(opacity) self.window.set_opacity(opacity)
def detect_desktop_environment (self): def detect_desktop_environment (self):
self.de = "gnome" self.de = "mate"
try: try:
de = commands.getoutput("/usr/lib/linuxmint/mintMenu/detectDE") de = os.environ["DESKTOP_SESSION"]
if de in ["gnome", "kde", "xfce"]: if de in ["gnome", "gnome-shell", "mate", "kde", "xfce"]:
self.de = de self.de = de
except Exception, detail: except Exception, detail:
print detail print detail
@ -254,7 +253,7 @@ class MainWindow( object ):
MyPlugin = X.pluginclass( self, self.toggle, self.de ) MyPlugin = X.pluginclass( self, self.toggle, self.de )
if not MyPlugin.icon: if not MyPlugin.icon:
MyPlugin.icon = "gnome-logo-icon.png" MyPlugin.icon = "mate-logo-icon.png"
#if hasattr( MyPlugin, "hideseparator" ) and not MyPlugin.hideseparator: #if hasattr( MyPlugin, "hideseparator" ) and not MyPlugin.hideseparator:
# Image1 = gtk.Image() # Image1 = gtk.Image()
@ -282,7 +281,7 @@ class MainWindow( object ):
MyPlugin.content_holder.add( errorLabel ) MyPlugin.content_holder.add( errorLabel )
MyPlugin.add( MyPlugin.content_holder ) MyPlugin.add( MyPlugin.content_holder )
MyPlugin.width = 270 MyPlugin.width = 270
MyPlugin.icon = 'gnome-logo-icon.png' MyPlugin.icon = 'mate-logo-icon.png'
print u"Unable to load " + plugin + " plugin :-(" print u"Unable to load " + plugin + " plugin :-("
@ -527,12 +526,12 @@ class MenuWin( object ):
self.gconf.notifyAdd( "applet_icon_size", self.gconfEntriesChanged ) self.gconf.notifyAdd( "applet_icon_size", self.gconfEntriesChanged )
self.getGconfEntries() self.getGconfEntries()
self.gconftheme = EasyGConf( "/desktop/gnome/interface/" ) self.gconftheme = EasyGConf( "/desktop/mate/interface/" )
self.gconftheme.notifyAdd( "gtk_theme", self.changeTheme ) self.gconftheme.notifyAdd( "gtk_theme", self.changeTheme )
self.createPanelButton() self.createPanelButton()
self.applet.set_applet_flags( gnomeapplet.EXPAND_MINOR ) self.applet.set_applet_flags( mateapplet.EXPAND_MINOR )
self.applet.connect( "button-press-event", self.showMenu ) self.applet.connect( "button-press-event", self.showMenu )
self.applet.connect( "change-orient", self.changeOrientation ) self.applet.connect( "change-orient", self.changeOrientation )
self.applet.connect( "change-background", self.changeBackground ) self.applet.connect( "change-background", self.changeBackground )
@ -596,20 +595,20 @@ class MenuWin( object ):
self.systemlabel.set_tooltip_text(tooltip) self.systemlabel.set_tooltip_text(tooltip)
self.button_icon.set_tooltip_text(tooltip) self.button_icon.set_tooltip_text(tooltip)
if self.applet.get_orient() == gnomeapplet.ORIENT_UP or self.applet.get_orient() == gnomeapplet.ORIENT_DOWN: if self.applet.get_orient() == mateapplet.ORIENT_UP or self.applet.get_orient() == mateapplet.ORIENT_DOWN:
self.button_box = gtk.HBox() self.button_box = gtk.HBox()
self.button_box.pack_start( self.button_icon, False, False ) self.button_box.pack_start( self.button_icon, False, False )
self.button_box.pack_start( self.systemlabel, False, False ) self.button_box.pack_start( self.systemlabel, False, False )
self.button_icon.set_padding( 5, 0 ) self.button_icon.set_padding( 5, 0 )
# if we have a vertical panel # if we have a vertical panel
elif self.applet.get_orient() == gnomeapplet.ORIENT_LEFT: elif self.applet.get_orient() == mateapplet.ORIENT_LEFT:
self.button_box = gtk.VBox() self.button_box = gtk.VBox()
self.systemlabel.set_angle( 270 ) self.systemlabel.set_angle( 270 )
self.button_box.pack_start( self.systemlabel ) self.button_box.pack_start( self.systemlabel )
self.button_box.pack_start( self.button_icon ) self.button_box.pack_start( self.button_icon )
self.button_icon.set_padding( 5, 0 ) self.button_icon.set_padding( 5, 0 )
elif self.applet.get_orient() == gnomeapplet.ORIENT_RIGHT: elif self.applet.get_orient() == mateapplet.ORIENT_RIGHT:
self.button_box = gtk.VBox() self.button_box = gtk.VBox()
self.systemlabel.set_angle( 90 ) self.systemlabel.set_angle( 90 )
self.button_box.pack_start( self.button_icon ) self.button_box.pack_start( self.button_icon )
@ -640,9 +639,9 @@ class MenuWin( object ):
rc_style = gtk.RcStyle() rc_style = gtk.RcStyle()
self.applet.modify_style(rc_style) self.applet.modify_style(rc_style)
if gnomeapplet.COLOR_BACKGROUND == type: if mateapplet.COLOR_BACKGROUND == type:
applet.modify_bg( gtk.STATE_NORMAL, color ) applet.modify_bg( gtk.STATE_NORMAL, color )
elif gnomeapplet.PIXMAP_BACKGROUND == type: elif mateapplet.PIXMAP_BACKGROUND == type:
style = applet.style style = applet.style
style.bg_pixmap[ gtk.STATE_NORMAL ] = pixmap style.bg_pixmap[ gtk.STATE_NORMAL ] = pixmap
applet.set_style( style ) applet.set_style( style )
@ -654,7 +653,7 @@ class MenuWin( object ):
def applyTheme(self): def applyTheme(self):
style_settings = gtk.settings_get_default() style_settings = gtk.settings_get_default()
desktop_theme = self.gconf.get( "string", '/desktop/gnome/interface/gtk_theme', "") desktop_theme = self.gconf.get( "string", '/desktop/mate/interface/gtk_theme', "")
if self.theme_name == "default": if self.theme_name == "default":
style_settings.set_property("gtk-theme-name", desktop_theme) style_settings.set_property("gtk-theme-name", desktop_theme)
else: else:
@ -665,17 +664,17 @@ class MenuWin( object ):
def changeOrientation( self, *args, **kargs ): def changeOrientation( self, *args, **kargs ):
if self.applet.get_orient() == gnomeapplet.ORIENT_UP or self.applet.get_orient() == gnomeapplet.ORIENT_DOWN: if self.applet.get_orient() == mateapplet.ORIENT_UP or self.applet.get_orient() == mateapplet.ORIENT_DOWN:
tmpbox = gtk.HBox() tmpbox = gtk.HBox()
self.systemlabel.set_angle( 0 ) self.systemlabel.set_angle( 0 )
self.button_box.reorder_child( self.button_icon, 0 ) self.button_box.reorder_child( self.button_icon, 0 )
self.button_icon.set_padding( 5, 0 ) self.button_icon.set_padding( 5, 0 )
elif self.applet.get_orient() == gnomeapplet.ORIENT_LEFT: elif self.applet.get_orient() == mateapplet.ORIENT_LEFT:
tmpbox = gtk.VBox() tmpbox = gtk.VBox()
self.systemlabel.set_angle( 270 ) self.systemlabel.set_angle( 270 )
self.button_box.reorder_child( self.button_icon, 1 ) self.button_box.reorder_child( self.button_icon, 1 )
self.button_icon.set_padding( 0, 5 ) self.button_icon.set_padding( 0, 5 )
elif self.applet.get_orient() == gnomeapplet.ORIENT_RIGHT: elif self.applet.get_orient() == mateapplet.ORIENT_RIGHT:
tmpbox = gtk.VBox() tmpbox = gtk.VBox()
self.systemlabel.set_angle( 90 ) self.systemlabel.set_angle( 90 )
self.button_box.reorder_child( self.button_icon, 0 ) self.button_box.reorder_child( self.button_icon, 0 )
@ -720,7 +719,7 @@ class MenuWin( object ):
self.button_icon.show() self.button_icon.show()
# This code calculates width and height for the button_box # This code calculates width and height for the button_box
# and takes the orientation in account # and takes the orientation in account
if self.applet.get_orient() == gnomeapplet.ORIENT_UP or self.applet.get_orient() == gnomeapplet.ORIENT_DOWN: if self.applet.get_orient() == mateapplet.ORIENT_UP or self.applet.get_orient() == mateapplet.ORIENT_DOWN:
if self.hideIcon: if self.hideIcon:
self.applet.set_size_request( self.systemlabel.size_request()[0] + 2, -1 ) self.applet.set_size_request( self.systemlabel.size_request()[0] + 2, -1 )
else: else:
@ -764,7 +763,7 @@ class MenuWin( object ):
def showPreferences( self, uicomponent, verb ): def showPreferences( self, uicomponent, verb ):
# Execute( "gconf-editor /apps/mintMenu" ) # Execute( "mateconf-editor /apps/mintMenu" )
Execute( os.path.join( PATH, "mintMenuConfig.py" ) ) Execute( os.path.join( PATH, "mintMenuConfig.py" ) )
def showMenuEditor( self, uicomponent, verb ): def showMenuEditor( self, uicomponent, verb ):
@ -805,7 +804,7 @@ class MenuWin( object ):
screenHeight = gtk.gdk.screen_height() screenHeight = gtk.gdk.screen_height()
screenWidth = gtk.gdk.screen_width() screenWidth = gtk.gdk.screen_width()
if self.applet.get_orient() == gnomeapplet.ORIENT_UP or self.applet.get_orient() == gnomeapplet.ORIENT_DOWN: if self.applet.get_orient() == mateapplet.ORIENT_UP or self.applet.get_orient() == mateapplet.ORIENT_DOWN:
if entryX + ourWidth < screenWidth or entryX + entryWidth / 2 < screenWidth / 2: if entryX + ourWidth < screenWidth or entryX + entryWidth / 2 < screenWidth / 2:
# Align to the left of the entry # Align to the left of the entry
newX = entryX newX = entryX
@ -852,7 +851,7 @@ if len(sys.argv) == 2 and sys.argv[1] == "run-in-window":
main_window = gtk.Window( gtk.WINDOW_TOPLEVEL ) main_window = gtk.Window( gtk.WINDOW_TOPLEVEL )
main_window.set_title( NAME ) main_window.set_title( NAME )
main_window.connect( "destroy", quit_all ) main_window.connect( "destroy", quit_all )
app = gnomeapplet.Applet() app = mateapplet.Applet()
menu_factory( app, None ) menu_factory( app, None )
app.reparent( main_window ) app.reparent( main_window )
main_window.show() main_window.show()
@ -860,6 +859,6 @@ if len(sys.argv) == 2 and sys.argv[1] == "run-in-window":
gtk.main() gtk.main()
gtk.gdk.threads_leave() gtk.gdk.threads_leave()
else: else:
gnomeapplet.bonobo_factory("OAFIID:GNOME_mintMenu_Factory", mateapplet.bonobo_factory("OAFIID:MATE_mintMenu_Factory",
gnomeapplet.Applet.__gtype__, mateapplet.Applet.__gtype__,
"mintMenu", "0", menu_factory) "mintMenu", "0", menu_factory)

View File

@ -275,7 +275,7 @@ class mintMenuConfig( object ):
wTree.get_widget("removeButton").connect("clicked", self.removePlace) wTree.get_widget("removeButton").connect("clicked", self.removePlace)
#Detect themes and show theme here #Detect themes and show theme here
theme_name = commands.getoutput("gconftool-2 --get /apps/mintMenu/theme_name").strip() theme_name = commands.getoutput("mateconftool-2 --get /apps/mintMenu/theme_name").strip()
themes = commands.getoutput("find /usr/share/themes -name gtkrc") themes = commands.getoutput("find /usr/share/themes -name gtkrc")
themes = themes.split("\n") themes = themes.split("\n")
model = gtk.ListStore(str, str) model = gtk.ListStore(str, str)
@ -300,22 +300,22 @@ class mintMenuConfig( object ):
model = widget.get_model() model = widget.get_model()
iter = widget.get_active_iter() iter = widget.get_active_iter()
theme_name = model.get_value(iter, 1) theme_name = model.get_value(iter, 1)
os.system("gconftool-2 --type string --set /apps/mintMenu/theme_name \"%s\"" % theme_name) os.system("mateconftool-2 --type string --set /apps/mintMenu/theme_name \"%s\"" % theme_name)
def getPluginsToggle(self): def getPluginsToggle(self):
if (commands.getoutput("gconftool-2 --get /apps/mintMenu/plugins_list | grep recent | wc -l") == "0"): if (commands.getoutput("mateconftool-2 --get /apps/mintMenu/plugins_list | grep recent | wc -l") == "0"):
self.showRecentPlugin.set_active(False) self.showRecentPlugin.set_active(False)
else: else:
self.showRecentPlugin.set_active(True) self.showRecentPlugin.set_active(True)
if (commands.getoutput("gconftool-2 --get /apps/mintMenu/plugins_list | grep applications | wc -l") == "0"): if (commands.getoutput("mateconftool-2 --get /apps/mintMenu/plugins_list | grep applications | wc -l") == "0"):
self.showApplicationsPlugin.set_active(False) self.showApplicationsPlugin.set_active(False)
else: else:
self.showApplicationsPlugin.set_active(True) self.showApplicationsPlugin.set_active(True)
if (commands.getoutput("gconftool-2 --get /apps/mintMenu/plugins_list | grep system_management | wc -l") == "0"): if (commands.getoutput("mateconftool-2 --get /apps/mintMenu/plugins_list | grep system_management | wc -l") == "0"):
self.showSystemPlugin.set_active(False) self.showSystemPlugin.set_active(False)
else: else:
self.showSystemPlugin.set_active(True) self.showSystemPlugin.set_active(True)
if (commands.getoutput("gconftool-2 --get /apps/mintMenu/plugins_list | grep places | wc -l") == "0"): if (commands.getoutput("mateconftool-2 --get /apps/mintMenu/plugins_list | grep places | wc -l") == "0"):
self.showPlacesPlugin.set_active(False) self.showPlacesPlugin.set_active(False)
else: else:
self.showPlacesPlugin.set_active(True) self.showPlacesPlugin.set_active(True)
@ -339,7 +339,7 @@ class mintMenuConfig( object ):
layout = layout + plugin + "," layout = layout + plugin + ","
if len(layout) > 0 and layout[-1] == ",": if len(layout) > 0 and layout[-1] == ",":
layout = layout[0:-1] layout = layout[0:-1]
os.system("gconftool-2 --type list --list-type string --set /apps/mintMenu/plugins_list [%s]" % layout) os.system("mateconftool-2 --type list --list-type string --set /apps/mintMenu/plugins_list [%s]" % layout)
def setShowButtonIcon( self, value ): def setShowButtonIcon( self, value ):
self.showButtonIcon.set_active(not value ) self.showButtonIcon.set_active(not value )

View File

@ -4,12 +4,11 @@ import gtk
import gtk.glade import gtk.glade
import gobject import gobject
import os import os
import gconf import mateconf
import fnmatch import fnmatch
import time import time
import string import string
import gettext import gettext
import gnomevfs
import threading import threading
import commands import commands
import subprocess import subprocess
@ -23,7 +22,7 @@ from easyfiles import *
#from filemonitor import monitor as filemonitor #from filemonitor import monitor as filemonitor
#import xdg.Menu #import xdg.Menu
import gmenu import matemenu
from user import home from user import home
@ -141,7 +140,7 @@ def rel_path(target, base=os.curdir):
class Menu: class Menu:
def __init__( self, MenuToLookup ): def __init__( self, MenuToLookup ):
self.tree = gmenu.lookup_tree( MenuToLookup ) self.tree = matemenu.lookup_tree( MenuToLookup )
self.directory = self.tree.get_root_directory() self.directory = self.tree.get_root_directory()
def getMenus( self, parent=None ): def getMenus( self, parent=None ):
@ -150,18 +149,18 @@ class Menu:
yield self.tree.root yield self.tree.root
else: else:
for menu in parent.get_contents(): for menu in parent.get_contents():
if menu.get_type() == gmenu.TYPE_DIRECTORY and self.__isVisible( menu ): if menu.get_type() == matemenu.TYPE_DIRECTORY and self.__isVisible( menu ):
yield menu yield menu
def getItems( self, menu ): def getItems( self, menu ):
for item in menu.get_contents(): for item in menu.get_contents():
if item.get_type() == gmenu.TYPE_ENTRY and item.get_desktop_file_id()[-19:] != '-usercustom.desktop' and self.__isVisible( item ): if item.get_type() == matemenu.TYPE_ENTRY and item.get_desktop_file_id()[-19:] != '-usercustom.desktop' and self.__isVisible( item ):
yield item yield item
def __isVisible( self, item ): def __isVisible( self, item ):
if item.get_type() == gmenu.TYPE_ENTRY: if item.get_type() == matemenu.TYPE_ENTRY:
return not ( item.get_is_excluded() or item.get_is_nodisplay() ) return not ( item.get_is_excluded() or item.get_is_nodisplay() )
if item.get_type() == gmenu.TYPE_DIRECTORY and len( item.get_contents() ): if item.get_type() == matemenu.TYPE_DIRECTORY and len( item.get_contents() ):
return True return True
@ -332,12 +331,12 @@ class pluginclass( object ):
def get_panel(self): def get_panel(self):
self.panel = None self.panel = None
self.panel_position = 0 self.panel_position = 0
appletidlist = gconf.client_get_default().get_list("/apps/panel/general/applet_id_list", "string") appletidlist = mateconf.client_get_default().get_list("/apps/panel/general/applet_id_list", "string")
for applet in appletidlist: for applet in appletidlist:
bonobo_id = gconf.client_get_default().get_string("/apps/panel/applets/" + applet + "/bonobo_iid") bonobo_id = mateconf.client_get_default().get_string("/apps/panel/applets/" + applet + "/bonobo_iid")
if bonobo_id == "OAFIID:GNOME_mintMenu": if bonobo_id == "OAFIID:MATE_mintMenu":
self.panel = gconf.client_get_default().get_string("/apps/panel/applets/" + applet + "/toplevel_id") self.panel = mateconf.client_get_default().get_string("/apps/panel/applets/" + applet + "/toplevel_id")
self.panel_position = gconf.client_get_default().get_int("/apps/panel/applets/" + applet + "/position") + 1 self.panel_position = mateconf.client_get_default().get_int("/apps/panel/applets/" + applet + "/position") + 1
def apturl_install(self, widget, pkg_name): def apturl_install(self, widget, pkg_name):
os.system("xdg-open apt://" + pkg_name + " &") os.system("xdg-open apt://" + pkg_name + " &")
@ -489,10 +488,10 @@ class pluginclass( object ):
self.minimized = self.gconf.get( "bool", "minimized", False ) self.minimized = self.gconf.get( "bool", "minimized", False )
# Search tool # Search tool
self.searchtool = self.gconf.get( "string", "search_command", "gnome-search-tool --named \"%s\" --start" ) self.searchtool = self.gconf.get( "string", "search_command", "mate-search-tool --named \"%s\" --start" )
if self.searchtool == "beagle-search SEARCH_STRING": if self.searchtool == "beagle-search SEARCH_STRING":
self.searchtool = "gnome-search-tool --named \"%s\" --start" self.searchtool = "mate-search-tool --named \"%s\" --start"
self.gconf.set( "string", "search_command", "gnome-search-tool --named \"%s\" --start" ) self.gconf.set( "string", "search_command", "mate-search-tool --named \"%s\" --start" )
# Plugin icon # Plugin icon
self.icon = self.gconf.get( "string", "icon", "applications-accessories" ) self.icon = self.gconf.get( "string", "icon", "applications-accessories" )
@ -890,7 +889,7 @@ class pluginclass( object ):
removeFromFavMenuItem.connect( "activate", self.onFavoritesRemove, widget ) removeFromFavMenuItem.connect( "activate", self.onFavoritesRemove, widget )
propsMenuItem.connect( "activate", self.onPropsApp, widget) propsMenuItem.connect( "activate", self.onPropsApp, widget)
if self.de == "gnome": if self.de == "mate":
mTree.get_widget("favoritesMenu").append(desktopMenuItem) mTree.get_widget("favoritesMenu").append(desktopMenuItem)
mTree.get_widget("favoritesMenu").append(panelMenuItem) mTree.get_widget("favoritesMenu").append(panelMenuItem)
mTree.get_widget("favoritesMenu").append(separator1) mTree.get_widget("favoritesMenu").append(separator1)
@ -943,7 +942,7 @@ class pluginclass( object ):
separator3 = gtk.SeparatorMenuItem() separator3 = gtk.SeparatorMenuItem()
propsMenuItem = gtk.MenuItem(_("Edit properties")) propsMenuItem = gtk.MenuItem(_("Edit properties"))
if self.de == "gnome": if self.de == "mate":
mTree.get_widget("applicationsMenu").append(desktopMenuItem) mTree.get_widget("applicationsMenu").append(desktopMenuItem)
mTree.get_widget("applicationsMenu").append(panelMenuItem) mTree.get_widget("applicationsMenu").append(panelMenuItem)
mTree.get_widget("applicationsMenu").append(separator1) mTree.get_widget("applicationsMenu").append(separator1)
@ -1093,7 +1092,7 @@ class pluginclass( object ):
def search_dictionary(self, widget): def search_dictionary(self, widget):
text = self.searchEntry.get_text() text = self.searchEntry.get_text()
os.system("gnome-dictionary \"" + text + "\" &") os.system("mate-dictionary \"" + text + "\" &")
self.mintMenuWin.hide() self.mintMenuWin.hide()
def search_mint_tutorials(self, widget): def search_mint_tutorials(self, widget):
@ -1148,7 +1147,7 @@ class pluginclass( object ):
def add_to_panel(self, widget, desktopEntry): def add_to_panel(self, widget, desktopEntry):
import random import random
object_name = "mintmenu_"+''.join([random.choice('abcdefghijklmnopqrstuvwxyz0123456789') for x in xrange(8)]) object_name = "mintmenu_"+''.join([random.choice('abcdefghijklmnopqrstuvwxyz0123456789') for x in xrange(8)])
new_directory = home + "/.gnome2/panel2.d/default/launchers/" new_directory = home + "/.mate2/panel2.d/default/launchers/"
os.system("mkdir -p " + new_directory) os.system("mkdir -p " + new_directory)
new_file = new_directory + object_name new_file = new_directory + object_name
@ -1158,7 +1157,7 @@ class pluginclass( object ):
# Add to Gnome/GConf # Add to Gnome/GConf
object_dir = "/apps/panel/objects/" object_dir = "/apps/panel/objects/"
object_client = gconf.client_get_default() object_client = mateconf.client_get_default()
object_client.set_string(object_dir + object_name +"/"+ "menu_path", "applications:/") object_client.set_string(object_dir + object_name +"/"+ "menu_path", "applications:/")
object_client.set_bool(object_dir + object_name +"/"+ "locked", False) object_client.set_bool(object_dir + object_name +"/"+ "locked", False)
@ -1177,7 +1176,7 @@ class pluginclass( object ):
launchers_list = object_client.get_list("/apps/panel/general/object_id_list", "string") launchers_list = object_client.get_list("/apps/panel/general/object_id_list", "string")
launchers_list.append(object_name) launchers_list.append(object_name)
object_client.set_list("/apps/panel/general/object_id_list", gconf.VALUE_STRING, launchers_list) object_client.set_list("/apps/panel/general/object_id_list", mateconf.VALUE_STRING, launchers_list)
def delete_from_menu(self, widget, desktopEntry): def delete_from_menu(self, widget, desktopEntry):
try: try:
@ -1220,7 +1219,7 @@ class pluginclass( object ):
self.mintMenuWin.hide() self.mintMenuWin.hide()
gtk.gdk.flush() gtk.gdk.flush()
editProcess = subprocess.Popen(["/usr/bin/gnome-desktop-item-edit", filePath]) editProcess = subprocess.Popen(["/usr/bin/mate-desktop-item-edit", filePath])
subprocess.Popen.communicate(editProcess) subprocess.Popen.communicate(editProcess)
if newFileFlag: if newFileFlag:
@ -1334,10 +1333,10 @@ class pluginclass( object ):
location = string.join( location.split( "%20" ) ) location = string.join( location.split( "%20" ) )
if location.startswith( "file" ): if location.startswith( "file" ):
ButtonIcon = "gnome-fs-directory" ButtonIcon = "mate-fs-directory"
if location.startswith( "smb" ) or location.startswith( "ssh" ) or location.startswith( "network" ): if location.startswith( "smb" ) or location.startswith( "ssh" ) or location.startswith( "network" ):
ButtonIcon = "gnome-fs-network" ButtonIcon = "mate-fs-network"
#For Special locations #For Special locations
if location == "x-nautilus-desktop:///computer": if location == "x-nautilus-desktop:///computer":
@ -1706,7 +1705,7 @@ class pluginclass( object ):
# Reload the menufiles from the filesystem # Reload the menufiles from the filesystem
def loadMenuFiles( self ): def loadMenuFiles( self ):
self.menuFiles = [] self.menuFiles = []
for mainitems in [ "applications.menu", "settings.menu" ]: for mainitems in [ "mate-applications.menu", "mate-settings.menu" ]:
self.menuFiles.append( Menu( mainitems) ) self.menuFiles.append( Menu( mainitems) )
# Build a list of all categories in the menu ( [ { "name", "icon", tooltip" } ] # Build a list of all categories in the menu ( [ { "name", "icon", tooltip" } ]
@ -1717,7 +1716,7 @@ class pluginclass( object ):
for menu in self.menuFiles: for menu in self.menuFiles:
for child in menu.directory.get_contents(): for child in menu.directory.get_contents():
if child.get_type() == gmenu.TYPE_DIRECTORY: if child.get_type() == matemenu.TYPE_DIRECTORY:
icon = str(child.icon) icon = str(child.icon)
#if (icon == "preferences-system"): #if (icon == "preferences-system"):
# self.adminMenu = child.name # self.adminMenu = child.name
@ -1734,27 +1733,27 @@ class pluginclass( object ):
def find_applications_recursively(app_list, directory, catName): def find_applications_recursively(app_list, directory, catName):
for item in directory.get_contents(): for item in directory.get_contents():
if item.get_type() == gmenu.TYPE_ENTRY: if item.get_type() == matemenu.TYPE_ENTRY:
print "=======>>> " + str(item.name) + " = " + str(catName) print "=======>>> " + str(item.name) + " = " + str(catName)
app_list.append( { "entry": item, "category": catName } ) app_list.append( { "entry": item, "category": catName } )
elif item.get_type() == gmenu.TYPE_DIRECTORY: elif item.get_type() == matemenu.TYPE_DIRECTORY:
find_applications_recursively(app_list, item, catName) find_applications_recursively(app_list, item, catName)
for menu in self.menuFiles: for menu in self.menuFiles:
directory = menu.directory directory = menu.directory
for entry in directory.get_contents(): for entry in directory.get_contents():
if entry.get_type() == gmenu.TYPE_DIRECTORY and len(entry.get_contents()): if entry.get_type() == matemenu.TYPE_DIRECTORY and len(entry.get_contents()):
#Entry is a top-level category #Entry is a top-level category
#catName = entry.name #catName = entry.name
#icon = str(entry.icon) #icon = str(entry.icon)
#if (icon == "applications-system" or icon == "applications-other"): #if (icon == "applications-system" or icon == "applications-other"):
# catName = self.adminMenu # catName = self.adminMenu
for item in entry.get_contents(): for item in entry.get_contents():
if item.get_type() == gmenu.TYPE_DIRECTORY: if item.get_type() == matemenu.TYPE_DIRECTORY:
find_applications_recursively(newApplicationsList, item, entry.name) find_applications_recursively(newApplicationsList, item, entry.name)
elif item.get_type() == gmenu.TYPE_ENTRY: elif item.get_type() == matemenu.TYPE_ENTRY:
newApplicationsList.append( { "entry": item, "category": entry.name } ) newApplicationsList.append( { "entry": item, "category": entry.name } )
#elif entry.get_type() == gmenu.TYPE_ENTRY: #elif entry.get_type() == matemenu.TYPE_ENTRY:
# if not (entry.get_is_excluded() or entry.get_is_nodisplay()): # if not (entry.get_is_excluded() or entry.get_is_nodisplay()):
# print "=======>>> " + item.name + " = top level" # print "=======>>> " + item.name + " = top level"
# newApplicationsList.append( { "entry": item, "category": "" } ) # newApplicationsList.append( { "entry": item, "category": "" } )

View File

@ -2,11 +2,11 @@
import gtk import gtk
import pango import pango
import gnomedesktop import matedesktop
import gobject import gobject
import os.path import os.path
import shutil import shutil
import gnomevfs import matevfs
import re import re
from execute import * from execute import *
import xdg.DesktopEntry import xdg.DesktopEntry
@ -286,7 +286,7 @@ class ApplicationLauncher( easyButton ):
self.appExec = desktopItem.getExec() self.appExec = desktopItem.getExec()
self.appIconName = desktopItem.getIcon() self.appIconName = desktopItem.getIcon()
self.appCategories = desktopItem.getCategories() self.appCategories = desktopItem.getCategories()
self.appGnomeDocPath = desktopItem.get( "X-GNOME-DocPath" ) or "" self.appGnomeDocPath = desktopItem.get( "X-MATE-DocPath" ) or ""
self.useTerminal = desktopItem.getTerminal() self.useTerminal = desktopItem.getTerminal()
if not self.appGnomeDocPath: if not self.appGnomeDocPath:
@ -396,11 +396,11 @@ class ApplicationLauncher( easyButton ):
shutil.copyfile( self.desktopFile, self.startupFilePath ) shutil.copyfile( self.desktopFile, self.startupFilePath )
# Remove %u, etc. from Exec entry, because gnome will not replace them when it starts the app # Remove %u, etc. from Exec entry, because gnome will not replace them when it starts the app
item = gnomedesktop.item_new_from_uri( self.startupFilePath, gnomedesktop.LOAD_ONLY_IF_EXISTS ) item = matedesktop.item_new_from_uri( self.startupFilePath, matedesktop.LOAD_ONLY_IF_EXISTS )
if item: if item:
r = re.compile("%[A-Za-z]"); r = re.compile("%[A-Za-z]");
tmp = r.sub("", item.get_string( gnomedesktop.KEY_EXEC ) ).strip() tmp = r.sub("", item.get_string( matedesktop.KEY_EXEC ) ).strip()
item.set_string( gnomedesktop.KEY_EXEC, tmp ) item.set_string( matedesktop.KEY_EXEC, tmp )
item.save( self.startupFilePath, 0 ) item.save( self.startupFilePath, 0 )
def removeFromStartup( self ): def removeFromStartup( self ):
@ -431,12 +431,12 @@ class ApplicationLauncher( easyButton ):
dn = os.path.dirname( self.appGnomeDocPath ) dn = os.path.dirname( self.appGnomeDocPath )
if self.appGnomeDocPath[0:6] != "ghelp:": if self.appGnomeDocPath[0:6] != "ghelp:":
self.appGnomeDocPath = "ghelp:" + self.appGnomeDocPath self.appGnomeDocPath = "ghelp:" + self.appGnomeDocPath
gnomevfs.url_show( self.appGnomeDocPath ) matevfs.url_show( self.appGnomeDocPath )
elif self.appKdeDocPath: elif self.appKdeDocPath:
if self.appKdeDocPath[0:6] != "help:/" and self.appKdeDocPath[0:6] != "file:/": if self.appKdeDocPath[0:6] != "help:/" and self.appKdeDocPath[0:6] != "file:/":
self.appKdeDocPath = "help:/" + self.appKdeDocPath self.appKdeDocPath = "help:/" + self.appKdeDocPath
if self.appKdeDocPath[0:6] == "file:/": if self.appKdeDocPath[0:6] == "file:/":
gnomevfs.url_show( self.appKdeDocPath ) matevfs.url_show( self.appKdeDocPath )
else: else:
Execute( [ "khelpcenter", self.appKdeDocPath ] ) Execute( [ "khelpcenter", self.appKdeDocPath ] )

View File

@ -1,18 +1,18 @@
#!/usr/bin/env python #!/usr/bin/env python
import gconf import mateconf
class EasyGConf: class EasyGConf:
def __init__( self, gconfDir = None, client = None ): def __init__( self, gconfDir = None, client = None ):
if not client: if not client:
client = gconf.client_get_default() client = mateconf.client_get_default()
self.client = client self.client = client
self.gconfDir = gconfDir self.gconfDir = gconfDir
self.client.add_dir( self.gconfDir[:-1], gconf.CLIENT_PRELOAD_NONE ) self.client.add_dir( self.gconfDir[:-1], mateconf.CLIENT_PRELOAD_NONE )
self.handlerIds = [ ] self.handlerIds = [ ]

View File

@ -3,8 +3,6 @@
import gtk import gtk
import gtk.glade import gtk.glade
import os import os
import gconf
import gnomevfs
import string import string
import gettext import gettext
import commands import commands
@ -132,7 +130,7 @@ class pluginclass( object ):
# Hide vertical dotted separator # Hide vertical dotted separator
self.hideseparator = self.gconf.get( "bool", "hide_separator", False ) self.hideseparator = self.gconf.get( "bool", "hide_separator", False )
# Plugin icon # Plugin icon
self.icon = self.gconf.get( "string", 'icon', "gnome-fs-directory.png" ) self.icon = self.gconf.get( "string", 'icon', "mate-fs-directory.png" )
# Allow plugin to be minimized to the left plugin pane # Allow plugin to be minimized to the left plugin pane
self.sticky = self.gconf.get( "bool", "sticky", False ) self.sticky = self.gconf.get( "bool", "sticky", False )
self.minimized = self.gconf.get( "bool", "minimized", False ) self.minimized = self.gconf.get( "bool", "minimized", False )
@ -148,7 +146,7 @@ class pluginclass( object ):
if ( self.showcomputer == True ): if ( self.showcomputer == True ):
Button1 = easyButton( "computer", self.iconsize, [_("Computer")], -1, -1 ) Button1 = easyButton( "computer", self.iconsize, [_("Computer")], -1, -1 )
if self.de == "gnome": if self.de == "mate":
Button1.connect( "clicked", self.ButtonClicked, "nautilus computer:" ) Button1.connect( "clicked", self.ButtonClicked, "nautilus computer:" )
else: else:
Button1.connect( "clicked", self.ButtonClicked, "xdg-open /" ) Button1.connect( "clicked", self.ButtonClicked, "xdg-open /" )
@ -163,8 +161,8 @@ class pluginclass( object ):
self.placesBtnHolder.pack_start( Button2, False, False ) self.placesBtnHolder.pack_start( Button2, False, False )
self.mintMenuWin.setTooltip( Button2, _("Open your personal folder") ) self.mintMenuWin.setTooltip( Button2, _("Open your personal folder") )
if ( self.shownetwork == True and self.de == "gnome"): if ( self.shownetwork == True and self.de == "mate"):
gconftheme = EasyGConf( "/desktop/gnome/interface/" ) gconftheme = EasyGConf( "/desktop/mate/interface/" )
icon_theme = gconftheme.get("string", "icon_theme", "Mint-X") icon_theme = gconftheme.get("string", "icon_theme", "Mint-X")
if "Mint-X" in icon_theme: if "Mint-X" in icon_theme:
Button3 = easyButton( "notification-network-ethernet-connected", self.iconsize, [_("Network")], -1, -1) Button3 = easyButton( "notification-network-ethernet-connected", self.iconsize, [_("Network")], -1, -1)
@ -189,7 +187,7 @@ class pluginclass( object ):
desktopDir = tmpdesktopDir desktopDir = tmpdesktopDir
except Exception, detail: except Exception, detail:
print detail print detail
Button4 = easyButton( "gnome-fs-desktop", self.iconsize, [_("Desktop")], -1, -1 ) Button4 = easyButton( "mate-fs-desktop", self.iconsize, [_("Desktop")], -1, -1 )
Button4.connect( "clicked", self.ButtonClicked, "xdg-open \"" + desktopDir + "\"") Button4.connect( "clicked", self.ButtonClicked, "xdg-open \"" + desktopDir + "\"")
Button4.show() Button4.show()
self.placesBtnHolder.pack_start( Button4, False, False ) self.placesBtnHolder.pack_start( Button4, False, False )

View File

@ -4,7 +4,7 @@ import sys
import os import os
import gobject import gobject
import datetime import datetime
import gconf import mateconf
import fcntl import fcntl
import pango import pango
from execute import Execute from execute import Execute
@ -43,11 +43,11 @@ class pluginclass:
self.width = 250 self.width = 250
#Plugin icon #Plugin icon
self.icon = 'gnome-folder.png' self.icon = 'mate-folder.png'
self.gconf_dir = '/apps/mintMenu/plugins/recent' self.gconf_dir = '/apps/mintMenu/plugins/recent'
self.client = gconf.client_get_default() self.client = mateconf.client_get_default()
self.client.add_dir( '/apps/mintMenu/plugins/recent', gconf.CLIENT_PRELOAD_NONE ) self.client.add_dir( '/apps/mintMenu/plugins/recent', mateconf.CLIENT_PRELOAD_NONE )
self.client.notify_add( '/apps/mintMenu/plugins/recent/height', self.RegenPlugin ) self.client.notify_add( '/apps/mintMenu/plugins/recent/height', self.RegenPlugin )
self.client.notify_add( '/apps/mintMenu/plugins/recent/width', self.RegenPlugin ) self.client.notify_add( '/apps/mintMenu/plugins/recent/width', self.RegenPlugin )
self.client.notify_add( '/apps/mintMenu/plugins/recent/num_recent_docs_to_show', self.RegenPlugin ) self.client.notify_add( '/apps/mintMenu/plugins/recent/num_recent_docs_to_show', self.RegenPlugin )
@ -81,7 +81,7 @@ class pluginclass:
# Hide vertical dotted separator # Hide vertical dotted separator
self.hideseparator = self.gconf.get( "bool", "hide_separator", False ) self.hideseparator = self.gconf.get( "bool", "hide_separator", False )
# Plugin icon # Plugin icon
self.icon = self.gconf.get( "string", 'icon', "gnome-fs-directory" ) self.icon = self.gconf.get( "string", 'icon', "mate-fs-directory" )
# Allow plugin to be minimized to the left plugin pane # Allow plugin to be minimized to the left plugin pane
self.sticky = self.gconf.get( "bool", "sticky", False ) self.sticky = self.gconf.get( "bool", "sticky", False )
self.minimized = self.gconf.get( "bool", "minimized", False ) self.minimized = self.gconf.get( "bool", "minimized", False )
@ -165,7 +165,7 @@ class pluginclass:
def callback(self, widget, filename=None): def callback(self, widget, filename=None):
self.Win.hide() self.Win.hide()
x = os.system("gnome-open \""+filename+"\"") x = os.system("mate-open \""+filename+"\"")
if x == 256: if x == 256:
dia = gtk.Dialog('File not found!', dia = gtk.Dialog('File not found!',
None, #the toplevel wgt of your app None, #the toplevel wgt of your app

View File

@ -3,8 +3,6 @@
import gtk import gtk
import gtk.glade import gtk.glade
import os import os
import gconf
import gnomevfs
import string import string
import gettext import gettext
@ -150,13 +148,13 @@ class pluginclass( object ):
if self.de == "xfce": if self.de == "xfce":
Button3.connect( "clicked", self.ButtonClicked, "xfce4-settings-manager" ) Button3.connect( "clicked", self.ButtonClicked, "xfce4-settings-manager" )
else: else:
Button3.connect( "clicked", self.ButtonClicked, "gnome-control-center" ) Button3.connect( "clicked", self.ButtonClicked, "mate-control-center" )
Button3.show() Button3.show()
self.systemBtnHolder.pack_start( Button3, False, False ) self.systemBtnHolder.pack_start( Button3, False, False )
self.mintMenuWin.setTooltip( Button3, _("Configure your system") ) self.mintMenuWin.setTooltip( Button3, _("Configure your system") )
if ( self.showTerminal == True ): if ( self.showTerminal == True ):
Button4 = easyButton( "gnome-terminal", self.iconsize, [_("Terminal")], -1, -1 ) Button4 = easyButton( "mate-terminal", self.iconsize, [_("Terminal")], -1, -1 )
Button4.connect( "clicked", self.ButtonClicked, "x-terminal-emulator" ) Button4.connect( "clicked", self.ButtonClicked, "x-terminal-emulator" )
Button4.show() Button4.show()
self.systemBtnHolder.pack_start( Button4, False, False ) self.systemBtnHolder.pack_start( Button4, False, False )
@ -178,14 +176,14 @@ class pluginclass( object ):
if ( self.showLogout == True ): if ( self.showLogout == True ):
Button6 = easyButton( "system-log-out", self.iconsize, [_("Logout")], -1, -1 ) Button6 = easyButton( "system-log-out", self.iconsize, [_("Logout")], -1, -1 )
Button6.connect( "clicked", self.ButtonClicked, "gnome-session-save --logout-dialog" ) Button6.connect( "clicked", self.ButtonClicked, "mate-session-save --logout-dialog" )
Button6.show() Button6.show()
self.systemBtnHolder.pack_start( Button6, False, False ) self.systemBtnHolder.pack_start( Button6, False, False )
self.mintMenuWin.setTooltip( Button6, _("Log out or switch user") ) self.mintMenuWin.setTooltip( Button6, _("Log out or switch user") )
if ( self.showQuit == True ): if ( self.showQuit == True ):
Button7 = easyButton( "system-shutdown", self.iconsize, [_("Quit")], -1, -1 ) Button7 = easyButton( "system-shutdown", self.iconsize, [_("Quit")], -1, -1 )
Button7.connect( "clicked", self.ButtonClicked, "gnome-session-save --shutdown-dialog" ) Button7.connect( "clicked", self.ButtonClicked, "mate-session-save --shutdown-dialog" )
Button7.show() Button7.show()
self.systemBtnHolder.pack_start( Button7, False, False ) self.systemBtnHolder.pack_start( Button7, False, False )
self.mintMenuWin.setTooltip( Button7, _("Shutdown, restart, suspend or hibernate") ) self.mintMenuWin.setTooltip( Button7, _("Shutdown, restart, suspend or hibernate") )

View File

@ -1,25 +1,25 @@
<oaf_info> <oaf_info>
<oaf_server iid="OAFIID:GNOME_mintMenu_Factory" <oaf_server iid="OAFIID:MATE_mintMenu_Factory"
type="exe" location="/usr/lib/linuxmint/mintMenu/mintMenu.py"> type="exe" location="/usr/lib/linuxmint/mintMenu/mintMenu.py">
<oaf_attribute name="repo_ids" type="stringv"> <oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:Bonobo/GenericFactory:1.0"/> <item value="IDL:MateComponent/GenericFactory:1.0"/>
<item value="IDL:Bonobo/Unknown:1.0"/> <item value="IDL:MateComponent/Unknown:1.0"/>
</oaf_attribute> </oaf_attribute>
<oaf_attribute name="name" type="string" value="mintMenu"/> <oaf_attribute name="name" type="string" value="mintMenu"/>
<oaf_attribute name="description" type="string" value="Advanced Gnome Menu"/> <oaf_attribute name="description" type="string" value="Advanced Menu"/>
</oaf_server> </oaf_server>
<oaf_server iid="OAFIID:GNOME_mintMenu" <oaf_server iid="OAFIID:MATE_mintMenu"
type="factory" location="OAFIID:GNOME_mintMenu_Factory"> type="factory" location="OAFIID:MATE_mintMenu_Factory">
<oaf_attribute name="repo_ids" type="stringv"> <oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:GNOME/Vertigo/PanelAppletShell:1.0"/> <item value="IDL:MATE/Vertigo/MatePanelAppletShell:1.0"/>
<item value="IDL:Bonobo/Control:1.0"/> <item value="IDL:MateComponent/Control:1.0"/>
<item value="IDL:Bonobo/Unknown:1.0"/> <item value="IDL:MateComponent/Unknown:1.0"/>
</oaf_attribute> </oaf_attribute>
<oaf_attribute name="name" type="string" value="mintMenu"/> <oaf_attribute name="name" type="string" value="mintMenu"/>
<oaf_attribute name="description" type="string" value="Advanced Gnome Menu"/> <oaf_attribute name="description" type="string" value="Advanced Menu"/>
<oaf_attribute name="panel:category" type="string" value="Utilities"/> <oaf_attribute name="panel:category" type="string" value="Utilities"/>
<oaf_attribute name="panel:icon" type="string" value="/usr/lib/linuxmint/mintMenu/mint-logo.svg"/> <oaf_attribute name="panel:icon" type="string" value="/usr/lib/linuxmint/mintMenu/mint-logo.svg"/>
</oaf_server> </oaf_server>