How to destroy a GtkMenu?



After you have run gtk_menu_popup(), whats the proper way of deallocating memory for the menu?

Currently I'm hooking into the "deactivate" signal, from which I call gdk_threads_add_idle, which in turn calls a GSourceFunc that just does gtk_widget_destroy. Seems kinda convoluted so I'm guessing its probably not the right way.


eg.

...
  g_signal_connect(menu,"deactivate",on_menu_deactivate),NULL);
...


static gboolean destroy_(gpointer widget){
  gtk_widget_destroy(widget);
  return FALSE;
}

static void on_menu_deactivate(GtkWidget *menu, gpointer data){
  gdk_threads_add_idle(destroy_menu,menu);
}



V.


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