From 5f676ce3253f4e6f5ac07a1c1099d17e8384d5ee Mon Sep 17 00:00:00 2001 From: Elliot Smith Date: Fri, 28 Jan 2011 11:39:26 +0000 Subject: [PATCH] docs: Explain enums for properties and signals Add some more explanatory comments about the PROP_ and signals enums. --- doc/cookbook/examples/cb-button.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/doc/cookbook/examples/cb-button.c b/doc/cookbook/examples/cb-button.c index 0cf57bc00..d16874357 100644 --- a/doc/cookbook/examples/cb-button.c +++ b/doc/cookbook/examples/cb-button.c @@ -31,18 +31,24 @@ struct _CbButtonPrivate gchar *text; }; -/* enumerates signal identifiers for this class */ -enum { - CLICKED, - LAST_SIGNAL -}; - -/* enumerates property identifiers for this class */ +/* enumerates property identifiers for this class; + * note that property identifiers should be non-zero integers, + * so we add an unused PROP_0 to occupy the 0 position in the enum + */ enum { PROP_0, PROP_TEXT }; +/* enumerates signal identifiers for this class; + * LAST_SIGNAL is not used as a signal identifier, but is instead + * used to delineate the size of the cache array for signals (see below) + */ +enum { + CLICKED, + LAST_SIGNAL +}; + /* cache array for signals */ static guint cb_button_signals[LAST_SIGNAL] = { 0, };