mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 23:46:15 +01:00
Merge branch 'static-param-strings-docs' into 'main'
docs: Use G_PARAM_STATIC_STRINGS in examples and explain it more See merge request GNOME/glib!2675
This commit is contained in:
commit
4173d44abe
@ -555,7 +555,7 @@ viewer_file_class_init (ViewerFileClass *klass)
|
|||||||
"Filename",
|
"Filename",
|
||||||
"Name of the file to load and display from.",
|
"Name of the file to load and display from.",
|
||||||
NULL /* default value */,
|
NULL /* default value */,
|
||||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
|
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
obj_properties[PROP_ZOOM_LEVEL] =
|
obj_properties[PROP_ZOOM_LEVEL] =
|
||||||
g_param_spec_uint ("zoom-level",
|
g_param_spec_uint ("zoom-level",
|
||||||
@ -564,7 +564,7 @@ viewer_file_class_init (ViewerFileClass *klass)
|
|||||||
0 /* minimum value */,
|
0 /* minimum value */,
|
||||||
10 /* maximum value */,
|
10 /* maximum value */,
|
||||||
2 /* default value */,
|
2 /* default value */,
|
||||||
G_PARAM_READWRITE);
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
g_object_class_install_properties (object_class,
|
g_object_class_install_properties (object_class,
|
||||||
N_PROPERTIES,
|
N_PROPERTIES,
|
||||||
|
@ -1226,7 +1226,7 @@ viewer_editable_default_init (ViewerEditableInterface *iface)
|
|||||||
0.0, /* minimum */
|
0.0, /* minimum */
|
||||||
G_MAXDOUBLE, /* maximum */
|
G_MAXDOUBLE, /* maximum */
|
||||||
0.0, /* default */
|
0.0, /* default */
|
||||||
G_PARAM_READWRITE));
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
}
|
}
|
||||||
</programlisting></informalexample>
|
</programlisting></informalexample>
|
||||||
</para>
|
</para>
|
||||||
|
@ -54,7 +54,7 @@ typedef gsize GType;
|
|||||||
* _("Authors"),
|
* _("Authors"),
|
||||||
* _("List of authors"),
|
* _("List of authors"),
|
||||||
* G_TYPE_STRV,
|
* G_TYPE_STRV,
|
||||||
* G_PARAM_READWRITE));
|
* G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
*
|
*
|
||||||
* gchar *authors[] = { "Owen", "Tim", NULL };
|
* gchar *authors[] = { "Owen", "Tim", NULL };
|
||||||
* g_object_set (obj, "authors", authors, NULL);
|
* g_object_set (obj, "authors", authors, NULL);
|
||||||
|
@ -707,9 +707,11 @@ g_object_class_install_property (GObjectClass *class,
|
|||||||
* class initialization:
|
* class initialization:
|
||||||
*
|
*
|
||||||
* |[<!-- language="C" -->
|
* |[<!-- language="C" -->
|
||||||
* enum {
|
* typedef enum {
|
||||||
* PROP_0, PROP_FOO, PROP_BAR, N_PROPERTIES
|
* PROP_FOO = 1,
|
||||||
* };
|
* PROP_BAR,
|
||||||
|
* N_PROPERTIES
|
||||||
|
* } MyObjectProperty;
|
||||||
*
|
*
|
||||||
* static GParamSpec *obj_properties[N_PROPERTIES] = { NULL, };
|
* static GParamSpec *obj_properties[N_PROPERTIES] = { NULL, };
|
||||||
*
|
*
|
||||||
@ -722,17 +724,17 @@ g_object_class_install_property (GObjectClass *class,
|
|||||||
* g_param_spec_int ("foo", "Foo", "Foo",
|
* g_param_spec_int ("foo", "Foo", "Foo",
|
||||||
* -1, G_MAXINT,
|
* -1, G_MAXINT,
|
||||||
* 0,
|
* 0,
|
||||||
* G_PARAM_READWRITE);
|
* G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||||
*
|
*
|
||||||
* obj_properties[PROP_BAR] =
|
* obj_properties[PROP_BAR] =
|
||||||
* g_param_spec_string ("bar", "Bar", "Bar",
|
* g_param_spec_string ("bar", "Bar", "Bar",
|
||||||
* NULL,
|
* NULL,
|
||||||
* G_PARAM_READWRITE);
|
* G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||||
*
|
*
|
||||||
* gobject_class->set_property = my_object_set_property;
|
* gobject_class->set_property = my_object_set_property;
|
||||||
* gobject_class->get_property = my_object_get_property;
|
* gobject_class->get_property = my_object_get_property;
|
||||||
* g_object_class_install_properties (gobject_class,
|
* g_object_class_install_properties (gobject_class,
|
||||||
* N_PROPERTIES,
|
* G_N_ELEMENTS (obj_properties),
|
||||||
* obj_properties);
|
* obj_properties);
|
||||||
* }
|
* }
|
||||||
* ]|
|
* ]|
|
||||||
@ -1406,12 +1408,11 @@ g_object_notify (GObject *object,
|
|||||||
* g_object_class_install_property() inside a static array, e.g.:
|
* g_object_class_install_property() inside a static array, e.g.:
|
||||||
*
|
*
|
||||||
*|[<!-- language="C" -->
|
*|[<!-- language="C" -->
|
||||||
* enum
|
* typedef enum
|
||||||
* {
|
* {
|
||||||
* PROP_0,
|
* PROP_FOO = 1,
|
||||||
* PROP_FOO,
|
|
||||||
* PROP_LAST
|
* PROP_LAST
|
||||||
* };
|
* } MyObjectProperty;
|
||||||
*
|
*
|
||||||
* static GParamSpec *properties[PROP_LAST];
|
* static GParamSpec *properties[PROP_LAST];
|
||||||
*
|
*
|
||||||
@ -1421,7 +1422,7 @@ g_object_notify (GObject *object,
|
|||||||
* properties[PROP_FOO] = g_param_spec_int ("foo", "Foo", "The foo",
|
* properties[PROP_FOO] = g_param_spec_int ("foo", "Foo", "The foo",
|
||||||
* 0, 100,
|
* 0, 100,
|
||||||
* 50,
|
* 50,
|
||||||
* G_PARAM_READWRITE);
|
* G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||||
* g_object_class_install_property (gobject_class,
|
* g_object_class_install_property (gobject_class,
|
||||||
* PROP_FOO,
|
* PROP_FOO,
|
||||||
* properties[PROP_FOO]);
|
* properties[PROP_FOO]);
|
||||||
|
@ -172,6 +172,12 @@ typedef enum
|
|||||||
*
|
*
|
||||||
* #GParamFlags value alias for %G_PARAM_STATIC_NAME | %G_PARAM_STATIC_NICK | %G_PARAM_STATIC_BLURB.
|
* #GParamFlags value alias for %G_PARAM_STATIC_NAME | %G_PARAM_STATIC_NICK | %G_PARAM_STATIC_BLURB.
|
||||||
*
|
*
|
||||||
|
* It is recommended to use this for all properties by default, as it allows for
|
||||||
|
* internal performance improvements in GObject.
|
||||||
|
*
|
||||||
|
* It is very rare that a property would have a dynamically constructed name,
|
||||||
|
* nickname or blurb.
|
||||||
|
*
|
||||||
* Since 2.13.0
|
* Since 2.13.0
|
||||||
*/
|
*/
|
||||||
#define G_PARAM_STATIC_STRINGS (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)
|
#define G_PARAM_STATIC_STRINGS (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)
|
||||||
|
Loading…
Reference in New Issue
Block a user