Property Definitions

Property Definitions — How to augment or define a #GladePropertyDef

Property Definition Configuration

Properties are introspected at load time and loaded into #GladePropertyDef structures. The behaviour of properties can be modified by the catalog and fake properties can be added for editing purposes. Here is an example of the xml form:

...

<property id="frobnicate-mode" default="FOO_FROBNICATE_RED">

  ... spec, tooltip etc

  <displayable-values>

    <value id="FOO_FROBNICATE_RED" name="Red"/>
    <value id="FOO_FROBNICATE_BLUE" name="Blue"/>

    ... values here

  </displayable-values>
</property>

...

Properties of the 'property' tag:

id

This is mandatory and specifies the property that we are modifying (or adding)

name

The name to be used in the interface. (if name is not specified; it defaults to the nickname of the #GParamSpec)

since

A 'major.minor' formed version describing the version of the owning catalog in which this property was introduced; example: since="1.0". Properties are initialized to be supported since the introducing #GladeWidgetAdaptor was supported.

disabled

Remove this property from this widget class and derived classes

default

A default value to be used for this property

translatable

For text properties, whether the property value is translatable in glade interfaces (this will enable the i18n dialog on text properties). Defaults to False.

common

If set to "True", the property will end up on the common tab even if its not a property of GtkWidgetClass.

optional

Whether this property is an optional property, this will make the property insensitive and add a check box to enable it (like width/height-request for example).

optional-default

If this is in fact an optional property; whether it is enabled by default.

query

If query is set; the property will be queried from the user in a dialog when adding the owning widget class instance to the project.

save

Whether to save this property to the glade file (default "True")

visible

Whether to show the property in the editor and reset dialog (default "True")

custom-layout

This is used to avoid loading this property in the editor when implementing a custom #GladeEditable that embeds the base #GladeEditorTable implementation, custom-layout properties will still show up in the reset dialog (default "False)

ignore

Whether to set the property on the object instance (via g_object_set_property or plugin override functions) when it changes in the editor (the value in the editor is the value saved).

themed-icon

Depicts a string property that is used for an icon from the theme. These will the appropriate editor.

weight

A numerical value to specify this properties position in the property editor.

transfer-on-paste

Used for packing properties; depicts packing properties that should follow the widget when pasted to a new container that supports the same properties.

save-always

Specifies that the property should be saved regardless of its value (properties at their default values are normally not saved).

Child tags of the 'property' tag:

spec

Specifies a function to be used to return a #GParamSpec for this property; this is used to add virtual properties to an object (like the "size" property on #GtkBox).

tooltip

The tooltip to be displayed in the property editor for this property. The tooltip defaults to the blurb of the associated #GParamSpec.

visible-lines

An integer value to specify how many lines will be shown for text properties in the editor (this doesnt really work because of the complexity of calculating size of rendered text; instead, just set this to 2 if you want the text property to be edited in a textview with a scrolled window as opposed to a simple text entry).

displayable-values

Allows you to specify user friendly strings for enum and flag values as shown in the example above, use the `id' property in the value tag to depict the real value name and the `name' property for the human readable one.