Re: How to destroy a GtkMenu?
- From: Vikram Ambrose <noel ambrose gmail com>
- To: jcupitt gmail com
- Cc: gtk-list gnome org
- Subject: Re: How to destroy a GtkMenu?
- Date: Fri, 18 Mar 2011 15:42:55 -0400
On 03/18/2011 05:06 AM, jcupitt gmail com wrote:
No need to destroy it. Build the menu, keep a pointer to the built
menu around somewhere, and pop it up when you need it.
My Menus are not static. Depending on what you've right-clicked on you
get different options.
I need to destroy them.
I think I've managed to simplify it a bit by doing gtk_widget_destroy
inside the selection-done event.
If you close the window you built the menu for, you can destroy the
menu in the window's dispose method.
Are you talking about the GdkWindow associated with a popped up GtkMenu
or the top-level GtkWindow?
/V
On Thursday, 17 March 2011, Vikram Ambrose<noel ambrose gmail com> wrote:
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]