[dia] image: use a hardcoded broken image



commit 4c3db4a2f768844012bdc5cec03713ed2ef25760
Author: Zander Brown <zbrown gnome org>
Date:   Mon Apr 5 02:58:37 2021 +0100

    image: use a hardcoded broken image
    
    Loading from the icon theme was nice but stops Dia running in headless
    environments

 lib/broken-image.png     | Bin 0 -> 1908 bytes
 lib/broken-image.svg     |  88 +++++++++++++++++++++++++++++++++++++++++++++++
 lib/dia_image.c          |   6 ++--
 lib/libdia.gresource.xml |   3 +-
 4 files changed, 92 insertions(+), 5 deletions(-)
---
diff --git a/lib/broken-image.png b/lib/broken-image.png
new file mode 100644
index 000000000..9f7bb7375
Binary files /dev/null and b/lib/broken-image.png differ
diff --git a/lib/broken-image.svg b/lib/broken-image.svg
new file mode 100644
index 000000000..90120fdaa
--- /dev/null
+++ b/lib/broken-image.svg
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/";
+   xmlns:cc="http://creativecommons.org/ns#";
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+   xmlns:svg="http://www.w3.org/2000/svg";
+   xmlns="http://www.w3.org/2000/svg";
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd";
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape";
+   width="128"
+   height="128"
+   viewBox="0 0 33.866666 33.866668"
+   version="1.1"
+   id="svg8"
+   inkscape:version="1.0.2 (e86c870879, 2021-01-15)"
+   sodipodi:docname="broken-image.svg"
+   inkscape:export-filename="/home/zbrown/Projects/Apps/Dia/lib/broken-image.png"
+   inkscape:export-xdpi="96"
+   inkscape:export-ydpi="96">
+  <defs
+     id="defs2" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="6.1875"
+     inkscape:cx="61.550505"
+     inkscape:cy="37.570707"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     inkscape:document-rotation="0"
+     showgrid="true"
+     units="px"
+     inkscape:pagecheckerboard="true"
+     inkscape:window-width="1530"
+     inkscape:window-height="991"
+     inkscape:window-x="26"
+     inkscape:window-y="23"
+     inkscape:window-maximized="0">
+    <inkscape:grid
+       type="xygrid"
+       id="grid833" />
+  </sodipodi:namedview>
+  <metadata
+     id="metadata5">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage"; />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1">
+    <rect
+       
style="fill:none;stroke:#ff0000;stroke-width:0.521026;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect835"
+       width="33.345642"
+       height="33.345642"
+       x="0.26051301"
+       y="0.26051301" />
+    <path
+       
style="fill:#ffff00;stroke:#000000;stroke-width:0.52916667;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
+       d="M 7.9375002,5.2916668 3.9687501,13.229167 H 11.90625 Z"
+       id="path837" />
+    <circle
+       
style="fill:#0066cc;fill-opacity:1;stroke:#000000;stroke-width:0.514865;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path839"
+       cx="24.606251"
+       cy="11.377083"
+       r="4.5050673" />
+    <rect
+       
style="fill:#99ff66;fill-opacity:1;stroke:#000000;stroke-width:0.529167;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect841"
+       width="9.260417"
+       height="9.260417"
+       x="7.9375"
+       y="19.84375" />
+  </g>
+</svg>
diff --git a/lib/dia_image.c b/lib/dia_image.c
index 517f751be..8917ed70d 100644
--- a/lib/dia_image.c
+++ b/lib/dia_image.c
@@ -23,6 +23,7 @@
 #include "geometry.h"
 #include "dia_image.h"
 #include "message.h"
+#include "widgets.h"
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <gtk/gtk.h>
 
@@ -103,10 +104,7 @@ dia_image_get_broken (void)
 
   image = DIA_IMAGE (g_object_new (DIA_TYPE_IMAGE, NULL));
   if (broken == NULL) {
-    broken = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
-                                       "image-missing",
-                                       64,
-                                       0, NULL);
+    broken = pixbuf_from_resource ("/org/gnome/Dia/broken-image.png");
   }
   image->image = g_object_ref (broken);
   /* Kinda hard to export :) */
diff --git a/lib/libdia.gresource.xml b/lib/libdia.gresource.xml
index 878a74b1d..7dc382348 100644
--- a/lib/libdia.gresource.xml
+++ b/lib/libdia.gresource.xml
@@ -4,5 +4,6 @@
     <file>icons/dia-chain-unbroken.png</file>
     <file>icons/dia-chain-broken.png</file>
     <file>icons/standard-path.png</file>
+    <file>broken-image.png</file>
   </gresource>
-</gresources>
\ No newline at end of file
+</gresources>


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