Saturday, 21 February 2009

Howto Display more than 5 bookmarks in gnome-panel "Places" menu

1) Open Terminal

2a) Install apt-build

sudo apt-get update
sudo apt-get install apt-build

2b) Configure apt-build:

* Optimization level: Medium
* Add apt-build repository to sources.list: Yes
* Architecture: SELECT YOUR ARCHITECTURE

3) Install files required to build gnome-panel from source and download the source

sudo apt-get build-dep gnome-panel
sudo apt-build source gnome-panel

4) Navigate to the downloaded gnome-panel source folder and open the menu items file

cd /var/cache/apt-build/build/gnome-panel-*
sudo gedit gnome-panel/panel-menu-items.c

5) Set the the maximum number of bookmarks to display before placing them in the Bookmarks submenu

Find the line:
PHP Code:
if (g_slist_length (add_bookmarks) <= MAX_ITEMS_OR_SUBMENU) {
and replace it with:
PHP Code:
if (g_slist_length (add_bookmarks) <= 20) {
Save the file.

6) Install the modified gnome-panel and restart it

sudo ./configure
sudo make
sudo make install
killall gnome-panel

5 comments:

julian said...

haven't tried this, but wouldn't it be better to change the value of MAX_ITEMS_OR_SUBMENU to 20 instead of hard coding numbers at different locations in the code?

Alex said...

works fine :-)
Thank you!

damon said...

julian,

I think you are correct, this same file has as line

#define MAX_ITEMS_OR_SUBMENU 5

I just changed that to 20, followed the remaining instructions, and it works!

Tom said...

I wonder if I would lose any customization I've done to my gnome-panels because of this, or is everything kept the way it was? Think: applets, application launchers, the order of icons I've put on the panel, etc.

matrixblue said...

You won't lose the customization because those are stored in a configuration file in your home directory.

Hopefully in future versions they'll allow the MAX_ITEMS_OR_SUBMENU to be defined in a user configuration file so we won't have to recompile to change it.