[glide] Shapes serialize and deserialize
- From: Robert Carr <racarr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glide] Shapes serialize and deserialize
- Date: Thu, 6 May 2010 11:55:48 +0000 (UTC)
commit c730e6f9f25c6f564ca612f3a21b92e94f8b2e32
Author: Robert Carr <racarr Valentine localdomain>
Date: Thu May 6 07:34:27 2010 -0400
Shapes serialize and deserialize
libglide/glide-shape.c | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/libglide/glide-shape.c b/libglide/glide-shape.c
index 7105987..98c5384 100644
--- a/libglide/glide-shape.c
+++ b/libglide/glide-shape.c
@@ -20,6 +20,8 @@
#include "glide-shape.h"
#include "glide-shape-priv.h"
+#include "glide-json-util.h"
+
#define GLIDE_SHAPE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GLIDE_TYPE_SHAPE, GlideShapePrivate))
G_DEFINE_TYPE (GlideShape, glide_shape, GLIDE_TYPE_ACTOR);
@@ -281,11 +283,32 @@ glide_shape_serialize (GlideActor *self)
return node;
}
+
+void
+glide_shape_deserialize (GlideActor *actor, JsonObject *actor_obj)
+{
+ GlideShape *shape = GLIDE_SHAPE (actor);
+ JsonObject *shape_props;
+ ClutterColor c;
+
+ {
+ JsonNode *n = json_object_get_member (actor_obj, "shape-properties");
+ shape_props = json_node_get_object (n);
+ }
+ clutter_color_from_string (&c, glide_json_object_get_string (shape_props, "color"));
+ glide_shape_set_color (shape, &c);
+ clutter_color_from_string (&c, glide_json_object_get_string (shape_props, "border-color"));
+ glide_shape_set_border_color (shape, &c);
+
+ glide_shape_set_border_width (shape, glide_json_object_get_double (shape_props, "border-width"));
+ glide_shape_set_has_border (shape, glide_json_object_get_boolean (shape_props, "has-border"));
+}
static void
glide_shape_class_init (GlideShapeClass *klass)
{
+ GlideActorClass *glide_actor_class = GLIDE_ACTOR_CLASS (klass);
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
@@ -296,6 +319,9 @@ glide_shape_class_init (GlideShapeClass *klass)
gobject_class->set_property = glide_shape_set_property;
gobject_class->get_property = glide_shape_get_property;
+ glide_actor_class->serialize = glide_shape_serialize;
+ glide_actor_class->deserialize = glide_shape_deserialize;
+
actor_class->paint = glide_shape_paint;
actor_class->button_press_event = glide_shape_button_press;
actor_class->button_release_event = glide_shape_button_release;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]