Re: GtkBuilder object dependencies



Thanks for that tip.  That had actually also occurred to me, but I
veered away from it when thinking that there would be around 20 some
odd files, which I would need to split out, being careful to include
their dependencies.  It would also be less convenient from an editing
standpoint, when wanting to edit many widgets at the same time.  But
it does seem like it would be rather elegant and more efficient.  So I
may opt to go with that in the end.  Having said that, I already coded
up an XML dependency finder using glib's XML parser.  Not the
prettiest of code, but it works for now.

Best regards,

Element

On Sun, Jan 22, 2012 at 11:31 PM, Tristan Van Berkom <tvb gnome org> wrote:
> On Mon, Jan 23, 2012 at 4:37 AM, Element Green
> <element elementsofsound org> wrote:
>> I'm currently porting my application Swami
>> (http://www.swamiproject.org) from using libglade to GtkBuilder.  In
>> this application widgets are created on demand, for which I'm using
>> gtk_builder_add_objects_from_file().  One of the drawbacks of this
>> function though, seems to be that it does not support loading of
>> dependencies (GtkAdjustment, GtkModel, etc).  I'd like to have the
>> dependencies automatically be loaded, rather than trying to keep a
>> list of object dependencies in sync with the XML file.
>>
>> Do I need to resort to parsing the XML to determine dependencies at
>> runtime?  Or does anyone know a way to handle this elegantly in GTK
>> currently?  If not, perhaps it would be a good thing to add.  Could be
>> handled with an additional function like
>> gtk_builder_add_objects_from_file() which automatically loads
>> dependencies or which calls a callback to resolve the dependency.
>
> Easier than parsing xml, and generally better style than heaping
> everything into the same xml file, would be to simply split up your
> GtkBuilder xml into the fragments which you intend to load separately
> and just load those files separately.
>
> Cheers,
>          -Tristan
>
>>
>> Thank you for any thoughts or information on this.
>>
>> Best regards,
>>
>> Element Green
>> _______________________________________________
>> gtk-list mailing list
>> gtk-list gnome org
>> http://mail.gnome.org/mailman/listinfo/gtk-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]