Add to panel, add to desktop, delete from menu

This commit is contained in:
Clement Lefebvre 2010-02-24 10:58:46 +00:00
parent 6c7be3e85f
commit edd91d8d02
3 changed files with 194 additions and 67 deletions

12
debian/changelog vendored
View File

@ -1,3 +1,15 @@
mintmenu (4.9.5) isadora; urgency=low
* Add to panel
* Add to desktop
* Edit properties
* Delete from menu
* Better properties layout
* Fixed label orientation
* New option: start with favorites
-- Clement Lefebvre <root@linuxmint.com> Wed, 24 Feb 2010 10:58:00 +0000
mintmenu (4.9.4) helena; urgency=low
* Fixed: spaces in custom places and/or desktop directory

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-02-23 11:36+0000\n"
"POT-Creation-Date: 2010-02-24 10:56+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -138,7 +138,7 @@ msgid "Options"
msgstr ""
#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:60
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:241
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:243
msgid "Applications"
msgstr ""
@ -147,8 +147,8 @@ msgid "Colors"
msgstr ""
#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:63
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:227
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:232
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:229
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:234
msgid "Favorites"
msgstr ""
@ -319,91 +319,104 @@ msgstr ""
msgid "Recent documents"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:225
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:227
msgid "Filter:"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:229
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:230
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:231
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:232
msgid "All applications"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:617
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:618
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:631
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:632
#, python-format
msgid "Search portal for '%s'"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:621
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:622
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:635
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:636
#, python-format
msgid "Search repositories for '%s'"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:625
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:626
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:639
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:640
#, python-format
msgid "Show package '%s'"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:629
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:630
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:643
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:644
#, python-format
msgid "Install package '%s'"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:681
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:735
msgid "Launch"
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:696
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:756
msgid "Add to desktop"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:682
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:736
msgid "Properties"
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:697
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:757
msgid "Add to panel"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:683
msgid "Remove from favorites"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:684
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:738
msgid "Launch when I log in"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:686
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:718
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:699
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:739
msgid "Insert space"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:687
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:719
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:700
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:740
msgid "Insert separator"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:717
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:702
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:760
msgid "Launch when I log in"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:704
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:762
msgid "Launch"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:705
msgid "Remove from favorites"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:738
msgid "Remove"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:737
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:759
msgid "Show in my favorites"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:740
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:763
msgid "Uninstall"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:1090
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:764
msgid "Delete from menu"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:766
msgid "Edit properties"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:1192
msgid ""
"Couldn't save favorites. Check if you have write access to ~/.linuxmint/"
"mintMenu"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:1273
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:1375
msgid "All"
msgstr ""
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:1273
#: usr/lib/linuxmint/mintMenu/plugins/applications.py:1375
msgid "Show all applications"
msgstr ""

View File

