diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/inkscape.cpp | 7 | ||||
| -rw-r--r-- | src/preferences-skeleton.h | 2 | ||||
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.cpp | 6 |
3 files changed, 9 insertions, 6 deletions
diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 05b5aeec1..67bedb1f8 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -19,6 +19,7 @@ #endif #include <cerrno> +#include <unistd.h> #include <map> @@ -212,7 +213,7 @@ int Application::autosave() if (!tmp.empty()) { autosave_dir = tmp; } else { - autosave_dir = Glib::get_tmp_dir(); + autosave_dir = Glib::build_filename(Glib::get_user_cache_dir(), "inkscape"); } } @@ -239,6 +240,7 @@ int Application::autosave() gint autosave_max = prefs->getInt("/options/autosave/max", 10); gint docnum = 0; + int pid = ::getpid(); SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Autosaving documents...")); for (std::map<SPDocument*,int>::iterator iter = _document_set.begin(); @@ -251,6 +253,7 @@ int Application::autosave() Inkscape::XML::Node *repr = doc->getReprRoot(); + if (doc->isModifiedSinceSave()) { gchar *oldest_autosave = nullptr; const gchar *filename = nullptr; @@ -296,7 +299,7 @@ int Application::autosave() // Set the filename we will actually save to g_free(baseName); - baseName = g_strdup_printf("inkscape-autosave-%d-%s-%03d.svg", uid, sptstr, docnum); + baseName = g_strdup_printf("inkscape-autosave-%d-%d-%s-%03d.svg", uid, pid, sptstr, docnum); gchar* full_path = g_build_filename(autosave_dir.c_str(), baseName, NULL); g_free(baseName); baseName = nullptr; diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index c9479e90e..2fb76923c 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -352,7 +352,7 @@ static char const preferences_skeleton[] = " </group>\n" " <group id=\"forkgradientvectors\" value=\"1\"/>\n" " <group id=\"iconrender\" named_nodelay=\"0\"/>\n" -" <group id=\"autosave\" enable=\"0\" interval=\"10\" path=\"\" max=\"10\"/>\n" +" <group id=\"autosave\" enable=\"1\" interval=\"10\" path=\"\" max=\"10\"/>\n" " <group id=\"grids\"" " no_emphasize_when_zoomedout=\"0\">\n" " <group id=\"xy\" " diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 3cc2136a1..ecf470d21 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -1339,12 +1339,12 @@ void InkscapePreferences::initPageIO() this->AddPage(_page_cms, _("Color management"), iter_io, PREFS_PAGE_IO_CMS); // Autosave options - _save_autosave_enable.init( _("Enable autosave (requires restart)"), "/options/autosave/enable", false); + _save_autosave_enable.init( _("Enable autosave (requires restart)"), "/options/autosave/enable", true); _page_autosave.add_line(false, "", _save_autosave_enable, "", _("Automatically save the current document(s) at a given interval, thus minimizing loss in case of a crash"), false); _save_autosave_path.init("/options/autosave/path", true); if (prefs->getString("/options/autosave/path").empty()) { // Show the default fallback "tmp dir" if autosave path is not set. - _save_autosave_path.set_text(Glib::get_tmp_dir()); + _save_autosave_path.set_text(Glib::build_filename(Glib::get_user_cache_dir(), "inkscape")); } _page_autosave.add_line(false, C_("Filesystem", "Autosave _directory:"), _save_autosave_path, "", _("The directory where autosaves will be written. This should be an absolute path (starts with / on UNIX or a drive letter such as C: on Windows). "), false); _save_autosave_interval.init("/options/autosave/interval", 1.0, 10800.0, 1.0, 10.0, 10.0, true, false); @@ -2238,7 +2238,7 @@ void InkscapePreferences::initPageSystem() Glib::ustring tmp_dir = prefs->getString("/options/autosave/path"); if (tmp_dir.empty()) { - tmp_dir = Glib::get_tmp_dir(); + tmp_dir = Glib::build_filename(Glib::get_user_cache_dir(), "inkscape"); } _sys_tmp_files.set_text(tmp_dir); _sys_tmp_files.set_editable(false); |
