mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
cookbook: Use nicknames for enumeration values
GEnum nicknames can be used to set properties in JSON definitions, so added a callout to the JSON example explaining this, and showing how to derive the nickname for an enumeration value. Modified the example code to use nicknames as well.
This commit is contained in:
parent
2c3ca20cdc
commit
79a4dbb329
@ -16,8 +16,8 @@
|
||||
|
||||
"layout-manager" : {
|
||||
"type" : "ClutterBinLayout",
|
||||
"x-align" : "CLUTTER_BIN_ALIGNMENT_CENTER",
|
||||
"y-align" : "CLUTTER_BIN_ALIGNMENT_CENTER"
|
||||
"x-align" : "center",
|
||||
"y-align" : "center"
|
||||
},
|
||||
|
||||
"children" : [
|
||||
|
@ -108,8 +108,8 @@
|
||||
|
||||
"layout-manager" : { <co id="script-ui-introduction-json-no-id" />
|
||||
"type" : "ClutterBinLayout",
|
||||
"x-align" : "CLUTTER_BIN_ALIGNMENT_CENTER",
|
||||
"y-align" : "CLUTTER_BIN_ALIGNMENT_CENTER"
|
||||
"x-align" : "center", <co id="script-ui-introduction-json-nickname" />
|
||||
"y-align" : "center"
|
||||
},
|
||||
|
||||
"children" : [ <co id="script-ui-introduction-json-child-by-embedding" />
|
||||
@ -175,6 +175,29 @@
|
||||
within the list. The two can be mixed in a single
|
||||
list of <varname>children</varname>.</para>
|
||||
</callout>
|
||||
<callout arearefs="script-ui-introduction-json-nickname">
|
||||
<para>This uses the nickname for a value in an enumeration
|
||||
(in this case, the nickname for
|
||||
<constant>CLUTTER_BIN_ALIGNMENT_CENTER</constant>).</para>
|
||||
<para>To get the nickname for an enumeration value, take
|
||||
the component which is unique to that value in the
|
||||
enumeration, lowercase it, and replace any underscores
|
||||
with hyphens. Some examples:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para><constant>CLUTTER_ALIGN_X_AXIS</constant> has
|
||||
the nickname <code>x-axis</code></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><constant>CLUTTER_GRAVITY_NORTH</constant> has
|
||||
the nickname <code>north</code></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><constant>CLUTTER_REQUEST_HEIGHT_FOR_WIDTH</constant>
|
||||
has the nickname <code>height-for-width</code></para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</callout>
|
||||
</calloutlist>
|
||||
|
||||
</programlistingco>
|
||||
|
Loading…
Reference in New Issue
Block a user