[Glade-devel] Add new element <template> and gtk_builder_expose_object() function to GtkBuilder



On Thu, 2012-11-15 at 17:05 +0900, Tristan Van Berkom wrote:
On Thu, Nov 15, 2012 at 2:59 AM, Juan Pablo Ugarte
<juanpablougarte at gmail.com> wrote:
Hello guys

Question for Tristan and Marco

Is there any specific reason why we should keep external object in a
different name space (other table)
now that this is only for object and not any variable?

They should ideally use the same hash (or namespace, as you put it).

However it calls to question some nastier implications, such as... what
happens when you expose an external object which has the same
name as a declared object... should the external object be used instead ?
(i.e. should it be able to override internally declared fragments ?)

Right that would be a problem, in this case, if we expose the object
before calling gtk_builder_add_from_string() for example then the
external object will be overridden by the internal one.

now if you expose the object after builder has already created an object
then you can get a collision.

gtk_builder_new ()
gtk_builder_add_from_string ()
gtk_builder_expose_object ()
gtk_builder_add_from_string ()

unless we make sure in gtk_builder_expose_object() that the table does
not contain the same id we are trying to add

I think at least for now, we want to keep things as simple as possible
so the answer is no, it should not be able to override anything, and
a warning should be issued if there are any collisions in the internal
hash.

Of course, btw for what I have seen in builder code if you call 
gtk_builder_add_from_string() more than once objects will get overridden
in the table and bad thing would happen since the id checking is done at
the parsing level.

so I think that by simply making gtk_builder_expose_object() return a
boolean value indication if the object was exposed or not would be ok.
At least it wont be worst than the current situation

greets

Juan Pablo






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