[dia] [diagram-as-object] stop timestamp modification of diagram files



commit e09f95c6c6f4b13e6898106a20f1a542f79b1b90
Author: Hans Breuer <hans breuer org>
Date:   Fri Aug 6 16:34:12 2010 +0200

    [diagram-as-object] stop timestamp modification of diagram files
    
    I don't know what I was thinking to use g_utime() while I should
    have used g_stat() - probably nothing ;)
    
    Minor modifications to both effected diagram files.

 objects/Misc/diagram_as_object.c |   19 +++----------
 samples/render-test.dia          |  Bin 6201 -> 6211 bytes
 samples/std-props-test.dia       |   53 ++++++++++++++++++++------------------
 3 files changed, 33 insertions(+), 39 deletions(-)
---
diff --git a/objects/Misc/diagram_as_object.c b/objects/Misc/diagram_as_object.c
index 3709729..3deee3e 100644
--- a/objects/Misc/diagram_as_object.c
+++ b/objects/Misc/diagram_as_object.c
@@ -21,11 +21,6 @@
 #include <config.h>
 
 #include <time.h>
-#ifdef HAVE_UTIME_H
-#  include <utime.h>
-#else
-#  include <sys/utime.h>
-#endif
 #include <glib.h>
 #ifdef HAVE_UNISTD_H
 #include <unistd.h> /* close */
