Gtk2::ActionGroup problem



Hi all!

I'm trying to replace ItemFactory from an old app with UIManager, working along the ui_manager.pl example, but I can't seem to get it right:

my $uixml = <<ENDOFXML;
<ui>
  <menubar name="menubar">
    <menu action="file">
      <menuitem action="quit"/>
    </menu>
    <menu action="script">
      <menuitem action="run"/>
    </menu>
    <menu action="help">
      <menuitem action="about"/>
    </menu>
  </menubar>
</ui>
ENDOFXML

my @uientries =
  (
   # name,      stock id,       label
   [ "file",  undef,          "_File"               ],
   [ "script",        undef,          "_Script"     ],
   [ "help",     undef,               "_Help"         ],
   # name,      stock id,      label,    accelerator,  tooltip
[ "quit", 'gtk-quit', "_Quit", "<control>Q", "Quit", \&gscript_exit ], [ "run", 'gtk-execute', "_Run", "<control>R", "Run script", \&run ], [ "about", 'gtk-help', "_About", undef, "About", \&gscript_about ],
  );


sub gscript_create_menubar2 {
    my ($win) = @_;

    my $actions = Gtk2::ActionGroup->new("Actions");
    $actions->add_actions (\ uientries, undef);

    my $ui = Gtk2::UIManager->new;
    $ui->insert_action_group($actions, 0);
    $win->add_accel_group($ui->get_accel_group);
    $ui->add_ui_from_string($uixml);

    return $ui->get_widget("/menubar");
}


The add_actions() barfs "action array is empty" at me. Any idea what could be wrong?

Martin



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