Re: GtkBuilder Public API - Last call



Tristan Van Berkom wrote:
On Wed, 2007-06-13 at 10:57 -0500, Yevgen Muntyan wrote:
Kalle Vahlman wrote:
2007/6/13, Matthias Clasen <matthias clasen gmail com>:
On 6/13/07, Yevgen Muntyan <muntyan tamu edu> wrote:
Widgets which set a name in a constructor are already semi-broken
anyway. Widget names are supposed to be an application/user feature,
not something thats used in the implementation of a widget.
Programmers are also not supposed to set style properties. Nevertheless
it happens, and widget name is one of tools for that. It is a documented
use which shouldn't break, isn't it?

Sure programmers are supposed to set style properties, in thier custom
gtkrc that they distribute with thier app in thier custom environment.
its just not something people generally do in "the desktop" world, which
is just one popular use case of gtk+, but gtk+ is not the desktop, and
skinning your widgets by name is an important feature of gtk+.

Custom gtkrc distributed with application is only one such use.
Does gedit count as a desktop application? It uses this thing, and
it uses it not for skins-like stuff.
As to skins-like stuff, it's also an interesting part. Shouldn't it be
supported directly in glade/builder, so that you could set widget
name to "my-fancy-button" for all five fancy buttons in your
player UI (perhaps it doesn't make sense, I've never done stuff
like xmms)?

How do you draw the line between "implementation of a widget" and
"an application" part exactly? Note that what you said makes it look
like calling gtk_widget_set_name() by a widget implementation is
not supposed to happen; while doing it by GtkBuilder is indeed right
and good; is it quite logical? GtkBuilder is more a user than the widget?
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?"

libglade set the widget name according to the name specified in the xml,
afaics so does the builder right ? so how does the bulder differ from
how libglade did it and where is the breakage ?

There is no formal breakage. It's just that some widgets need to
be made GtkBuilder-ready if one wants to use them with GtkBuilder,
and there possible some funny bugs caused by GtkBuilder doing
wrong thing (if some code will assume that widget has name
set from xml, and so on). As I said, libglade example is not good simply
because until recently (before glade-3 that is) people simply didn't use
custom widgets much with glade, something that hopefully will change
(and *then* people are more likely to use xml for fancy things since
it won't require an additional library).
Um, if it's not clear, what libglade does is wrong, but it has not much
choice - abusing gtk_widget_set_name() is tiny comparing to making people
happy that get_name() returns name from xml. Gtk now gets
gtk_buildable_set/get_name which could do the right thing, without mixing
glade xml and styles.

Best regards,
Yevgen




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