Re: GtkBuilder Public API - Last call
- From: Yevgen Muntyan <muntyan tamu edu>
- To: zuh iki fi
- Cc: Gtk+ Developers <gtk-devel-list gnome org>
- Subject: Re: GtkBuilder Public API - Last call
- Date: Wed, 13 Jun 2007 06:42:40 -0500
Kalle Vahlman wrote:
2007/6/13, Yevgen Muntyan <muntyan tamu edu>:
Right, GtkUIManager as well as libglade hardly use non-stock
widgets now (see above). How many glade files use GtkSourceView
for instance? (or GtkUIManager xml description, for that matter)
I would assume 0 for UIManager descriptions, since it's not possible
to make it do anything sensible. Libglade doesn't support it in any
shape or form AFAIK (as it doesn't do objects).
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?
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?
Yes, since GtkBuilder doesn't decide the name, the user does.
User chooses a different thing in glade. Name in glade xml is a *unique
in given widget hierarchy* (and may or may not be unique in the
application)
identifier for a widget, as in glade_xml_get_widget(given_xml_object,
name).
Name used in gtk_widget_set_name() used to modify style is an identifier
used to find widget style, which again may or may not be unique
depending on what you want. "gtk-tooltip" is a nice example of non-unique
name ("nice" as in "people do want yellow stuff and use this hack
despite any reasons to avoid such a hack"); I modify cursor color
on per-widget basis, so I use name like g_strdup_printf("class-name-%p",
widget);
Widgets
that rely on their name will break upon setting the name whether it is
the user with set_name() or the builder setting it, so there is no
reason to avoid this in GtkBuilder.
Unless you want to use gtk_widget_set_name() to modify widget style.
If a widget breaks down when you change the name, it's a bug in the
widget right?
Not right simply because it is documented that
widget name is used for widget style, and if someone changes
it then he gets documented consequence - different style. It
rather sucks, but what can you do? We don't have other way
to modify widget style; and even for simple things API like
gtk_widget_modify_bg isn't enough: "gtk-tooltips" name is
the only way to get real tooltips yellow color.
Two different things are mixed here - name as in glade xml
and name as in gtk_rc_get_style_by_paths(). And it's not
good to mix these things. I guess gtk_widget_set_name()
is abused in libglade and ui manager because nobody wants
to add extra pointer to every widget, and because people
want gtk_widget_get_name() to return "widget name",
i.e. the name from glade file (naturally, what else could "widget
name" mean if glade says "name").
Did you grep only gtk sources by the way? Because it doesn't
make much sense, gtk can do anything and won't break. google
and different applications are better.
Best regards,
Yevgen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]