Code

Do not show/edit image URL for data URIs.
authorjoncruz <joncruz@users.sourceforge.net>
Sat, 10 May 2008 19:38:34 +0000 (19:38 +0000)
committerjoncruz <joncruz@users.sourceforge.net>
Sat, 10 May 2008 19:38:34 +0000 (19:38 +0000)
Fixes Bug #227253.

src/dialogs/object-attributes.cpp

index 475e8dce6300c7e7588fdd82170b6c1569dba342..e0c891ea1ad22c4aedf4f30eec1d88f610fc1238 100644 (file)
@@ -24,6 +24,7 @@
 #include "macros.h"
 #include "sp-anchor.h"
 #include "sp-attribute-widget.h"
+#include "../xml/repr.h"
 
 #include <sigc++/connection.h>
 #include <sigc++/functors/ptr_fun.h>
@@ -61,6 +62,14 @@ static const SPAttrDesc image_desc[] = {
     { NULL, NULL}
 };
 
+static const SPAttrDesc image_nohref_desc[] = {
+    { N_("X:"), "x"},
+    { N_("Y:"), "y"},
+    { N_("Width:"), "width"},
+    { N_("Height:"), "height"},
+    { NULL, NULL}
+};
+
 
 static void
 object_released( SPObject */*object*/, GtkWidget *widget )
@@ -132,7 +141,13 @@ sp_object_attributes_dialog (SPObject *object, const gchar *tag)
     if (!strcmp (tag, "Link")) {
         sp_object_attr_show_dialog (object, anchor_desc, tag);
     } else if (!strcmp (tag, "Image")) {
-        sp_object_attr_show_dialog (object, image_desc, tag);
+        Inkscape::XML::Node *ir = SP_OBJECT_REPR(object);
+        const gchar *href = ir->attribute("xlink:href");
+        if ( (!href) || ((strncmp(href, "data:", 5) == 0)) ) {
+            sp_object_attr_show_dialog (object, image_nohref_desc, tag);
+        } else {
+            sp_object_attr_show_dialog (object, image_desc, tag);
+        }
     } 
 
 } // end of sp_object_attributes_dialog()