Re: GtkBuilder Public API - Last call



Kalle Vahlman wrote:
2007/6/14, Yevgen Muntyan <muntyan tamu edu>:
Kalle Vahlman wrote:
> 2007/6/14, Yevgen Muntyan <muntyan tamu edu>:
>> Set widget name in constructor or init(), then create this widget with
>> GtkBuilder.
>> Yeah, "semi-broken".
>
> Why is that preferrable over matching by the widget class name?
>
See
http://svn.gnome.org/viewcvs/gtksourceview/trunk/gtksourceview/gtksourcestylescheme.c?view=markup
for cursor color thing, set_cursor_colors() function.

Which part of it breaks due GtkBuilder? I don't see GtkSourceView
setting it's name (nor the cursor colors) in the constructor, which
was the primary concern you brought up.

Oh well, http://mooedit.sourceforge.net/hg/moo/?f=4c33c8446db7;file=moo/mooedit/mootextview.c
see moo_text_view_init. What does it change?

The GtkSourceView code (and code above) was an example
of code which uses unique widget name to modify style property,
since you didn't seem to believe it is possible and may be
needed.


For non-unique name, try
to get tooltips color on your widget without "gtk-tooltips" name.

I think this:

 http://mail.gnome.org/archives/usability/2007-June/msg00027.html

is by far a better solution to this problem than fiddling with the
widget names.

Let's not get caught in the "support old crappy ways in new API since
someone might have written some software depending on that"-thing that
some operating systems are guilty of. We are not breaking anything
here that wouldn't be broken anyway with the current method. And
people *do* use custom widgets with libglade, at least I do. It just
needs a little push from the application side to work, which is true
with the gtk-tooltips issue too (just name the widget after
construction in the application and it'll work).


Yep, there is no real break (as in existing code won't break,
since existing code doesn't use GtkBuilder); and in any case all those
bugs are not hard to fix/workaround. Still, why do I need to change
my code to make widget usable with GtkBuildable? The widget does
*not* violate any Gtk rules, it uses properties and whatnot.
It uses widget name just as docs say widget name is intended
to be used. And so on and so forth.

Or let's get back to "gtk-tooltips". No, symbolic colors
won't solve it as long as it's not mandatory for a theme to have
some predefined "tooltip" color, and it will never be the case.
If you write a widget which looks like a tooltip, you can't use
it with GtkBuilder, very simple.

Yes you can set the name after construction.

gtk_builder_build_stuff();
widget1 = gtk_builder_lookup ("foo");
gtk_widget_set_name (widget1, "gtk-tooltips");
/* oops, forgot to set up widget2 after adding it in glade,
   since we set all the properties in glade, don't we? */

IMHO, it's silly.

I don't think it's a big deal because we won't get to the level
of doing everything in glade anyway. Still, it's a weird thing.
Anyway, let us stop. People are fine with this, good.
No need to tell how to work it around, it's clear how to
work it around; and no need to explain how it's wrong to
do these nasty things with styles, because it's *not* wrong
(it sucks one has to do things like that, indeed).

Yevgen




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