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]