summaryrefslogtreecommitdiffstats
path: root/src/file.cpp
diff options
context:
space:
mode:
authorSlagvi Public <JandotDarowskiattgmaildottcom>2013-09-21 22:15:43 +0000
committerSlagvi Public <JandotDarowskiattgmaildottcom>2013-09-21 22:15:43 +0000
commitfebaf7e22bf572e36e9511505aa77551be274c91 (patch)
tree0f825ed22433afd6563c43fba733a8651e05f79d /src/file.cpp
parentFixed segfault on copying text. (diff)
parentSmall style fixes. (diff)
downloadinkscape-febaf7e22bf572e36e9511505aa77551be274c91.tar.gz
inkscape-febaf7e22bf572e36e9511505aa77551be274c91.zip
Merge gsoc procedural templates work.
(bzr r12570)
Diffstat (limited to 'src/file.cpp')
-rw-r--r--src/file.cpp30
1 files changed, 12 insertions, 18 deletions
diff --git a/src/file.cpp b/src/file.cpp
index caea05d95..baa7b12b5 100644
--- a/src/file.cpp
+++ b/src/file.cpp
@@ -74,6 +74,8 @@
#include <glibmm/i18n.h>
#include <glibmm/miscutils.h>
+#include <string>
+
using Inkscape::DocumentUndo;
#ifdef WITH_GNOME_VFS
@@ -124,7 +126,7 @@ static void sp_file_add_recent(gchar const *uri)
/**
* Create a blank document and add it to the desktop
*/
-SPDesktop *sp_file_new(const Glib::ustring &templ)
+SPDesktop *sp_file_new(const std::string &templ)
{
SPDocument *doc = SPDocument::createNewDoc( !templ.empty() ? templ.c_str() : 0 , TRUE, true );
g_return_val_if_fail(doc != NULL, NULL);
@@ -139,24 +141,13 @@ SPDesktop *sp_file_new(const Glib::ustring &templ)
}
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- if (desktop) {
+ if (desktop)
desktop->setWaitingCursor();
- }
- SPDocument *existing = desktop ? sp_desktop_document(desktop) : NULL;
-
- if (existing && existing->virgin) {
- // If the current desktop is empty, open the document there
- doc->ensureUpToDate(); // TODO this will trigger broken link warnings, etc.
- desktop->change_document(doc);
- doc->emitResizedSignal(doc->getWidth().value("px"), doc->getHeight().value("px"));
- } else {
- // create a whole new desktop and window
- SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL)); // TODO this will trigger broken link warnings, etc.
- g_return_val_if_fail(dtw != NULL, NULL);
- sp_create_window(dtw, TRUE);
- desktop = static_cast<SPDesktop *>(dtw->view);
- }
+ SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL)); // TODO this will trigger broken link warnings, etc.
+ g_return_val_if_fail(dtw != NULL, NULL);
+ sp_create_window(dtw, TRUE);
+ desktop = static_cast<SPDesktop *>(dtw->view);
doc->doUnref();
@@ -166,6 +157,9 @@ SPDesktop *sp_file_new(const Glib::ustring &templ)
#ifdef WITH_DBUS
Inkscape::Extension::Dbus::dbus_init_desktop_interface(desktop);
#endif
+
+ if (desktop)
+ desktop->clearWaitingCursor();
return desktop;
}
@@ -220,7 +214,7 @@ SPDesktop* sp_file_new_default()
{
Glib::ustring templateUri = sp_file_default_template_uri();
SPDesktop* desk = sp_file_new(sp_file_default_template_uri());
- rdf_add_from_preferences( SP_ACTIVE_DOCUMENT );
+ //rdf_add_from_preferences( SP_ACTIVE_DOCUMENT );
return desk;
}