Re: [PATCH] core: Deprecate "overwrite" property
- From: Iago Toral <itoral igalia com>
- To: <grilo-list gnome org>
- Subject: Re: [PATCH] core: Deprecate "overwrite" property
- Date: Mon, 04 Apr 2011 15:05:45 +0000
I guess you plan to actually remove the property in a future release,
right?
Iago
On Mon, 4 Apr 2011 13:54:16 +0200, "Juan A. Suarez Romero"
<jasuarez igalia com> wrote:
This property is not useful anymore, specially since GrlData is able
to handle
multi-valued keys.
Make it deprecated so it can be removed later.
Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>
---
src/data/grl-data.c | 50
++++++++++++++------------------------------------
src/data/grl-data.h | 4 ++--
2 files changed, 16 insertions(+), 38 deletions(-)
diff --git a/src/data/grl-data.c b/src/data/grl-data.c
index 6e3461e..fcf55ba 100644
--- a/src/data/grl-data.c
+++ b/src/data/grl-data.c
@@ -47,7 +47,6 @@ enum {
struct _GrlDataPrivate {
GHashTable *data;
- gboolean overwrite;
};
static void grl_data_set_property (GObject *object,
@@ -88,7 +87,7 @@ grl_data_class_init (GrlDataClass *klass)
g_param_spec_boolean
("overwrite",
"Overwrite",
"Overwrite
current values",
- FALSE,
+ TRUE,
G_PARAM_READWRITE));
}
@@ -122,12 +121,9 @@ grl_data_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- GrlData *self = GRL_DATA (object);
-
switch (prop_id) {
case PROP_OVERWRITE:
- self->priv->overwrite = g_value_get_boolean (value);
- break;
+ g_warning ("\"overwrite\" property is deprecated");
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -141,11 +137,10 @@ grl_data_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- GrlData *self = GRL_DATA (object);
-
switch (prop_id) {
case PROP_OVERWRITE:
- g_value_set_boolean (value, self->priv->overwrite);
+ g_warning ("\"overwrite\" property is deprecated");
+ g_value_set_boolean (value, TRUE);
break;
default:
@@ -240,8 +235,7 @@ grl_data_get (GrlData *data, GrlKeyID key)
* @value: the new value
*
* Sets the first value associated with @key in @data. If key
already has a
- * value and #overwrite is %TRUE, old value is freed and the new one
is
- * set. Else the new one is assigned.
+ * value old value is freed and the new one is set.
*
* Also, checks that @value is compliant with @key specification,
modifying it
* accordingly. For instance, if @key requires a number between 0
and 10, but
@@ -268,14 +262,8 @@ grl_data_set (GrlData *data, GrlKeyID key, const
GValue *value)
grl_related_keys_set (relkeys, key, value);
grl_data_add_related_keys (data, relkeys);
} else {
- if (grl_related_keys_key_is_known (relkeys, key) &&
- !data->priv->overwrite) {
- /* relkeys already has a value, and we can not overwrite it */
- return;
- } else {
- /* Set the new value */
- grl_related_keys_set (relkeys, key, value);
- }
+ /* Set the new value */
+ grl_related_keys_set (relkeys, key, value);
}
}
@@ -286,8 +274,7 @@ grl_data_set (GrlData *data, GrlKeyID key, const
GValue *value)
* @strvalue: the new value
*
* Sets the first string value associated with @key in @data. If
@key already
- * has a value and #overwrite is %TRUE, old value is freed and the
new one is
- * set.
+ * has a value old value is freed and the new one is set.
*
* Since: 0.1.4
**/
@@ -340,7 +327,7 @@ grl_data_get_string (GrlData *data, GrlKeyID key)
* @intvalue: the new value
*
* Sets the first int value associated with @key in @data. If @key
already has a
- * first value and #overwrite is %TRUE, old value is replaced by the
new one.
+ * first value old value is replaced by the new one.
*
* Since: 0.1.4
**/
@@ -385,7 +372,7 @@ grl_data_get_int (GrlData *data, GrlKeyID key)
* @floatvalue: the new value
*
* Sets the first float value associated with @key in @data. If @key
already has
- * a first value and #overwrite is %TRUE, old value is replaced by
the new one.
+ * a first value old value is replaced by the new one.
*
* Since: 0.1.5
**/
@@ -431,8 +418,7 @@ grl_data_get_float (GrlData *data, GrlKeyID key)
* @size: size of the buffer
*
* Sets the first binary value associated with @key in @data. If
@key already
- * has a first value and #overwrite is %TRUE, old value is replaced
by the new
- * one.
+ * has a first value old value is replaced by the new one.
**/
void
grl_data_set_binary (GrlData *data, GrlKeyID key, const guint8 *buf,
gsize size)
@@ -507,8 +493,6 @@ grl_data_add (GrlData *data, GrlKeyID key)
* Removes the first value for @key from @data. If there are other
keys related
* to @key their values will also be removed from @data.
*
- * Notice this function ignores the value of #overwrite property.
- *
* Since: 0.1.4
**/
void
@@ -1054,12 +1038,7 @@ grl_data_dup (GrlData *data)
void
grl_data_set_overwrite (GrlData *data, gboolean overwrite)
{
- g_return_if_fail (GRL_IS_DATA (data));
-
- if (data->priv->overwrite != overwrite) {
- data->priv->overwrite = overwrite;
- g_object_notify (G_OBJECT (data), "overwrite");
- }
+ GRL_WARNING ("\"overwrite\" property is deprecated");
}
/**
@@ -1075,7 +1054,6 @@ grl_data_set_overwrite (GrlData *data, gboolean
overwrite)
gboolean
grl_data_get_overwrite (GrlData *data)
{
- g_return_val_if_fail (GRL_IS_DATA (data), FALSE);
-
- return data->priv->overwrite;
+ GRL_WARNING ("\"overwrite\" property is deprecated");
+ return TRUE;
}
diff --git a/src/data/grl-data.h b/src/data/grl-data.h
index 2854162..581230c 100644
--- a/src/data/grl-data.h
+++ b/src/data/grl-data.h
@@ -152,9 +152,9 @@ void grl_data_set_related_keys (GrlData *data,
GrlRelatedKeys *relkeys, guint in
GrlData *grl_data_dup (GrlData *data);
-void grl_data_set_overwrite (GrlData *data, gboolean overwrite);
+G_GNUC_DEPRECATED void grl_data_set_overwrite (GrlData *data,
gboolean overwrite);
-gboolean grl_data_get_overwrite (GrlData *data);
+G_GNUC_DEPRECATED gboolean grl_data_get_overwrite (GrlData *data);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]