Code

Hold perspectives on document level rather than globally; this corrects the changes...
[inkscape.git] / src / inkscape.cpp
index 799227bf37c9b2bec2af6b934a6c02ab8d046f99..c167be493c0900a05a12b9560472da180c80b6a8 100644 (file)
@@ -727,11 +727,16 @@ inkscape_load_menus (Inkscape::Application *inkscape)
 Inkscape::XML::Node *
 inkscape_get_repr (Inkscape::Application *inkscape, const gchar *key)
 {
-    if (key == NULL) {
+    if ( (key == NULL) || (inkscape == NULL) ) {
         return NULL;
     }
 
-    Inkscape::XML::Node *repr = Inkscape::Preferences::get()->root();
+    Inkscape::XML::Node *prefs = Inkscape::Preferences::get();
+    if ( !prefs ) {
+        return NULL;
+    }
+
+    Inkscape::XML::Node *repr = prefs->root();
     if (!repr) return NULL;
     g_assert (!(strcmp (repr->name(), "inkscape")));
 
@@ -1238,6 +1243,29 @@ inkscape_init_config (Inkscape::XML::Document *doc, const gchar *config_name, co
                 return false;
             }
         }
+
+        // Also create (empty for now) subdirectories for the user's stuff
+        {
+            gchar *temp_dn = profile_path("templates");
+            Inkscape::IO::mkdir_utf8name(temp_dn);
+        }
+        {
+            gchar *temp_dn = profile_path("keys");
+            Inkscape::IO::mkdir_utf8name(temp_dn);
+        }
+        {
+            gchar *temp_dn = profile_path("icons");
+            Inkscape::IO::mkdir_utf8name(temp_dn);
+        }
+        {
+            gchar *temp_dn = profile_path("extensions");
+            Inkscape::IO::mkdir_utf8name(temp_dn);
+        }
+        {
+            gchar *temp_dn = profile_path("palettes");
+            Inkscape::IO::mkdir_utf8name(temp_dn);
+        }
+
     } else if (!Inkscape::IO::file_test(dn, G_FILE_TEST_IS_DIR)) {
         if (use_gui) {
             // Not a directory