diff options
author | Matthias Clasen <maclas@gmx.de> | 2003-09-12 20:11:38 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2003-09-12 20:11:38 +0000 |
commit | c3acb9da0c9dfff02b129258b9a8dc667514599c (patch) | |
tree | 12c46e05d0c5fc3409b8fd08a2161a1e4fe7beb7 | |
parent | 7c9f0a10f52074d81db915e9f3c94dc377b3c6c4 (diff) | |
download | glib-c3acb9da0c9dfff02b129258b9a8dc667514599c.tar.gz |
Make the g_value_set_x_take_ownership() functions "official" part of the
2003-09-12 Matthias Clasen <maclas@gmx.de>
Make the g_value_set_x_take_ownership() functions "official"
part of the API (#100948):
* gvaluetypes.[hc]: Add g_value_take_string() (synonym to the
now deprecated g_value_set_string_take_ownership()).
* gparam.[hc]: Add g_value_take_param() (synonym to the
now deprecated g_value_set_param_take_ownership()).
* gobject.[hc]: Add g_value_take_object() (synonym to the
now deprecated g_value_set_object_take_ownership()).
* gboxed.[hc]: Add g_value_take_boxed() (synonym to the
now deprecated g_value_set_boxed_take_ownership()).
* gobject/gobject-sections.txt: Add new g_value_take_x() functions.
* gobject/tmpl/param_value_types.sgml: Document new g_value_take_x()
functions. (#100948)
-rw-r--r-- | docs/reference/ChangeLog | 7 | ||||
-rw-r--r-- | docs/reference/gobject/gobject-sections.txt | 4 | ||||
-rw-r--r-- | docs/reference/gobject/tmpl/param_value_types.sgml | 53 | ||||
-rw-r--r-- | gobject/ChangeLog | 22 | ||||
-rw-r--r-- | gobject/gboxed.c | 7 | ||||
-rw-r--r-- | gobject/gboxed.h | 5 | ||||
-rw-r--r-- | gobject/gobject.c | 7 | ||||
-rw-r--r-- | gobject/gobject.h | 6 | ||||
-rw-r--r-- | gobject/gparam.c | 7 | ||||
-rw-r--r-- | gobject/gparam.h | 6 | ||||
-rw-r--r-- | gobject/gvaluetypes.c | 7 | ||||
-rw-r--r-- | gobject/gvaluetypes.h | 5 |
12 files changed, 127 insertions, 9 deletions
diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index 6cf23bbe1..c662f2f65 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,3 +1,10 @@ +2003-09-12 Matthias Clasen <maclas@gmx.de> + + * gobject/gobject-sections.txt: Add new g_value_take_x() functions. + + * gobject/tmpl/param_value_types.sgml: Document new g_value_take_x() + functions. (#100948) + 2003-08-05 Matthias Clasen <maclas@gmx.de> * glib/tmpl/string_utils.sgml: Add note about in-place editing to g_strdelimit() doc. diff --git a/docs/reference/gobject/gobject-sections.txt b/docs/reference/gobject/gobject-sections.txt index 1fa6b914d..9d6df0ae8 100644 --- a/docs/reference/gobject/gobject-sections.txt +++ b/docs/reference/gobject/gobject-sections.txt @@ -525,6 +525,7 @@ gchararray g_param_spec_string g_value_set_string g_value_set_static_string +g_value_take_string g_value_set_string_take_ownership g_value_get_string g_value_dup_string @@ -537,6 +538,7 @@ G_TYPE_PARAM_PARAM GParamSpecParam g_param_spec_param g_value_set_param +g_value_take_param g_value_set_param_take_ownership g_value_get_param g_value_dup_param @@ -550,6 +552,7 @@ GParamSpecBoxed g_param_spec_boxed g_value_set_boxed g_value_set_static_boxed +g_value_take_boxed g_value_set_boxed_take_ownership g_value_get_boxed g_value_dup_boxed @@ -572,6 +575,7 @@ G_TYPE_PARAM_OBJECT GParamSpecObject g_param_spec_object g_value_set_object +g_value_take_object g_value_set_object_take_ownership g_value_get_object g_value_dup_object diff --git a/docs/reference/gobject/tmpl/param_value_types.sgml b/docs/reference/gobject/tmpl/param_value_types.sgml index 157a6c6ab..51a2f5668 100644 --- a/docs/reference/gobject/tmpl/param_value_types.sgml +++ b/docs/reference/gobject/tmpl/param_value_types.sgml @@ -1102,6 +1102,16 @@ when setting the #GValue. @v_string: static string to be set +<!-- ##### FUNCTION g_value_take_string ##### --> +<para> +Sets the contents of a %G_TYPE_STRING #GValue to @v_string. +</para> + +@value: a valid #GValue of type %G_TYPE_STRING +@v_string: duplicated unowned string to be set +@Since: 2.4 + + <!-- ##### FUNCTION g_value_set_string_take_ownership ##### --> <para> This is an internal function introduced mainly for C marshallers. @@ -1109,9 +1119,7 @@ This is an internal function introduced mainly for C marshallers. @value: a valid #GValue of type %G_TYPE_STRING @v_string: duplicated unowned string to be set -<!-- # Unused Parameters # --> -@value: a valid #GValue -@v_string: string to be set +@Deprecated: Use g_value_take_string() instead. <!-- ##### FUNCTION g_value_get_string ##### --> @@ -1199,6 +1207,18 @@ Set the contents of a %G_TYPE_PARAM #GValue to @param. @param: the #GParamSpec to be set +<!-- ##### FUNCTION g_value_take_param ##### --> +<para> +Sets the contents of a %G_TYPE_PARAM #GValue to @param and +takes over the ownership of the callers reference to @param; +the caller doesn't have to unref it any more. +</para> + +@value: a valid #GValue of type %G_TYPE_PARAM +@param: the #GParamSpec to be set +@Since: 2.4 + + <!-- ##### FUNCTION g_value_set_param_take_ownership ##### --> <para> This is an internal function introduced mainly for C marshallers. @@ -1206,6 +1226,7 @@ This is an internal function introduced mainly for C marshallers. @value: a valid #GValue of type %G_TYPE_PARAM @param: the #GParamSpec to be set +@Deprecated: Use g_value_take_param() instead. <!-- ##### FUNCTION g_value_get_param ##### --> @@ -1301,6 +1322,18 @@ when setting the #GValue. @v_boxed: static boxed value to be set +<!-- ##### FUNCTION g_value_take_boxed ##### --> +<para> +Sets the contents of a %G_TYPE_BOXED derived #GValue to @v_boxed and +takes over the ownership of the callers reference to @v_boxed; +the caller doesn't have to unref it any more. +</para> + +@value: a valid #GValue of %G_TYPE_BOXED derived type +@v_boxed: duplicated unowned boxed value to be set +@Since: 2.4 + + <!-- ##### FUNCTION g_value_set_boxed_take_ownership ##### --> <para> This is an internal function introduced mainly for C marshallers. @@ -1308,6 +1341,7 @@ This is an internal function introduced mainly for C marshallers. @value: a valid #GValue of %G_TYPE_BOXED derived type @v_boxed: duplicated unowned boxed value to be set +@Deprecated: Use g_value_take_boxed() instead. <!-- ##### FUNCTION g_value_get_boxed ##### --> @@ -1465,6 +1499,18 @@ Set the contents of a %G_TYPE_OBJECT derived #GValue to @v_object. @v_object: object value to be set +<!-- ##### FUNCTION g_value_take_object ##### --> +<para> +Sets the contents of a %G_TYPE_OBJECT derived #GValue to @v_object +and takes over the ownership of the callers reference to @v_object; +the caller doesn't have to unref it any more. +</para> + +@value: a valid #GValue of %G_TYPE_OBJECT derived type +@v_object: object value to be set +@Since: 2.4 + + <!-- ##### FUNCTION g_value_set_object_take_ownership ##### --> <para> This is an internal function introduced mainly for C marshallers. @@ -1472,6 +1518,7 @@ This is an internal function introduced mainly for C marshallers. @value: a valid #GValue of %G_TYPE_OBJECT derived type @v_object: object value to be set +@Deprecated: Use g_value_take_object() instead. <!-- ##### FUNCTION g_value_get_object ##### --> diff --git a/gobject/ChangeLog b/gobject/ChangeLog index a34f2ea0b..c4192d99e 100644 --- a/gobject/ChangeLog +++ b/gobject/ChangeLog @@ -1,3 +1,20 @@ +2003-09-12 Matthias Clasen <maclas@gmx.de> + + Make the g_value_set_x_take_ownership() functions "official" + part of the API (#100948): + + * gvaluetypes.[hc]: Add g_value_take_string() (synonym to the + now deprecated g_value_set_string_take_ownership()). + + * gparam.[hc]: Add g_value_take_param() (synonym to the + now deprecated g_value_set_param_take_ownership()). + + * gobject.[hc]: Add g_value_take_object() (synonym to the + now deprecated g_value_set_object_take_ownership()). + + * gboxed.[hc]: Add g_value_take_boxed() (synonym to the + now deprecated g_value_set_boxed_take_ownership()). + Tue Sep 2 19:37:21 2003 Tim Janik <timj@gtk.org> * gtype.[hc]: added support for a "default vtable" per interface, @@ -72,6 +89,11 @@ Tue Aug 19 01:31:28 2003 Tim Janik <timj@gtk.org> * gsignal.c: added optimizations to skip NOP signal emissions. +2003-08-08 Matthias Clasen <maclas@gmx.de> + + * gobject.c (object_set_property): Improve the wording of the warning for invalid + values. (#117246, Mariano Suarez-Alvarez) + Wed Aug 6 09:57:14 2003 Owen Taylor <otaylor@redhat.com> * testgobject.c (test_signal_accumulator): Add check diff --git a/gobject/gboxed.c b/gobject/gboxed.c index 15c59af49..f62647f2d 100644 --- a/gobject/gboxed.c +++ b/gobject/gboxed.c @@ -504,6 +504,13 @@ void g_value_set_boxed_take_ownership (GValue *value, gconstpointer boxed) { + g_value_take_boxed (value, boxed); +} + +void +g_value_take_boxed (GValue *value, + gconstpointer boxed) +{ g_return_if_fail (G_VALUE_HOLDS_BOXED (value)); g_return_if_fail (G_TYPE_IS_VALUE (G_VALUE_TYPE (value))); diff --git a/gobject/gboxed.h b/gobject/gboxed.h index 1645502f6..7e57c5ca7 100644 --- a/gobject/gboxed.h +++ b/gobject/gboxed.h @@ -63,9 +63,12 @@ GType g_boxed_type_register_static (const gchar *name, #define G_TYPE_GSTRING (g_gstring_get_type ()) -/* --- internal (marshaller specific) --- */ +void g_value_take_boxed (GValue *value, + gconstpointer v_boxed); +#ifndef G_DISABLE_DEPRECATED void g_value_set_boxed_take_ownership (GValue *value, gconstpointer v_boxed); +#endif GType g_closure_get_type (void) G_GNUC_CONST; GType g_value_get_type (void) G_GNUC_CONST; GType g_value_array_get_type (void) G_GNUC_CONST; diff --git a/gobject/gobject.c b/gobject/gobject.c index 9b3cd7601..d172e5948 100644 --- a/gobject/gobject.c +++ b/gobject/gobject.c @@ -1533,6 +1533,13 @@ void g_value_set_object_take_ownership (GValue *value, gpointer v_object) { + g_value_take_object (value, v_object); +} + +void +g_value_take_object (GValue *value, + gpointer v_object) +{ g_return_if_fail (G_VALUE_HOLDS_OBJECT (value)); if (value->data[0].v_pointer) diff --git a/gobject/gobject.h b/gobject/gobject.h index 65d26a553..6690793c9 100644 --- a/gobject/gobject.h +++ b/gobject/gobject.h @@ -210,10 +210,12 @@ gulong g_signal_connect_object (gpointer instance, void g_object_run_dispose (GObject *object); -/* --- marshaller specific --- */ +void g_value_take_object (GValue *value, + gpointer v_object); +#ifndef G_DISABLE_DEPRECATED void g_value_set_object_take_ownership (GValue *value, gpointer v_object); - +#endif /* --- implementation macros --- */ #define G_OBJECT_WARN_INVALID_PSPEC(object, pname, property_id, pspec) \ diff --git a/gobject/gparam.c b/gobject/gparam.c index 0d4a1b3e0..da5123e1c 100644 --- a/gobject/gparam.c +++ b/gobject/gparam.c @@ -983,6 +983,13 @@ void g_value_set_param_take_ownership (GValue *value, GParamSpec *param) { + g_value_take_param (value, param); +} + +void +g_value_take_param (GValue *value, + GParamSpec *param) +{ g_return_if_fail (G_VALUE_HOLDS_PARAM (value)); if (param) g_return_if_fail (G_IS_PARAM_SPEC (param)); diff --git a/gobject/gparam.h b/gobject/gparam.h index 3fbea4b29..024a44abc 100644 --- a/gobject/gparam.h +++ b/gobject/gparam.h @@ -144,10 +144,12 @@ GParamSpec* g_value_get_param (const GValue *value); GParamSpec* g_value_dup_param (const GValue *value); -/* --- marshaller specific --- */ +void g_value_take_param (GValue *value, + GParamSpec *param); +#ifndef G_DISABLE_DEPRECATED void g_value_set_param_take_ownership (GValue *value, GParamSpec *param); - +#endif /* --- convenience functions --- */ typedef struct _GParamSpecTypeInfo GParamSpecTypeInfo; diff --git a/gobject/gvaluetypes.c b/gobject/gvaluetypes.c index e0031904a..48227869f 100644 --- a/gobject/gvaluetypes.c +++ b/gobject/gvaluetypes.c @@ -763,6 +763,13 @@ void g_value_set_string_take_ownership (GValue *value, gchar *v_string) { + g_value_take_string (value, v_string); +} + +void +g_value_take_string (GValue *value, + gchar *v_string) +{ g_return_if_fail (G_VALUE_HOLDS_STRING (value)); if (value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS) diff --git a/gobject/gvaluetypes.h b/gobject/gvaluetypes.h index 4649bc856..dfe9ce3d3 100644 --- a/gobject/gvaluetypes.h +++ b/gobject/gvaluetypes.h @@ -97,9 +97,12 @@ GType g_pointer_type_register_static (const gchar *name); gchar* g_strdup_value_contents (const GValue *value); -/* --- marshaller specific --- */ +void g_value_take_string (GValue *value, + gchar *v_string); +#ifndef G_DISABLE_DEPRECATED void g_value_set_string_take_ownership (GValue *value, gchar *v_string); +#endif /* humpf, need a C representable type name for G_TYPE_STRING */ |