From c62b0ca6e9648a01e2f01df07789749183477042 Mon Sep 17 00:00:00 2001 From: joncruz Date: Sat, 10 May 2008 19:38:34 +0000 Subject: [PATCH] Do not show/edit image URL for data URIs. Fixes Bug #227253. --- src/dialogs/object-attributes.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/dialogs/object-attributes.cpp b/src/dialogs/object-attributes.cpp index 475e8dce6..e0c891ea1 100644 --- a/src/dialogs/object-attributes.cpp +++ b/src/dialogs/object-attributes.cpp @@ -24,6 +24,7 @@ #include "macros.h" #include "sp-anchor.h" #include "sp-attribute-widget.h" +#include "../xml/repr.h" #include #include @@ -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() -- 2.30.2