Attributes vs properties

I’m cobbling together a small app and in some builder examples properties are set individually while attributes are set in a nested group. Aside from that I have no idea what the difference between them are.

Specifically I’m trying to give my window some padding so my outer elements aren’t right up against the edge but half the issue is I don’t know whether I’m trying to set an attribute or property.

So what’s the difference between attributes and properties?

UPDATE: I’ve gone over the docs again and found this section at the end of the “complex application”. It briefly mentions properties then uses attributes in the snippet…? I’m trying here…

That example is defining a menu, one of the items being connected (via GPropertyAction) to a property on the window

Objects have properties

Okay, so in that xml example the “menu” is not yet an object but will be a model later that the “gears” widget will activate. In describing the menu model we use attributes to give us hooks to attach signals to?

Objects having properties clears it up a bit. I see in the docs that widget properties are defined well and in the Hergert video he shows us how to define new properties. So the other side is what are attributes and when/how are they used?

You probably want to read the following documentation:

1 Like

Yes, I stumbled on these one day and couldn’t find my way back. There’s a few entry points into different “Start here” sections which is really confusing. I’ll bookmark the gnome developer docs pages.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.