Thread overview | |||||
---|---|---|---|---|---|
|
October 11, 2019 GtkD ListG Howto? | ||||
---|---|---|---|---|
| ||||
Hi all, I'm trying to add an icon list to a GTK Window using setIconList(), but what the function expects is a ListG of Pixbufs. The way I understand it, I have to instantiate the Pixbufs, build a ListG of void pointers to the Pixbufs, and pass that to setIconList(). Here is how I assume this process would play out: ``` Pixbuf airportImage1, airportImage2, airportImage3, airportImage4; void * image1, image2, image3, image4; airportImage1 = new Pixbuf("images/airport_25.png"); airportImage2 = new Pixbuf("images/airport_35.png"); airportImage3 = new Pixbuf("images/airport_60.png"); airportImage4 = new Pixbuf("images/airport_100.png"); image1 = &airportImage1; image2 = &airportImage2; image3 = &airportImage3; image4 = &airportImage4; ListG listG = null; listG = listG.append(image1); listG = listG.append(image2); listG = listG.append(image3); listG = listG.append(image4); setIconList(listG); ``` But this, although it compiles, just dies when it hits all those append() statements. Would someone please tell me where I'm going off track? |
October 11, 2019 Re: GtkD ListG Howto? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ron Tarrant | On Friday, 11 October 2019 at 19:53:33 UTC, Ron Tarrant wrote: > Pixbuf airportImage1, airportImage2, airportImage3, airportImage4; > void * image1, image2, image3, image4; > > airportImage1 = new Pixbuf("images/airport_25.png"); > airportImage2 = new Pixbuf("images/airport_35.png"); > airportImage3 = new Pixbuf("images/airport_60.png"); > airportImage4 = new Pixbuf("images/airport_100.png"); > image1 = &airportImage1; > image2 = &airportImage2; > image3 = &airportImage3; > image4 = &airportImage4; > > ListG listG = null; > I get the segfault to go away with ListG list = new ListG(null); which is usage you can find in APILookupGLib.txt > listG = listG.append(image1); > listG = listG.append(image2); > listG = listG.append(image3); > listG = listG.append(image4); > > setIconList(listG); |
October 11, 2019 Re: GtkD ListG Howto? | ||||
---|---|---|---|---|
| ||||
Posted in reply to mipri | On Friday, 11 October 2019 at 20:40:25 UTC, mipri wrote:
> I get the segfault to go away with
>
> ListG list = new ListG(null);
>
> which is usage you can find in APILookupGLib.txt
Ah! Thanks, mipri. I didn't think to read through the unit tests.
|
Copyright © 1999-2021 by the D Language Foundation