Re: Help with writing dynamic menus in gnome panel applets



Hi Nickolay,

Thanks for your suggestions. I think that was exactly what i was looking for.

Just to address your concerns about useability of removing applet menu items, the reason is my applet will require creating, modifying and deletion of profiles. These profiles are listed in the panel applet and thus need to be removed as well as rearranged alphabetically, thus the requirement to delete and insert items at specific locations.

Thanks again for your pointer
D

-------- Original Message --------
Subject: Re: Help with writing dynamic menus in gnome panel applets
Date: Wed, 25 Oct 2006 08:29:44 +0400
From: Nickolay V. Shmyrev <nshmyrev yandex ru>
To: dbaker 0bits com
CC: gnome-devel-list gnome org
References: <453E8A47 3000701 0bits com>

В Срд, 25/10/2006 в 01:48 +0400, dbaker 0bits com пишет:
Hi all,

I'm trying in vain to finish the last bit of my applet but can't seem to figure it out. Rather than spending more time reading i thought i may short circuit the learning process and ask for help.

I fundamentally need to build a dynamic menu on the panel. This i've done and it comes up fine and i can click on items and correct actions happen. I've also read the 'writing panel applets' tutorial, but what i'm requiring is not covered.

So what i currently have is a menu like below that appears in the panel when i right click on my applet icon.

+-------------------+
|      AAAAA        |
+-------------------+
|      BBBBB        |
|      CCCCC        |
+-------------------+
| Remove from Panel |
|       Move        |
+-------------------+
|   Lock to Panel   |
+-------------------+

The items AAAAA, BBBBB and CCCCC are created by me and the rest are the default panel items.

Now i need to programatically add new menu items at a specific location in the menu, like just after AAAAA and before BBBBB. If i use

   bonobo_ui_component_set_translate(uic, "/popups/popup", xml, ev);

it always *appends* to my previously crated items and appears after the CCCCC menu item.

So how do i add an item at a specific index in the menu ? Do i need to rebuild the complete menu xml every time by doing a thaw() and then bonobo_ui_component_rm() followed by a bonobo_ui_component_set_translate() ?

Yes, you need to remove older items from the component and append new
items with set_translate.

To make things easier, you can add named placeholder with <placeholder>,
then you'll operate only on /popups/popup/removable_placeholder. For
reference please read
http://cvs.gnome.org/viewcvs/libbonoboui/doc/ui-xml.txt?rev=1.5&view=markup

And please note that removable menu items are bad thing in the usability
view, it's much better to mark unused actions as insensitive.


Am i missing something ?
Thanks
Dave
_______________________________________________
gnome-devel-list mailing list
gnome-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gnome-devel-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]