dia r3965 - in trunk: . lib



Author: hans
Date: Sun Apr 27 15:05:50 2008
New Revision: 3965
URL: http://svn.gnome.org/viewvc/dia?rev=3965&view=rev

Log:
	(dia_object_defaults_save) : only save props not marked as NO_DEFAULTS


Modified:
   trunk/ChangeLog
   trunk/lib/object_defaults.c

Modified: trunk/lib/object_defaults.c
==============================================================================
--- trunk/lib/object_defaults.c	(original)
+++ trunk/lib/object_defaults.c	Sun Apr 27 15:05:50 2008
@@ -36,7 +36,8 @@
 #include "object.h"
 #include "message.h"
 #include "dia_dirs.h"
-
+#include "propinternals.h"
+ 
 static GHashTable *defaults_hash = NULL;
 static gboolean object_default_create_lazy = FALSE;
 
@@ -296,6 +297,12 @@
   gint        obj_nr;
 };
 
+static gboolean 
+pdtpp_do_save_no_default (const PropDescription *pdesc)
+{ 
+  return (pdesc->flags & (PROP_FLAG_DONT_SAVE|PROP_FLAG_LOAD_ONLY|PROP_FLAG_NO_DEFAULTS|PROP_FLAG_WIDGET_ONLY)) == 0; 
+} 
+
 static void
 _obj_store (gpointer key,
             gpointer value,
@@ -353,7 +360,18 @@
   }
 
   obj->ops->move (obj,&(li->pos));
-  obj->type->ops->save (obj, obj_node, ri->filename);
+  if (obj->ops->get_props) {
+    /* slightly modified from object_save_props() */
+    GPtrArray *props;
+    /* all but DONT_MERGE and NO_DEFAULTS: */
+    props = prop_list_from_descs (object_get_prop_descriptions(obj), pdtpp_do_save_no_default);  
+    obj->ops->get_props(obj, props);
+    prop_list_save(props,obj_node);
+    prop_list_free(props);
+  } else {
+    /* saving every property of the object */
+    obj->type->ops->save (obj, obj_node, ri->filename);
+  }
   /* arrange following objects below */
   li->pos.y += (obj->bounding_box.bottom - obj->bounding_box.top + 1.0); 
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]