gtk_check_menu_item_set_active problem.

Hey all.
I have a problem with the function call gtk_check_menu_item_set_active.

This is the GnomeUIInfo structure for my 'Settings' menu of my application.

static GnomeUIInfo settings_menu_uiinfo[] =
	GNOMEUIINFO_TOGGLEITEM (N_("View Main Toolbar"), NULL, toggl_cb, NULL),

Now here is some part of the code in the create_app ().

create_app (...)
	/* Some stuff */

	/* Make the menu */
	gnome_app_create_menus (....)

	/* Make the main toolbar */
	gnome_app_create_toolbar (....)

	/* Toggle the checkbutton in the menu coz Main toolbar is visible */
	gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (settings_menu_uiinfo[0].widget), TRUE);

	/* Some more code */

My problem is that when the program comes to the line where I toggle the check
menu item, there is a error given and the program crashes. The error is

"Gtk-WARNING **: Invalid cast from (NULL) pointer to 'GtkObject'"

But if I replace the TRUE with FALSE in the call to
gtk_check_menu_item_set_active no error is given, program doesn't crash BUT
I don't get what I want.


Archit Baweja (bighead)

P.S. For now I'm reverting to this. But it would help if someone could answer
     the above question.

     GTK_CHECK_MENU_ITEM (settings_menu_uiinfo[0].widget)->active = TRUE;
     gtk_widget_show (settings_menu_uiinfo[0].widget);

     This seems to get the thing done, but thats not the way OOPs goes.

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