@ -24,6 +24,8 @@ from filemonitor import monitor as filemonitor
#import xdg.Menu
import gmenu
from user import home
# i18n
gettext.install("mintmenu", "/usr/share/linuxmint/locale")
@ -330,6 +332,18 @@ class pluginclass( object ):
self.suggestShowButton.connect("clicked", self.show_apt)
self.suggestInstallButton.connect("clicked", self.install_apt)
self.get_panel()
def get_panel(self):
self.panel = None
self.panel_position = 0
appletidlist = gconf.client_get_default().get_list("/apps/panel/general/applet_id_list", "string")
for applet in appletidlist:
bonobo_id = gconf.client_get_default().get_string("/apps/panel/applets/" + applet + "/bonobo_iid")
if bonobo_id == "OAFIID:GNOME_mintMenu":
self.panel = gconf.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
def search_mint(self, widget):
os.system("/usr/bin/mint-search-portal " + self.suggestion + " &")
self.mintMenuWin.hide()
@ -678,38 +692,45 @@ class pluginclass( object ):
if widget.type == "location":
mTree = gtk.glade.XML( self.gladefile, "favoritesMenu" )
#i18n
launchMenuItem = gtk.MenuItem(_("Launch"))
propsMenuItem = gtk.MenuItem(_("Properties"))
removeFromFavMenuItem = gtk.MenuItem(_("Remove from favorites"))
startupMenuItem = gtk.CheckMenuItem(_("Launch when I log in"))
separator = gtk.SeparatorMenuItem()
desktopMenuItem = gtk.MenuItem(_("Add to desktop"))
panelMenuItem = gtk.MenuItem(_("Add to panel"))
separator1 = gtk.SeparatorMenuItem()
insertSpaceMenuItem = gtk.MenuItem(_("Insert space"))
insertSeparatorMenuItem = gtk.MenuItem(_("Insert separator"))
separator2 = gtk.SeparatorMenuItem()
startupMenuItem = gtk.CheckMenuItem(_("Launch when I log in"))
separator3 = gtk.SeparatorMenuItem()
launchMenuItem = gtk.MenuItem(_("Launch"))
removeFromFavMenuItem = gtk.MenuItem(_("Remove from favorites"))
launchMenuItem.connect( "activate", self.onLaunchApp, widget)
propsMenuItem.connect( "activate", self.onPropsApp, widget)
removeFromFavMenuItem.connect( "activate", self.onFavoritesRemove, widget )
desktopMenuItem.connect("activate", self.add_to_desktop, widget)
panelMenuItem.connect("activate", self.add_to_panel, widget)
insertSpaceMenuItem.connect( "activate", self.onFavoritesInsertSpace, widget, insertBefore )
insertSeparatorMenuItem.connect( "activate", self.onFavoritesInsertSeparator, widget, insertBefore )
mTree.get_widget("favoritesMenu").append(launchMenuItem)
mTree.get_widget("favoritesMenu").append(propsMenuItem)
mTree.get_widget("favoritesMenu").append(removeFromFavMenuItem)
mTree.get_widget("favoritesMenu").append(startupMenuItem)
mTree.get_widget("favoritesMenu").append(separator)
mTree.get_widget("favoritesMenu").append(insertSpaceMenuItem)
mTree.get_widget("favoritesMenu").append(insertSeparatorMenuItem)
mTree.get_widget("favoritesMenu").show_all()
mTree.get_widget( "favoritesMenu" ).popup( None, None, None, ev.button, ev.time )
if widget.isInStartup():
startupMenuItem.set_active( True )
startupMenuItem.connect( "toggled", self.onRemoveFromStartup, widget )
else:
startupMenuItem.set_active( False )
startupMenuItem.connect( "toggled", self.onAddToStartup, widget )
launchMenuItem.connect( "activate", self.onLaunchApp, widget)
removeFromFavMenuItem.connect( "activate", self.onFavoritesRemove, widget )
mTree.get_widget("favoritesMenu").append(desktopMenuItem)
mTree.get_widget("favoritesMenu").append(panelMenuItem)
mTree.get_widget("favoritesMenu").append(separator1)
mTree.get_widget("favoritesMenu").append(insertSpaceMenuItem)
mTree.get_widget("favoritesMenu").append(insertSeparatorMenuItem)
mTree.get_widget("favoritesMenu").append(separator2)
mTree.get_widget("favoritesMenu").append(startupMenuItem)
mTree.get_widget("favoritesMenu").append(separator3)
mTree.get_widget("favoritesMenu").append(launchMenuItem)
mTree.get_widget("favoritesMenu").append(removeFromFavMenuItem)
mTree.get_widget("favoritesMenu").show_all()
mTree.get_widget( "favoritesMenu" ).popup( None, None, None, ev.button, ev.time )
else:
mTree = gtk.glade.XML( self.gladefile, "favoritesMenuExtra" )
@ -732,20 +753,43 @@ class pluginclass( object ):
mTree = gtk.glade.XML( self.gladefile, "applicationsMenu" )
#i18n
launchMenuItem = gtk.MenuItem(_("Launch"))
propsMenuItem = gtk.MenuItem(_("Properties"))
desktopMenuItem = gtk.MenuItem(_("Add to desktop"))
panelMenuItem = gtk.MenuItem(_("Add to panel"))
separator1 = gtk.SeparatorMenuItem()
favoriteMenuItem = gtk.CheckMenuItem(_("Show in my favorites"))
startupMenuItem = gtk.CheckMenuItem(_("Launch when I log in"))
separator = gtk.SeparatorMenuItem()
separator2 = gtk.SeparatorMenuItem()
launchMenuItem = gtk.MenuItem(_("Launch"))
uninstallMenuItem = gtk.MenuItem(_("Uninstall"))
mTree.get_widget("applicationsMenu").append(launchMenuItem)
mTree.get_widget("applicationsMenu").append(propsMenuItem)
deleteMenuItem = gtk.MenuItem(_("Delete from menu"))
separator3 = gtk.SeparatorMenuItem()
propsMenuItem = gtk.MenuItem(_("Edit properties"))
mTree.get_widget("applicationsMenu").append(desktopMenuItem)
mTree.get_widget("applicationsMenu").append(panelMenuItem)
mTree.get_widget("applicationsMenu").append(separator1)
mTree.get_widget("applicationsMenu").append(favoriteMenuItem)
mTree.get_widget("applicationsMenu").append(startupMenuItem)
mTree.get_widget("applicationsMenu").append(separator)
mTree.get_widget("applicationsMenu").append(separator2)
mTree.get_widget("applicationsMenu").append(launchMenuItem)
mTree.get_widget("applicationsMenu").append(uninstallMenuItem)
if home in widget.desktopFile:
mTree.get_widget("applicationsMenu").append(deleteMenuItem)
deleteMenuItem.connect("activate", self.delete_from_menu, widget)
mTree.get_widget("applicationsMenu").append(separator3)
mTree.get_widget("applicationsMenu").append(propsMenuItem)
mTree.get_widget("applicationsMenu").show_all()
desktopMenuItem.connect("activate", self.add_to_desktop, widget)
panelMenuItem.connect("activate", self.add_to_panel, widget)
launchMenuItem.connect( "activate", self.onLaunchApp, widget )
propsMenuItem.connect( "activate", self.onPropsApp, widget)
uninstallMenuItem.connect ( "activate", self.onUninstallApp, widget )
@ -766,6 +810,64 @@ class pluginclass( object ):
mTree.get_widget( "applicationsMenu" ).popup( None, None, None, event.button, event.time )
def add_to_desktop(self, widget, desktopEntry):
try:
# Determine where the Desktop folder is (could be localized)
import sys, commands
sys.path.append('/usr/lib/linuxmint/common')
from configobj import ConfigObj
config = ConfigObj(home + "/.config/user-dirs.dirs")
desktopDir = home + "/Desktop"
tmpdesktopDir = config['XDG_DESKTOP_DIR']
tmpdesktopDir = commands.getoutput("echo " + tmpdesktopDir)
if os.path.exists(tmpdesktopDir):
desktopDir = tmpdesktopDir
# Copy the desktop file to the desktop
os.system("cp \"%s\" \"%s/\"" % (desktopEntry.desktopFile, desktopDir))
os.system("chmod a+rx %s/*.desktop" % (desktopDir))
except Exception, detail:
print detail
def add_to_panel(self, widget, desktopEntry):
import random
object_name = "mintmenu_"+''.join([random.choice('abcdefghijklmnopqrstuvwxyz0123456789') for x in xrange(8)])
new_directory = home + "/.gnome2/panel2.d/default/launchers/"
os.system("mkdir -p " + new_directory)
new_file = new_directory + object_name
# Copy the desktop file to the panels directory
os.system("cp \"%s\" \"%s\"" % (desktopEntry.desktopFile, new_file))
os.system("chmod a+rx %s" % (new_file))
# Add to Gnome/GConf
object_dir = "/apps/panel/objects/"
object_client = gconf.client_get_default()
object_client.set_string(object_dir + object_name +"/"+ "menu_path", "applications:/")
object_client.set_bool(object_dir + object_name +"/"+ "locked", False)
object_client.set_int(object_dir + object_name +"/"+ "position", self.panel_position)
object_client.set_string(object_dir + object_name +"/"+ "object_type", "launcher-object")
object_client.set_bool(object_dir + object_name +"/"+ "panel_right_stick", False)
object_client.set_bool(object_dir + object_name +"/"+ "use_menu_path", False)
object_client.set_string(object_dir + object_name +"/"+ "launcher_location", new_file)
object_client.set_string(object_dir + object_name +"/"+ "custom_icon", "")
object_client.set_string(object_dir + object_name +"/"+ "tooltip", "")
object_client.set_string(object_dir + object_name +"/"+ "action_type", "lock")
object_client.set_bool(object_dir + object_name +"/"+ "use_custom_icon", False)
object_client.set_string(object_dir + object_name +"/"+ "attached_toplevel_id", "")
object_client.set_string(object_dir + object_name +"/"+ "bonobo_iid", "")
object_client.set_string(object_dir + object_name +"/"+ "toplevel_id", self.panel)
launchers_list = object_client.get_list("/apps/panel/general/object_id_list", "string")
launchers_list.append(object_name)
object_client.set_list("/apps/panel/general/object_id_list", gconf.VALUE_STRING, launchers_list)
def delete_from_menu(self, widget, desktopEntry):
try:
os.system("rm \"%s\" &" % desktopEntry.desktopFile)
except Exception, detail:
print detail
def onLaunchApp( self, menu, widget ):
widget.execute()
self.mintMenuWin.hide()