[dia] Bug 663394 - Custom Line Type restoration on load
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] Bug 663394 - Custom Line Type restoration on load
- Date: Sun, 8 Jan 2012 11:53:08 +0000 (UTC)
commit f995c3712761feab9d097ead986e964d4d3d3f09
Author: Hans Breuer <hans breuer org>
Date: Sat Jan 7 22:52:33 2012 +0100
Bug 663394 - Custom Line Type restoration on load
The delegation was a bit inconsistent. While creation also modified
the object's type the load method did not. Now also the load
method set the custom line type.
objects/custom_lines/custom_linetypes.c | 29 +++++++++++++++++++++++------
1 files changed, 23 insertions(+), 6 deletions(-)
---
diff --git a/objects/custom_lines/custom_linetypes.c b/objects/custom_lines/custom_linetypes.c
index e20c413..b54d084 100644
--- a/objects/custom_lines/custom_linetypes.c
+++ b/objects/custom_lines/custom_linetypes.c
@@ -101,37 +101,54 @@ ensure_standard_types (void)
}
static DiaObject *
+_custom_zigzagline_load (ObjectNode obj_node, int version, const char *filename, DiaObjectType *delegate)
+{
+ DiaObject *obj;
+ DiaObjectType *ot;
+ LineInfo *line_info;
+ xmlChar *typestr;
+
+ typestr = (char *) xmlGetProp(obj_node, (const xmlChar *)"type");
+ ot = object_get_type (typestr);
+ line_info = ot->default_user_data;
+
+ if (typestr)
+ xmlFree(typestr);
+
+ obj = delegate->ops->load (obj_node, version, filename);
+ obj->type = line_info->object_type;
+
+ return obj;
+}
+static DiaObject *
custom_zigzagline_load (ObjectNode obj_node, int version, const char *filename)
{
ensure_standard_types ();
-
if (!zigzag_ot) {
g_warning ("Can't delegate to 'Standard - ZigZagLine'");
return NULL;
}
- return zigzag_ot->ops->load (obj_node, version, filename);
+ return _custom_zigzagline_load(obj_node, version, filename, zigzag_ot);
}
static DiaObject *
custom_polyline_load (ObjectNode obj_node, int version, const char *filename)
{
ensure_standard_types ();
-
if (!polyline_ot) {
g_warning ("Can't delegate to 'Standard - PolyLine'");
return NULL;
}
- return polyline_ot->ops->load (obj_node, version, filename);
+ return _custom_zigzagline_load(obj_node, version, filename, polyline_ot);
}
static DiaObject *
custom_bezierline_load (ObjectNode obj_node, int version, const char *filename)
{
ensure_standard_types ();
-
if (!bezier_ot) {
g_warning ("Can't delegate to 'Standard - BezierLine'");
return NULL;
}
- return bezier_ot->ops->load (obj_node, version, filename);
+ return _custom_zigzagline_load(obj_node, version, filename, bezier_ot);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]