[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Google
  Web www.spinics.net

Re: GTK MenuShell Nested Menu's



oh.

well it works now, thanks!

Kevin

On Wed, Mar 16, 2011 at 9:30 PM, Lex Trotman <elextr@xxxxxxxxx> wrote:
> On 17 March 2011 12:08, Kevin Anthony <kevin.s.anthony@xxxxxxxxx> 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
>>
>



-- 
Thanks
Kevin Anthony
www.NoSideRacing.com
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list



[GIMP Users]     [Yosemite News]    [Yosemite Photos]    [Gimp's Home]     [Steve's Art]

Add to Google Powered by Linux