From 79a4dbb32908043223e0d5a085214850166124f5 Mon Sep 17 00:00:00 2001 From: Elliot Smith Date: Fri, 27 Aug 2010 15:29:09 +0100 Subject: [PATCH] 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. --- doc/cookbook/examples/script-ui.json | 4 ++-- doc/cookbook/script.xml | 27 +++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/doc/cookbook/examples/script-ui.json b/doc/cookbook/examples/script-ui.json index 83b145193..d7b8f9a13 100644 --- a/doc/cookbook/examples/script-ui.json +++ b/doc/cookbook/examples/script-ui.json @@ -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" : [ diff --git a/doc/cookbook/script.xml b/doc/cookbook/script.xml index f15d6b8c8..690f57028 100644 --- a/doc/cookbook/script.xml +++ b/doc/cookbook/script.xml @@ -108,8 +108,8 @@ "layout-manager" : { "type" : "ClutterBinLayout", - "x-align" : "CLUTTER_BIN_ALIGNMENT_CENTER", - "y-align" : "CLUTTER_BIN_ALIGNMENT_CENTER" + "x-align" : "center", + "y-align" : "center" }, "children" : [ @@ -175,6 +175,29 @@ within the list. The two can be mixed in a single list of children. + + This uses the nickname for a value in an enumeration + (in this case, the nickname for + CLUTTER_BIN_ALIGNMENT_CENTER). + 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: + + + CLUTTER_ALIGN_X_AXIS has + the nickname x-axis + + + CLUTTER_GRAVITY_NORTH has + the nickname north + + + CLUTTER_REQUEST_HEIGHT_FOR_WIDTH + has the nickname height-for-width + + +