aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2011-01-26 13:00:13 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2011-01-27 16:31:20 +0100
commit17bf37cebaad35ea0dd75c8e133e1b032776b085 (patch)
tree911dc4621ed8e0734b34dfe5ae4198fa7bbb75e1
parentb782dae4b2d4a05eef882c4e157c2ebf1497d61c (diff)
downloadlogdiag-17bf37cebaad35ea0dd75c8e133e1b032776b085.tar.gz
logdiag-17bf37cebaad35ea0dd75c8e133e1b032776b085.tar.xz
logdiag-17bf37cebaad35ea0dd75c8e133e1b032776b085.zip
Rename ld_diagram_object_{get,set}_data().
Make small corrections.
-rw-r--r--liblogdiag/ld-diagram-object.c47
-rw-r--r--liblogdiag/ld-diagram-object.h9
-rw-r--r--liblogdiag/ld-diagram-symbol.c4
3 files changed, 30 insertions, 30 deletions
diff --git a/liblogdiag/ld-diagram-object.c b/liblogdiag/ld-diagram-object.c
index 0254a2a..9dd9815 100644
--- a/liblogdiag/ld-diagram-object.c
+++ b/liblogdiag/ld-diagram-object.c
@@ -113,7 +113,7 @@ ld_diagram_object_get_property (GObject *object, guint property_id,
break;
case PROP_X:
case PROP_Y:
- ld_diagram_object_get_data (self, value, pspec);
+ ld_diagram_object_get_data_for_param (self, value, pspec);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -134,7 +134,7 @@ ld_diagram_object_set_property (GObject *object, guint property_id,
break;
case PROP_X:
case PROP_Y:
- ld_diagram_object_set_data (self, value, pspec);
+ ld_diagram_object_set_data_for_param (self, value, pspec);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -212,16 +212,16 @@ ld_diagram_object_set_storage (LdDiagramObject *self, JsonObject *storage)
}
/**
- * ld_diagram_object_get_data:
+ * ld_diagram_object_get_data_for_param:
* @self: An #LdDiagramObject object.
- * @value: (out): Where the data will be stored.
+ * @data: (out): Where the data will be stored.
* @pspec: The parameter to read data for.
*
- * Retrieve data from internal storage.
+ * Retrieve data for a parameter from internal storage.
*/
void
-ld_diagram_object_get_data (LdDiagramObject *self,
- GValue *value, GParamSpec *pspec)
+ld_diagram_object_get_data_for_param (LdDiagramObject *self,
+ GValue *data, GParamSpec *pspec)
{
JsonObject *storage;
JsonNode *node;
@@ -230,7 +230,7 @@ ld_diagram_object_get_data (LdDiagramObject *self,
gboolean result;
g_return_if_fail (LD_IS_DIAGRAM_OBJECT (self));
- g_return_if_fail (G_IS_VALUE (value));
+ g_return_if_fail (G_IS_VALUE (data));
g_return_if_fail (G_IS_PARAM_SPEC (pspec));
storage = ld_diagram_object_get_storage (self);
@@ -243,48 +243,47 @@ ld_diagram_object_get_data (LdDiagramObject *self,
memset (&json_value, 0, sizeof (json_value));
json_node_get_value (node, &json_value);
- result = g_param_value_convert (pspec, &json_value, value, FALSE);
+ result = g_param_value_convert (pspec, &json_value, data, FALSE);
g_value_unset (&json_value);
- if (!result)
- goto ld_diagram_object_get_data_warn;
- return;
+ if (result)
+ return;
ld_diagram_object_get_data_warn:
- g_warning ("%s: unable to set property `%s' of type `%s'"
- " from node of type `%s'; setting the property to it's default value",
+ g_warning ("%s: unable to get parameter `%s' of type `%s'"
+ " from node of type `%s'; setting the parameter to it's default value",
G_STRFUNC, name, G_PARAM_SPEC_TYPE_NAME (pspec),
json_node_type_name (node));
ld_diagram_object_get_data_default:
- g_param_value_set_default (pspec, value);
- g_object_set_property (G_OBJECT (self), name, value);
+ g_param_value_set_default (pspec, data);
+ g_object_set_property (G_OBJECT (self), name, data);
}
/**
- * ld_diagram_object_set_data:
+ * ld_diagram_object_set_data_for_param:
* @self: An #LdDiagramObject object.
- * @value: The data.
- * @pspec: The parameter to set data for.
+ * @data: The data.
+ * @pspec: The parameter to put data for.
*
- * Set data in internal storage.
+ * Put data for a parameter into internal storage.
*/
void
-ld_diagram_object_set_data (LdDiagramObject *self,
- const GValue *value, GParamSpec *pspec)
+ld_diagram_object_set_data_for_param (LdDiagramObject *self,
+ const GValue *data, GParamSpec *pspec)
{
JsonObject *storage;
const gchar *name;
JsonNode *node;
g_return_if_fail (LD_IS_DIAGRAM_OBJECT (self));
- g_return_if_fail (G_IS_VALUE (value));
+ g_return_if_fail (G_IS_VALUE (data));
g_return_if_fail (G_IS_PARAM_SPEC (pspec));
storage = ld_diagram_object_get_storage (self);
name = g_param_spec_get_name (pspec);
node = json_node_new (JSON_NODE_VALUE);
- json_node_set_value (node, value);
+ json_node_set_value (node, data);
/* We have to remove it first due to a bug in json-glib. */
json_object_remove_member (storage, name);
json_object_set_member (storage, name, node);
diff --git a/liblogdiag/ld-diagram-object.h b/liblogdiag/ld-diagram-object.h
index d20f962..8ab8791 100644
--- a/liblogdiag/ld-diagram-object.h
+++ b/liblogdiag/ld-diagram-object.h
@@ -56,10 +56,11 @@ GType ld_diagram_object_get_type (void) G_GNUC_CONST;
LdDiagramObject *ld_diagram_object_new (JsonObject *storage);
JsonObject *ld_diagram_object_get_storage (LdDiagramObject *self);
void ld_diagram_object_set_storage (LdDiagramObject *self, JsonObject *storage);
-void ld_diagram_object_get_data (LdDiagramObject *self,
- GValue *value, GParamSpec *pspec);
-void ld_diagram_object_set_data (LdDiagramObject *self,
- const GValue *value, GParamSpec *pspec);
+void ld_diagram_object_get_data_for_param (LdDiagramObject *self,
+ GValue *data, GParamSpec *pspec);
+void ld_diagram_object_set_data_for_param (LdDiagramObject *self,
+ const GValue *data, GParamSpec *pspec);
+
gdouble ld_diagram_object_get_x (LdDiagramObject *self);
gdouble ld_diagram_object_get_y (LdDiagramObject *self);
void ld_diagram_object_set_x (LdDiagramObject *self, gdouble x);
diff --git a/liblogdiag/ld-diagram-symbol.c b/liblogdiag/ld-diagram-symbol.c
index 72a11a7..070befd 100644
--- a/liblogdiag/ld-diagram-symbol.c
+++ b/liblogdiag/ld-diagram-symbol.c
@@ -70,7 +70,7 @@ ld_diagram_symbol_get_property (GObject *object, guint property_id,
switch (property_id)
{
case PROP_CLASS:
- ld_diagram_object_get_data (self, value, pspec);
+ ld_diagram_object_get_data_for_param (self, value, pspec);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -87,7 +87,7 @@ ld_diagram_symbol_set_property (GObject *object, guint property_id,
switch (property_id)
{
case PROP_CLASS:
- ld_diagram_object_set_data (self, value, pspec);
+ ld_diagram_object_set_data_for_param (self, value, pspec);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);