[Glade-users] objects properties in a custom catalog

On Thu, 2009-08-06 at 18:30 -0400, Tristan Van Berkom wrote:
As I said, the name not showing up for your object is bug, feel free
to file it.

Okay, I'll file the bug.

I understand that it probably was not a good idea to name the property
"name", but on the other hand I don't really get it why GtkWidgets are
treated differently from any other GObject and their "name" property is
being bounded to the id, when all other objects survive perfectly fine
without even having that property. According to the docs the purpose of
the "name" property is to apply certain style from gtkrc to the widget,
which implies that it does not have to be unique, rather otherwise. Now
GtkBuilder for no particular reason hijacks the property forcing it to
be set to the unique id, completely defeating the purpose. I'm afraid
this rather unfortunate bug has to be filed against gtk. Correct me if
my logic is flawed.

I think it might work out of the box already, GtkBuilder applies the
id to all widgets
via GtkBuildable; GtkWidgets sync the id to the name property.

But that doesnt mean that this type of construct:

  <object class="GtkButton" id="ok_button">
     <property name="name">standard_button</property>

... would not be valid.

Glade never handled a separate name but if the above proves
to work theres no reason why we couldnt add a "theme name" property
or such to explicitly set the name.

This construct seems perfectly valid to me, but it simply doesn't work.
When you try to load such widget with GtkBuilder and then observe the
"name" property, you'll see that your setting was ignored and the "name"
property was reset to the id name. That is the widget's "name" property
which by definition has to modify the widget style if it is defined in
gtkrc. That is why it is Gtk bug, cause even if you fix it in Glade by
exposing widget's "name" property, whatever you enter in there will be
overwritten at the run time when you load the file.

For custom widgets you can work around this by implementing
GtkBuildableIface set_name and get_name functions. I think they should
have been properly called set_id and get_id to prevent any confusion,
but what's done is done - they're part of the API now. As of the widget
setting it's name from this id, it is totally wrong.

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