diff options
| author | Slagvi Public <JandotDarowskiattgmaildottcom> | 2013-08-04 12:37:48 +0000 |
|---|---|---|
| committer | Slagvi Public <JandotDarowskiattgmaildottcom> | 2013-08-04 12:37:48 +0000 |
| commit | 3d59db609dcae34444b45348c57ac203886576b6 (patch) | |
| tree | 0ac260fa3cdc6aa3e60db7778a8f7f09dd8f909f /src/file.cpp | |
| parent | Template preview size fixed (diff) | |
| download | inkscape-3d59db609dcae34444b45348c57ac203886576b6.tar.gz inkscape-3d59db609dcae34444b45348c57ac203886576b6.zip | |
Removing template data from XML tree added
(bzr r12379.2.18)
Diffstat (limited to 'src/file.cpp')
| -rw-r--r-- | src/file.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/file.cpp b/src/file.cpp index 9d3c513ab..ee205b035 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -227,7 +227,7 @@ sp_file_exit() */ bool sp_file_open(const Glib::ustring &uri, Inkscape::Extension::Extension *key, - bool add_to_recent, bool replace_empty) + int flags) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; if (desktop) { @@ -252,9 +252,19 @@ bool sp_file_open(const Glib::ustring &uri, } if (doc) { + if (flags & IS_FROM_TEMPLATE){ + Inkscape::XML::Node *myRoot = doc->getReprRoot(); + Inkscape::XML::Node *nodeToRemove = sp_repr_lookup_name(myRoot, "inkscape:_templateinfo"); + if (nodeToRemove != NULL){ + sp_repr_unparent(nodeToRemove); + delete nodeToRemove; + DocumentUndo::clearUndo(doc); + } + } + SPDocument *existing = desktop ? sp_desktop_document(desktop) : NULL; - if (existing && existing->virgin && replace_empty) { + if (existing && existing->virgin && (flags & REPLACE_EMPTY)) { // If the current desktop is empty, open the document there doc->ensureUpToDate(); // TODO this will trigger broken link warnings, etc. desktop->change_document(doc); @@ -268,14 +278,14 @@ bool sp_file_open(const Glib::ustring &uri, doc->virgin = FALSE; - // everyone who cares now has a reference, get rid of ours + // everyone who cares now has a reference, get rid of our`s doc->doUnref(); // resize the window to match the document properties sp_namedview_window_from_document(desktop); sp_namedview_update_layers_from_document(desktop); - if (add_to_recent) { + if (flags & ADD_TO_RECENT) { sp_file_add_recent( doc->getURI() ); } |
