RE: How to create submenus using UIManager



Thanks, again. To try this, I first have to replace GTK+ 2.10 by GTK 2.12.

Stewart

> -----Original Message-----
> From: Emmanuele Bassi [mailto:ebassi gmail com]
> Sent: Monday, November 05, 2007 10:07 AM
> To: stewart weiss acm org
> Cc: gtk-list gnome org
> Subject: RE: How to create submenus using UIManager
> 
> 
> 
> On Mon, 2007-11-05 at 09:48 -0500, Stewart Weiss wrote:
> 
> > Have you rewritten the recent-uimanager demo program to use the
> > GtkRecentAction objects?
> 
> nope, because it's useful to demonstrate how to use a GtkAction
> sub-class to display inlined, dynamically generated menu items. :-)
> 
> using GtkRecentAction is really quite easy (I tried to make it as easy
> as possible, anyway):
> 
>   <ui>
>     ...
>     <menuitem name='OpenRecent' action='OpenRecentAction'/>
>     ...
>   </ui>
> 
> and:
> 
>   recent_action = gtk_recent_action_new ("OpenRecentAction",
>                                          "Open _Recent",
>                                          "Open recently used files",
>                                          NULL);
>   gtk_action_group_add_action (action_group, recent_action);
>   g_signal_connect (recent_action, "item-activated",
>                     G_CALLBACK (on_recent_item_activated),
>                     NULL);
> 
> it's all that you need to display an "Open Recent" menu item with a
> sub-menu filled with recently used files. Filtering and sorting the
> displayed list is possible through the GtkRecentChooser interface API.
> 
> ciao,
>  Emmanuele.
> 
> -- 
> Emmanuele Bassi,
> W: http://www.emmanuelebassi.net
> B: http://log.emmanuelebassi.net


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