After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 688205 - Add new element <template> and gtk_builder_expose_object() function
Add new element <template> and gtk_builder_expose_object() function
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Class: GtkBuilder
unspecified
Other All
: Normal enhancement
: ---
Assigned To: GtkBuilder maintainers
GtkBuilder maintainers
: 447972 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-11-12 20:11 UTC by Juan Pablo Ugarte
Modified: 2014-04-23 19:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed implementation of gtk_builder_expose_object() and <template> element parsing (48.28 KB, patch)
2012-11-12 20:11 UTC, Juan Pablo Ugarte
none Details | Review
Proposed implementation of gtk_builder_expose_object() and <template> element parsing (45.47 KB, patch)
2012-11-15 20:14 UTC, Juan Pablo Ugarte
none Details | Review
gtk_builder_expose_object() implementation (8.68 KB, patch)
2012-12-10 17:59 UTC, Juan Pablo Ugarte
committed Details | Review
<external-object> tag implemention (33.71 KB, patch)
2012-12-10 18:25 UTC, Juan Pablo Ugarte
none Details | Review
gtk_builder_expose_object() gtk3-demo example (6.97 KB, patch)
2012-12-19 14:03 UTC, Juan Pablo Ugarte
none Details | Review
gtk_builder_expose_object() gtk3-demo example (9.59 KB, patch)
2012-12-19 17:36 UTC, Juan Pablo Ugarte
none Details | Review
<external-object> tag gtk3-demo example (10.02 KB, patch)
2012-12-19 17:37 UTC, Juan Pablo Ugarte
none Details | Review

Description Juan Pablo Ugarte 2012-11-12 20:11:27 UTC
Created attachment 228822 [details] [review]
Proposed implementation of gtk_builder_expose_object() and <template> element parsing

From the new docs...

gtk_builder_expose_object:

Adds object to a pool of objects external to the objects built by builder. Objects exposed in this pool can be referred to by xml fragments by specifying the "external-object" boolean attribute.

To make this function even more useful a new special entry point element <template> is defined. It is similar to <object> with the only difference it can only be defined as a toplevel element (that is it has to be a child of <interface>) and its id has to reference an external object exposed with this function. This way you can change properties and even add children to an external object using builder and not just reference it.
Comment 1 Juan Pablo Ugarte 2012-11-12 20:13:04 UTC
*** Bug 447972 has been marked as a duplicate of this bug. ***
Comment 2 Juan Pablo Ugarte 2012-11-12 21:20:30 UTC
More information can be found in my blog post
http://blogs.gnome.org/xjuan/2012/11/12/gtkbuilder-and-external-objects/

and my development branch
git checkout -b composite-templates origin/composite-templates
Comment 3 Juan Pablo Ugarte 2012-11-15 20:14:01 UTC
Created attachment 229090 [details] [review]
Proposed implementation of gtk_builder_expose_object() and <template> element parsing

Same as the other patch but objects are exposed to the same namespace as objects built by builder
Comment 4 Benjamin Otte (Company) 2012-12-06 21:09:41 UTC
> gboolean gtk_builder_expose_object ();
>
That function should always succeed, nobody is ever gonna check for failure. Make the failure case a g_return_if_fail(). If people want to avoid that, they can check that gtk_builder_get_object(name) == NULL before calling gtk_builder_expose_object().
Comment 5 Matthias Clasen 2012-12-07 22:30:17 UTC
Can you split this up and provide a separate patch for gtk_builder_expose_object ?
Comment 6 Juan Pablo Ugarte 2012-12-10 17:59:38 UTC
Created attachment 231182 [details] [review]
gtk_builder_expose_object() implementation
Comment 7 Juan Pablo Ugarte 2012-12-10 18:25:15 UTC
Created attachment 231184 [details] [review]
<external-object> tag implemention
Comment 8 Benjamin Otte (Company) 2012-12-10 19:00:23 UTC
Comment on attachment 231182 [details] [review]
gtk_builder_expose_object() implementation

That one looks nice. We should commit it before people do more bikeshedding on it.
Comment 9 Juan Pablo Ugarte 2012-12-10 19:28:19 UTC
Comment on attachment 231182 [details] [review]
gtk_builder_expose_object() implementation

Ok good, its in master!
Comment 10 Juan Pablo Ugarte 2012-12-19 14:03:32 UTC
Created attachment 231877 [details] [review]
gtk_builder_expose_object() gtk3-demo example

This adds a new example to gtk3-demo, it just creates a dialog with the main window as its transient parent.
Comment 11 Juan Pablo Ugarte 2012-12-19 17:36:23 UTC
Created attachment 231914 [details] [review]
gtk_builder_expose_object() gtk3-demo example
Comment 12 Juan Pablo Ugarte 2012-12-19 17:37:23 UTC
Created attachment 231915 [details] [review]
<external-object> tag gtk3-demo example