The Parameters of properties

Hi guys how are you.

I have a very simple question about parameters. If I set my parameter to G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS, I am saying that the parameter is editable and at the same time it is static (immutable), this is correct or I am making a mistake.
I have a parameter but I want it to change its value when decorating the system the correct thing is:

properties[PROP_AMOUNT] = g_param_spec_string ("amount", "Amount", "The Amount", NULL,
                                                 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);

Or:

properties[PROP_AMOUNT] = g_param_spec_string ("amount", "Amount", "The Amount", NULL,
                                                 G_PARAM_READWRITE );

Thank you very much in advance

G_PARAM_STATIC_STRINGS is an alias for three other flags

#define G_PARAM_STATIC_STRINGS (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)

G_PARAM_STATIC_NAME
the string used as name when constructing the parameter is guaranteed to remain valid and unmodified for the lifetime of the parameter.
Since 2.8
G_PARAM_STATIC_NICK
the string used as nick when constructing the parameter is guaranteed to remain valid and unmmodified for the lifetime of the parameter.
Since 2.8
G_PARAM_STATIC_BLURB
the string used as blurb when constructing the parameter is guaranteed to remain valid and unmodified for the lifetime of the parameter.
Since 2.8

You’ll notice these flags are about the name, nick & blurb of the property - not the property itself

properties[PROP_AMOUNT] = g_param_spec_string ("amount",
/*                           Name  ------------^^^^^^^^        */
                                               "Amount",
/*                           Nick  ------------^^^^^^^^        */
                                               "The Amount",
/*                           Blurb ------------^^^^^^^^^^^^    */
                                               NULL,
                                               G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);

Hopefully, with the above information, you can see you’ve misinterpreted this

2 Likes

thank you so much for your help

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