@@ -229,22 +224,18 @@ _dae_draw(DiagramAsElement *dae, DiaRenderer *renderer)
 static void
 _dae_update_data(DiagramAsElement *dae)
 {
-  struct utimbuf utbuf;
+  struct stat statbuf;
   Element *elem = &dae->element;
   DiaObject *obj = &elem->object;
   static int working = 0;
   
-  if (working > 1)
+  if (working > 2)
     return; /* protect against infinite recursion */
   ++working;
 
   if (   strlen(dae->filename)
-#if GLIB_CHECK_VERSION(2,18,0)
-      && g_utime(dae->filename, &utbuf) == 0
-#else
-      && utime(dae->filename, &utbuf) == 0
-#endif
-      && dae->mtime != utbuf.modtime) {
+      && g_stat(dae->filename, &statbuf) == 0
+      && dae->mtime != statbuf.st_mtime) {
     DiaImportFilter *inf;
 
     if (dae->data)
@@ -255,7 +246,7 @@ _dae_update_data(DiagramAsElement *dae)
     if (inf && inf->import_func(dae->filename, dae->data, inf->user_data)) {
       dae->scale = dae->element.width / (dae->data->extents.right - dae->data->extents.left);
       dae->element.height = (dae->data->extents.bottom - dae->data->extents.top) * dae->scale;
-      dae->mtime = utbuf.modtime;
+      dae->mtime = statbuf.st_mtime;
     }
     /* invalidate possibly cached image */
     if (dae->image) {
diff --git a/samples/render-test.dia b/samples/render-test.dia
index 2ab453b..7a44307 100644
Binary files a/samples/render-test.dia and b/samples/render-test.dia differ
diff --git a/samples/std-props-test.dia b/samples/std-props-test.dia
index 41d5d12..94b871e 100644
--- a/samples/std-props-test.dia
+++ b/samples/std-props-test.dia
@@ -71,7 +71,7 @@
         <dia:point val="2,2"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="2,0.9;12.52,2.28"/>
+        <dia:rectangle val="2,0.8975;12.2925,2.28"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
@@ -104,7 +104,7 @@
         <dia:point val="2,3"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="2,2.475;21.2675,3.83806"/>
+        <dia:rectangle val="2,2.475;21.2425,3.84056"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
@@ -177,7 +177,7 @@ when messing with the std-props implementation.#</dia:string>
         <dia:point val="7,26"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="7,25.475;11.9075,26.8381"/>
+        <dia:rectangle val="7,25.475;11.8975,26.8406"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
@@ -241,7 +241,7 @@ when messing with the std-props implementation.#</dia:string>
         <dia:point val="7,6"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="7,5.475;11.97,7.54361"/>
+        <dia:rectangle val="7,5.475;11.96,7.54611"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
@@ -313,7 +313,7 @@ when messing with the std-props implementation.#</dia:string>
         <dia:point val="7,11"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="7,10.475;11.3175,12.5436"/>
+        <dia:rectangle val="7,10.475;11.3075,12.5461"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
@@ -348,7 +348,7 @@ when messing with the std-props implementation.#</dia:string>
         <dia:point val="2,22"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="2,20.9;4.635,22.28"/>
+        <dia:rectangle val="2,20.8975;4.5425,22.28"/>
       </dia:attribute>
       <dia:attribute name="meta">
         <dia:composite type="dict">
@@ -388,7 +388,7 @@ when messing with the std-props implementation.#</dia:string>
         <dia:point val="7,21"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="7,20.475;11.39,22.5436"/>
+        <dia:rectangle val="7,20.475;11.275,22.5461"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
@@ -471,7 +471,7 @@ when messing with the std-props implementation.#</dia:string>
         <dia:point val="7,16"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="7,15.475;12.495,16.8381"/>
+        <dia:rectangle val="7,15.475;12.465,16.8406"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
@@ -698,7 +698,7 @@ when messing with the std-props implementation.#</dia:string>
         <dia:point val="35,11"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="35,10.475;39.545,12.5436"/>
+        <dia:rectangle val="35,10.475;39.545,12.5461"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
@@ -743,6 +743,9 @@ when messing with the std-props implementation.#</dia:string>
           <dia:attribute name="id">
             <dia:string>#chronogram-line#</dia:string>
           </dia:attribute>
+          <dia:attribute name="url">
+            <dia:string>#http://en.wikipedia.org/wiki/Chronogram#</dia:string>
+          </dia:attribute>
         </dia:composite>
       </dia:attribute>
       <dia:attribute name="elem_corner">
@@ -758,7 +761,7 @@ when messing with the std-props implementation.#</dia:string>
         <dia:string>#a#</dia:string>
       </dia:attribute>
       <dia:attribute name="events">
-        <dia:string># 1,0 (3,0) 3,0 (4,0) #</dia:string>
+        <dia:string># 1 0 (3.0) 3.0 (4.0) #</dia:string>
       </dia:attribute>
       <dia:attribute name="start_time">
         <dia:real val="0"/>
@@ -802,7 +805,7 @@ when messing with the std-props implementation.#</dia:string>
         <dia:point val="35,16"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="35,15.475;41.6775,17.5436"/>
+        <dia:rectangle val="35,15.475;41.6775,17.5461"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
@@ -837,7 +840,7 @@ when messing with the std-props implementation.#</dia:string>
         <dia:point val="15,10"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="15,9.52685;18.091,13.3793"/>
+        <dia:rectangle val="15,9.34708;19.0447,13.5277"/>
       </dia:attribute>
       <dia:attribute name="meta">
         <dia:composite type="dict">
@@ -868,7 +871,7 @@ when messing with the std-props implementation.#</dia:string>
         <dia:color val="#000000"/>
       </dia:attribute>
       <dia:attribute name="fill_colour">
-        <dia:color val="#00ffff"/>
+        <dia:color val="#add8e6"/>
       </dia:attribute>
       <dia:attribute name="show_background">
         <dia:boolean val="true"/>
@@ -879,7 +882,7 @@ when messing with the std-props implementation.#</dia:string>
         <dia:point val="20,11"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="20,10.475;25.4625,11.8381"/>
+        <dia:rectangle val="20,10.475;25.45,11.8406"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
@@ -913,7 +916,7 @@ when messing with the std-props implementation.#</dia:string>
         <dia:point val="30,20"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="30,20;32.2325,22.7"/>
+        <dia:rectangle val="30,20;32.16,22.7"/>
       </dia:attribute>
       <dia:attribute name="meta">
         <dia:composite type="dict"/>
@@ -922,7 +925,7 @@ when messing with the std-props implementation.#</dia:string>
         <dia:point val="30,20"/>
       </dia:attribute>
       <dia:attribute name="elem_width">
-        <dia:real val="2.2324999999999999"/>
+        <dia:real val="2.1600000000000001"/>
       </dia:attribute>
       <dia:attribute name="elem_height">
         <dia:real val="2.7000000000000002"/>
@@ -1029,7 +1032,7 @@ when messing with the std-props implementation.#</dia:string>
         <dia:point val="35,21"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="35,20.475;41.9325,21.8381"/>
+        <dia:rectangle val="35,20.475;41.9325,21.8406"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
@@ -1063,7 +1066,7 @@ when messing with the std-props implementation.#</dia:string>
         <dia:point val="15,15.0106"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="15,15.0106;19,18.2457"/>
+        <dia:rectangle val="15,15.0106;19,18.2131"/>
       </dia:attribute>
       <dia:attribute name="meta">
         <dia:composite type="dict">
@@ -1088,10 +1091,10 @@ when messing with the std-props implementation.#</dia:string>
         <dia:real val="4"/>
       </dia:attribute>
       <dia:attribute name="elem_height">
-        <dia:real val="3.2351416468891081"/>
+        <dia:real val="3.2024613210611483"/>
       </dia:attribute>
       <dia:attribute name="line_width">
-        <dia:real val="1.1754943508222875e-038"/>
+        <dia:real val="1.1754943508222875e-38"/>
       </dia:attribute>
       <dia:attribute name="line_colour">
         <dia:color val="#000000"/>
@@ -1111,7 +1114,7 @@ when messing with the std-props implementation.#</dia:string>
         <dia:point val="20,16"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="20,15.475;24.2375,16.8381"/>
+        <dia:rectangle val="20,15.475;24.2375,16.8406"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
@@ -1145,7 +1148,7 @@ when messing with the std-props implementation.#</dia:string>
         <dia:point val="15.2,20.2"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="15.2,20.2;25,26.8512"/>
+        <dia:rectangle val="15.2,20.2;25,26.8518"/>
       </dia:attribute>
       <dia:attribute name="meta">
         <dia:composite type="dict">
@@ -1170,10 +1173,10 @@ when messing with the std-props implementation.#</dia:string>
         <dia:real val="9.8000000000000007"/>
       </dia:attribute>
       <dia:attribute name="elem_height">
-        <dia:real val="6.6512161271479551"/>
+        <dia:real val="6.6518285779883923"/>
       </dia:attribute>
       <dia:attribute name="line_width">
-        <dia:real val="1.1754943508222875e-038"/>
+        <dia:real val="1.1754943508222875e-38"/>
       </dia:attribute>
       <dia:attribute name="line_colour">
         <dia:color val="#000000"/>
@@ -1193,7 +1196,7 @@ when messing with the std-props implementation.#</dia:string>
         <dia:point val="20,20.9894"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="20,20.4644;24.2375,21.8275"/>
+        <dia:rectangle val="20,20.4644;24.2375,21.83"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">



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