Frank Groeneveld
Frank Groeneveld

Reputation: 1824

Remove GtkMenuItem from GtkMenu in app-indicator using c

I'm building an application that uses an app-indicator. The menu should be updated dynamically. Adding items works great using gtk_menu_shell_append, however for removing I can't find a gtk_menu_shell_* function. I've found gtk_container_remove and calling it with the gtkmenuitem and it's parent results in the following warnings:

GLib-GObject-WARNING **: invalid unclassed pointer in cast to `GtkWidget'
Gtk-CRITICAL **: gtk_widget_get_parent: assertion `GTK_IS_WIDGET (widget)' failed
Gtk-CRITICAL **: gtk_container_remove: assertion `GTK_IS_CONTAINER (container)' failed

I've also tried calling gtk_widget_destory and get errors like this:

GLib-GObject-WARNING **: invalid unclassed pointer in cast to `GtkWidget'
Gtk-CRITICAL **: gtk_widget_destroy: assertion `GTK_IS_WIDGET (widget)' failed

Note that both methods actually remove the menu item from the menu.

What is the correct way to remove a GtkMenuItem from a GtkMenu without generating these errors/warnings?

Upvotes: 3

Views: 591

Answers (1)

Frank Groeneveld
Frank Groeneveld

Reputation: 1824

Apparently the widget was wrong somehow (don't understand why this would still work though).

Upvotes: 1

Related Questions