Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

When we right click the main menu on the panel we get some options. Is it possible to remove Edit Menus option from that?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Okay, this doesn't remove the menu entry, but it makes it useless, should be just what you need:

First, make a backup copy of alacarte, the menu editor:

sudo cp /usr/bin/alacarte /usr/bin/alacarte_backup

Now open up the original in your favourite text editor:

sudo gedit /usr/bin/alacarte

In between the end of the big comment on the top and the line that says import sys, paste this:

import gtk
md = gtk.MessageDialog(None, 
    gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR, 
    gtk.BUTTONS_CLOSE, "Not Allowed")
md.run()
md.destroy()
exit(1)

You can of course replace "Not Allowed" with any error message you like.

Now when you click "edit menus", this message will pop up:

error message saying "not allowed"

Of course this is not 'secure', a knowledgeable user will be able to get around it, but I guess that's fine in your case. I also haven't tested if any other applications break because of it, but looking at the code, that shouldn't happen.

Note: if you want to use an error message consisting of characters outside of ASCII, make sure the it says
# -*- coding: utf-8 -*- at the top (second or third line, not the first) of the file (it should by default).
Otherwise you'll get an error.

share|improve this answer
    
Is it possible to completely remove that option? –  karthick87 Apr 12 '11 at 14:01

Stefano and I have been talking about this in Chat today. I think he's working on another direction, but I've got a couple of source-based ways to work around this.

  1. The Main Menubar applet is part of gnome-panel so you could download the source for that, make your edits to remove the Edit Menus menu option and then repackage it. The problem with this is you'll either lose your changes when you get an update or you hold the package version and go without automatic updates.

  2. Use another sort of menu. There are some great options out there with things like Cardapio. Cardapio is Python based so it's a little easier to bend to your will. Just edit /usr/lib/cardapio/Cardapio.py. You have a few options here, you can break launch_edit_app(). Or you can hunt down where the option gets drawn using something like this:

    grep -R 'launch_edit_app' /usr/lib/cardapio/
    

    Of course you'd want to lock down the panel to stop somebody just adding the regular menu.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.