Re: Help with writing dynamic menus in gnome panel applets



В Срд, 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

Attachment: signature.asc
Description: =?koi8-r?Q?=FC=D4=C1?= =?koi8-r?Q?_=DE=C1=D3=D4=D8?= =?koi8-r?Q?_=D3=CF=CF=C2=DD=C5=CE=C9=D1?= =?koi8-r?Q?_=D0=CF=C4=D0=C9=D3=C1=CE=C1?= =?koi8-r?Q?_=C3=C9=C6=D2=CF=D7=CF=CA?= =?koi8-r?Q?_=D0=CF=C4=D0=C9=D3=D8=C0?=



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