activating a toggle menu item



I have created a menu using the GtkAction api and added a
GtkToggleActionEntry like this:

static GtkToggleActionEntry toggle_entries[] = {
  { "FullScreen", NULL, "_Full Screen", "F11", "NULL, NULL, FALSE }
};

using the follow gtk_action call:

gtk_action_group_add_toggle_actions (action_group, toggle_entries,
G_N_ELEMENTS (toggle_entries), window);

Now I want to check the menuitem at program start. I have tried several
calls, e.g. 

item = gtk_ui_manager_get_widget (ui_manager, "/MainMenu/Fullscreen");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(item), TRUE);

But checking fails and I get:

(ui:7337): Gtk-CRITICAL **: file gtktogglebutton.c: line 314
(gtk_toggle_button_set_active): assertion `GTK_IS_TOGGLE_BUTTON
(toggle_button)' failed

likewise, gtk_menu_item_activate, gtk_toggle_action_set_active and
gtk_check_menu_item_set_active also fail.
What's the correct way to do this?

Thanks,
Joop




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