From ae7f7f7449a2da248ff13119e802a104de297c3d Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Wed, 22 Jan 2014 18:06:39 -0500 Subject: Improve warnings for missing files. Don't just assert bolocks to the user. (bzr r12972) --- src/xml/repr-io.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/xml') diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp index 54eff00bc..0319bb5e3 100644 --- a/src/xml/repr-io.cpp +++ b/src/xml/repr-io.cpp @@ -334,7 +334,10 @@ Document *sp_repr_read_file (const gchar * filename, const gchar *default_ns) xmlSubstituteEntitiesDefault(1); g_return_val_if_fail (filename != NULL, NULL); - g_return_val_if_fail (Inkscape::IO::file_test( filename, G_FILE_TEST_EXISTS ), NULL); + if (!Inkscape::IO::file_test( filename, G_FILE_TEST_EXISTS )) { + g_warning("Can't open file: %s (doesn't exist)", filename); + return NULL; + } /* fixme: A file can disappear at any time, including between now and when we actually try to * open it. Get rid of the above test once we're sure that we correctly handle * non-existence. */ -- cgit v1.2.3 From 53d32bfc98a277a724732a0bc9df27f0992db125 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Mon, 24 Mar 2014 22:26:34 +0100 Subject: add convenience functions to deal with Glib::ustrings for setting repr attributes (bzr r13203) --- src/xml/node.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/xml') diff --git a/src/xml/node.h b/src/xml/node.h index e83d8a7b7..a41e4e350 100644 --- a/src/xml/node.h +++ b/src/xml/node.h @@ -19,6 +19,7 @@ #define SEEN_INKSCAPE_XML_NODE_H #include +#include #include "gc-anchored.h" #include "util/list.h" @@ -194,6 +195,7 @@ public: */ virtual void setContent(gchar const *value)=0; + //@{ /** * @brief Change an attribute of this node * @@ -204,7 +206,19 @@ public: * @param is_interactive Ignored */ virtual void setAttribute(gchar const *key, gchar const *value, bool is_interactive=false)=0; - + + void setAttribute(gchar const *key, Glib::ustring const &value, bool is_interactive=false) + { + setAttribute(key, value.empty() ? NULL : value.c_str(), is_interactive); + } + + void setAttribute(Glib::ustring const &key, Glib::ustring const &value, bool is_interactive=false) + { + setAttribute( key.empty() ? NULL : key.c_str(), + value.empty() ? NULL : value.c_str(), is_interactive); + } + //@} + /** * @brief Directly set the integer GQuark code for the name of the node * -- cgit v1.2.3 From 55b428abbb6d6664a1922984ca395a4bda811714 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Mon, 24 Mar 2014 23:48:55 +0100 Subject: fix tiny mistake (bzr r13204) --- src/xml/node.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/xml') diff --git a/src/xml/node.h b/src/xml/node.h index a41e4e350..c1977b0a8 100644 --- a/src/xml/node.h +++ b/src/xml/node.h @@ -207,7 +207,7 @@ public: */ virtual void setAttribute(gchar const *key, gchar const *value, bool is_interactive=false)=0; - void setAttribute(gchar const *key, Glib::ustring const &value, bool is_interactive=false) + void setAttribute(char const *key, Glib::ustring const &value, bool is_interactive=false) { setAttribute(key, value.empty() ? NULL : value.c_str(), is_interactive); } -- cgit v1.2.3