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.

How to remove right click "format" option from a disk icon in the launcher as it can lead to formatting by mistake.

share|improve this question
    
You'll not be able to format a disk drive until you want to do it intentionally.. Always it'll prompt for your password.. –  Saurav Kumar Oct 15 '13 at 11:58
    
Thanks Kumar but still I want to know if that option can be removed. –  user202840 Oct 15 '13 at 12:52
add comment

1 Answer 1

As far as I know...the Format option is hardcoded in the Unity source.
You can try to edit source code to remove the format item.


NOTE: I recommend you to do this in a Virtual Machine or in a Test Machine to see is everything is OK. (In this example I'm running Ubuntu 12.04 with Unity 5.20.0).


1) Make sure you have enable the Source code repository

  • Open the Ubuntu Software Center.
  • In the Menu Bar choose Edit -> Software Sources. Click to enable "Source code repository". Just in case I use the "Main Server" to Download.

enter image description here

Open a Terminal window Ctrl+Alt+T and type:

  • sudo apt-get update

2) In the Terminal type the following to install the necessary packages.

  • sudo apt-get install build-essential quilt

3) Install build dependencies.

  • sudo apt-get build-dep unity

4) Create a folder to download the source code.

  • mkdir ~/Downloads/src

  • cd ~/Downloads/src

5) Download the source code & Export variables.

  • apt-get source unity

  • export QUILT_PATCHES=debian/patches

  • export EDITOR=gedit

6) Create the patch and Edit the source code.

  • cd unity-5.20.0/

  • quilt new 99_no_format_option.patch

  • quilt edit plugins/unityshell/src/DeviceLauncherIcon.cpp

Remove the lines... from 171 to 185.

enter image description here

Save the changes.

7) Build the deb packages.

  • quilt refresh
  • fakeroot dpkg-buildpackage

8) Install the deb packages.

  • cd ..

  • sudo dpkg -i *deb

9) Finally you can logout and Login to see the changes.

Before:

enter image description here

After:

enter image description here

Hope this helps.

share|improve this answer
    
You went and dirtied your hands with the source code D:! –  Braiam Nov 2 '13 at 19:07
add comment

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.