Code

remove svglsimpl
[inkscape.git] / src / helper / stock-items.cpp
index fe2026043a517b910f06e8820fc58c786ae5fa21..b531eef96c5e19cf39d94b004872e0632029621b 100644 (file)
@@ -95,12 +95,18 @@ sp_pattern_load_from_svg(gchar const *name, SPDocument *current_doc)
         if (Inkscape::IO::file_test(patterns, G_FILE_TEST_IS_REGULAR)) {
             doc = sp_document_new(patterns, FALSE);
         }
+        if (!doc) {
+        gchar *patterns = g_build_filename(CREATE_PATTERNSDIR, "/patterns.svg", NULL);
+        if (Inkscape::IO::file_test(patterns, G_FILE_TEST_IS_REGULAR)) {
+            doc = sp_document_new(patterns, FALSE);
+        }
         g_free(patterns);
         if (doc) {
             sp_document_ensure_up_to_date(doc);
         } else {
             edoc = TRUE;
         }
+        }
     }
     if (!edoc && doc) {
         /* Get the pattern we want */
@@ -131,12 +137,18 @@ sp_gradient_load_from_svg(gchar const *name, SPDocument *current_doc)
         if (Inkscape::IO::file_test(gradients, G_FILE_TEST_IS_REGULAR)) {
             doc = sp_document_new(gradients, FALSE);
         }
+        if (!doc) {
+        gchar *gradients = g_build_filename(CREATE_GRADIENTSDIR, "/gradients.svg", NULL);
+        if (Inkscape::IO::file_test(gradients, G_FILE_TEST_IS_REGULAR)) {
+            doc = sp_document_new(gradients, FALSE);
+        }
         g_free(gradients);
         if (doc) {
             sp_document_ensure_up_to_date(doc);
         } else {
             edoc = TRUE;
         }
+        }
     }
     if (!edoc && doc) {
         /* Get the gradient we want */
@@ -179,7 +191,7 @@ SPObject *get_stock_item(gchar const *urn)
         gchar * base = g_strndup(e, a);
 
         SPDesktop *desktop = inkscape_active_desktop();
-        SPDocument *doc = SP_DT_DOCUMENT(desktop);
+        SPDocument *doc = sp_desktop_document(desktop);
         SPDefs *defs= (SPDefs *) SP_DOCUMENT_DEFS(doc);
 
         SPObject *object = NULL;
@@ -248,7 +260,7 @@ SPObject *get_stock_item(gchar const *urn)
     else {
         
         SPDesktop *desktop = inkscape_active_desktop();
-        SPDocument *doc = SP_DT_DOCUMENT(desktop);
+        SPDocument *doc = sp_desktop_document(desktop);
         SPObject *object = doc->getObjectById(urn);
 
         return object;