Getting core when swapping menus on an optionmenu.
- From: chad chadlavy com
- To: gnome-devel-list gnome org
- Subject: Getting core when swapping menus on an optionmenu.
- Date: 18 May 2000 05:22:48 -0700
Hi,
This is my first stab at creating a gnome app and everything has been going very well so far. I am having one problem that I can't figure out, however. What I'm trying to do is swap menu's on a GtkOptionMenu during runtime. I wrote the following function to do so. It works the first time it is called, but the second time it fails at the gtk_option_menu_remove_menu.
void populate_get_ofindir_dlg_optionmenu ( gchar *gsz_directory ) {
int i;
gchar *gsz_subdirectory;
GtkWidget *new_menu;
GtkWidget *menu_item;
/* Remove the old menu. */
gtk_option_menu_remove_menu ( GTK_OPTION_MENU ( get_ofindir_dlg_optionmenu ) );
/* Populate with new contents. */
new_menu = gtk_menu_new ();
gsz_subdirectory = gsz_directory;
i = 0;
do {
menu_item = gtk_menu_item_new_with_label ( gsz_directory );
gtk_widget_show ( menu_item );
gtk_menu_append ( GTK_MENU ( new_menu ), menu_item );
if ( i ) { g_free ( gsz_subdirectory ); }
gsz_subdirectory = gsz_directory;
i++;
if ( strcmp ( gsz_directory, "/" ) == 0 ) { break; }
}
while ( ( gsz_directory = g_dirname ( gsz_subdirectory ) ) );
/* Attach the new menu. */
gtk_widget_show ( new_menu );
gtk_option_menu_set_menu ( GTK_OPTION_MENU ( get_ofindir_dlg_optionmenu ), new_menu );
}
Does anyone have some insight into what I'm doing wrong?
Thanks,
Chad
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]