Re: GTK MenuShell Nested Menu's
- From: Lex Trotman <elextr gmail com>
- To: Kevin Anthony <kevin s anthony gmail com>
- Cc: gtk-list gnome org
- Subject: Re: GTK MenuShell Nested Menu's
- Date: Thu, 17 Mar 2011 12:30:59 +1100
On 17 March 2011 12:08, Kevin Anthony <kevin s anthony gmail com> wrote:
> Thanks, that helped alot, but now i'm suck again
> i'm populating the submenu's like this:
> if (!(g_strcmp0(progType,menu1))){
> GtkWidget *item;
> item = gtk_menu_item_new_with_label(progName);
> gtk_menu_shell_append(GTK_MENU_SHELL (menu1), item);
> printf("%s\n",sptr);
>
> g_signal_connect_swapped(item,"activate",G_CALLBACK(callback1),(gpointer)"Callback1");
> }else if (!(g_strcmp0(progType,menu2))){
> GtkWidget *item2;
> item2 = gtk_menu_item_new_with_label(progName);
> gtk_menu_shell_append(GTK_MENU_SHELL (menu2), item2);
>
> g_signal_connect_swapped(item2,"activate",G_CALLBACK(callback2),NULL);
> }
>
> void callback1(GtkWidget *widget, gpointer data){
> printf("callback called\n,%s\n",(char*) data);
> }
> and data is garbage.
> i read in a bunch of file names in the format progName.progType.xml.
> but if i have more then one of a given progType, i need full file
> name, it's stored in sptr, but it gets freed at the end of this loop.
> so i tired gtk_widget_set_name(item,sptr) but when in callback1, i
> called gtk_widget_get_name, it falled assert is widget.
g_signal_connect_swapped swaps the object and the data, thats why they
are both wrong
Cheers
Lex
>
> what's the proper way of doing this?
>
> Thanks
> Kevin
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]