GnomeUIInfo



just committed to CVS, will be released in 0.28 next week.

i ported from gtk-perl 0.7008 to gtk2-perl-xs the code to support GnomeUIInfo, and now $app->create_menu and $app->create_toolbar work. since it uses the same code to parse the data structure, your existing gtk-perl code should work with very minor modifications:

- Gnome2 expects a reference to an array of Gnome UI Info objects, rather than a list of them on the stack as Gnome wanted. - stock ids have changed, since stock items are now in Gtk2. what used to be 'Menu_Quit' or 'Menu_Save' are now 'gtk-quit' and 'gtk-save'. you'll figure these out as you go along.

and i think that's it.  ;-)

basically the data structure supports the names listed in the C documentation, but also allows some more meaningful substitutes for 'moreinfo', e.g., 'subtree' on submenu items and 'callback' on activate-able ones. you can specify items in either hash or array form; the hash form looks like this:

$app->create_menus( [
        {
                type    => 'subtree',
                label   => '_File',
                subtree => [  # officially 'moreinfo'
                        {
                                type            => 'item',
                                label           => '_Save...',
                                pixmap_type     => 'stock',
                                pixmap_info     => 'gtk-save',
                                callback        => sub { warn "save" },
                        },
                        {       type            => 'separator' },
                        {
                                type            => 'item',
                                label           => 'E_xit',
                                pixmap_type     => 'stock',
                                pixmap_info     => 'gtk-quit',
                                callback        => sub { warn "exit" },
                        },
                ],
        },
  ]
);



i'm not experienced with this stuff, and the standard disclaimers apply (i'm still looking for someone who wants to maintain the Gnome2 module), so please try it out and let us know if there are any problems. if anybody wants to write docs for it, they would be graciously included.

thanks to Gavin Brown for sending me code with which to test.




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