Re: GtkBuilder Public API - Last call



2007/6/13, Yevgen Muntyan <muntyan tamu edu>:
Kalle Vahlman wrote:
> 2007/6/13, Matthias Clasen <matthias clasen gmail com>:
>> GtkBuilder is just setting the name that was specified in the xml, so
>> it is not violating the principle that the widget name belongs to the
>> app/user, since
>> the xml is part of the app.
>>

And widget isn't part of the app? Such separation is meaningless for
purpose of answering the question "should we change code of given
widget if we want the widget to be usable with GtkBuider?"

So, if a widget sets its name to modify its style, then
it's broken? Even if the style is essential part of its functionality?
E.g. text cursor color is not something fancy, it's an essential part
of text widget and it rather sucks if cursor is invisible because of
wrong styles. Saying "it's broken because it is somehow
not a part of application" just doesn't make sense.

So let's see, the things that make up a "style" in gtkrc are colors
and style properties. Any special-casing above (or rather below) that
is up to the theme engine and thus can't really be trusted. Colors are
grouped by functionality into fg, bg, base and text (as well as the
various computed colors from those). Those have clear meanings, and
should provide enough distinct colors for most widgets. If not, you
must rely on custom style properties and accept that it might not
match the theme. There is no way around this (other than calculating
the color, but that might be less than pleasing visually).

If a widget goes bonkers because a style property had the default
value, maybe the default value should be made more sensible?

> Furthermore, if my (admittedly quick) glance over how the object names
> are handled is not misguided, GtkBuilder sets the name once and never
> checks it again. It has an internal hash table in which it stores the
> id in the xml and all lookups use that instead of referring to the
> actual name.
>
> So even if GtkBuilder sets the initial name to what is in the xml, you
> should be able to change it afterwards to whatever you like without
> everything going bork bork.
>

I said already what could be a problem. get_widget_by_name()
is irrelevant.

You said that matching the widgets in gtkrc would be a problem and in
the part that you didn't include here I told you it's not:

"A quick test shows that I can indeed match my widget by the fancy name
I gave it in the code in a gtkrc, while the lookup returns the correct
object with the xml id."

Did I miss something obvious here? Or did you?

--
Kalle Vahlman, zuh iki fi
Powered by http://movial.fi
Interesting stuff at http://syslog.movial.fi



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