Re: buildable_set_name



amol wrote:
Hi,
When we do gtk_buildable_set/get_name for any object created through GtkBuilder, GtkBuildable does g_object_set/get_data to return the corresponding name of object if its set/get_name are not overridden. But GtkWidget overrides set/get_name of buildable interface and does gtk_widget_set/get_name. I may create GtkWidget through GtkBuilder and after that i may set widget name accordingly (to use different styles in different cases). But when i do gtk_buildable_get_name it returns me new name which was set through widget_set_name and not through buildable_set_name.

That is correct.
There's only one name for the object, it can be set and accessed either
by using the widget or the buildable accessors.

No one except GtkAction and GtkActionGroup seems to be using buildable set/get_name.

My doubt is - What is the intention for GtkWidget to override set/get functions of GtkBuildable interface.

The intention of introduction the set/get_name is to be able to name the widget so you can access the ids used in the ui designer in runtime.

I've used the names myself for ui testing frameworks (based upon gazpacho and libglade though), and I am sure there are other uses for them.

Can we get rid of it w/o affecting any Gtk applications.

It's a nice feature which are useful in some circumstances.
I'd really like to keep it.

Gtk+ don't have any idea about the custom Id's specified in ui file while object creation. What is achieved doing by gtk_widget_set_name with Id specified in ui file.(gtkrc and ui Creator must be always in sync for themes to be work correctly ) I am planning to get rid of overriding set/get_name of buildable in GtkWidget. Does it will have any adverse effect?

I don't quite understand how this is an issue.
Yes, objects created by a UI designer will be named.
Yes, you will have to keep your gtkrc files in sync with these names.

The problem you are having is that you have a theme depending on the name property of a widget when it shouldn't.
Use the class name instead, why is that not sufficient?

Johan


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