Re: GtkBuilder Public API - Last call



2007/6/14, Yevgen Muntyan <muntyan tamu edu>:
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?

Is there a particular reason to set the name in _init() rather than in
_set_cursor_colors()? It would avoid setting it completely if using
Gtk+ >=2.11.3 and since it does nothing(?) if the custom colors are
not set...

Also, why is it neccessary when the colors are not set explicitly?
Isn't the class name as good as any for setting default values in
themes?

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.

I never said it wouldn't be needed. I'm just saying that there is no
reason to do it in construction stage, since it will not give you
anything over matching by class. If you need to hack styles in later,
you can set the name then and hope the user doesn't go and change it
afterwards. Also you can hope that the user didn't want to customize
the theming of that widget by his own account and get angry at you
since the widget changes it's name making it impossible...

>> 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.

*Nothing* is mandatory in a theme. In fact, you can run GTK+ without a
theme at all! Making widgets that won't work in that case is (ie.
without specific style set) is just plain wrong. They may look like
shit, but that's hardly the point, they still should be usable (even
if it means the cursor color won't be pink, but matches the foreground
color...).

I think that GTK+ should have a stock-item style database for colors
too, so one could finally start theming widgets a bit more sensibly
(but that's really some other thread of discussion).

If you write a widget which looks like a tooltip, you can't use
it with GtkBuilder, very simple.

You mean you can't use it if you want the theme's colors on it, which
is unfortunate (but fixable by making the tooltip window a derived
class I think?).

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.

What is weird is that widgets should be style neutral but aren't.
That's a property of the current style system though, I guess.

Anyway, let us stop.

Indeed, at least for this thread.

--
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]