summaryrefslogtreecommitdiffstats
path: root/src/inkscape.cpp
diff options
context:
space:
mode:
authorsu_v <suv-sf@users.sourceforge.net>2012-12-16 05:41:25 +0000
committer~suv <suv-sf@users.sourceforge.net>2012-12-16 05:41:25 +0000
commit7ec903c9898f872dbd9426ed7a62e1969fdb7be7 (patch)
treea306139e829118a83516af02279c9eafd3440eaa /src/inkscape.cpp
parentHershey Text: whitespace; py: docstring, modeline; inx: fix attribute value (diff)
parentTranslations.Spanish translation update by Lucas Vieites. (diff)
downloadinkscape-7ec903c9898f872dbd9426ed7a62e1969fdb7be7.tar.gz
inkscape-7ec903c9898f872dbd9426ed7a62e1969fdb7be7.zip
merge from trunk (r11955)
(bzr r11687.1.3)
Diffstat (limited to 'src/inkscape.cpp')
-rw-r--r--src/inkscape.cpp30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/inkscape.cpp b/src/inkscape.cpp
index 8548b398f..fc823f8b7 100644
--- a/src/inkscape.cpp
+++ b/src/inkscape.cpp
@@ -309,8 +309,24 @@ static gint inkscape_autosave(gpointer)
GDir *autosave_dir_ptr = g_dir_open(autosave_dir.c_str(), 0, NULL);
if( !autosave_dir_ptr ){
- g_warning("Cannot open autosave directory!");
- return TRUE;
+ // Try to create the autosave directory if it doesn't exist
+ if (g_mkdir(autosave_dir.c_str(), 0755)) {
+ // the creation failed
+ Glib::ustring msg = Glib::ustring::compose(
+ _("Autosave failed! Cannot create directory %1."), Glib::filename_to_utf8(autosave_dir));
+ g_warning("%s", msg.c_str());
+ SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::ERROR_MESSAGE, msg.c_str());
+ return TRUE;
+ }
+ // Try to read dir again
+ autosave_dir_ptr = g_dir_open(autosave_dir.c_str(), 0, NULL);
+ if( !autosave_dir_ptr ){
+ Glib::ustring msg = Glib::ustring::compose(
+ _("Autosave failed! Cannot open directory %1."), Glib::filename_to_utf8(autosave_dir));
+ g_warning("%s", msg.c_str());
+ SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::ERROR_MESSAGE, msg.c_str());
+ return TRUE;
+ }
}
time_t sptime = time(NULL);
@@ -1065,7 +1081,7 @@ inkscape_find_desktop_by_dkey (unsigned int dkey)
-unsigned int
+static unsigned int
inkscape_maximum_dkey()
{
unsigned int dkey = 0;
@@ -1081,7 +1097,7 @@ inkscape_maximum_dkey()
-SPDesktop *
+static SPDesktop *
inkscape_next_desktop ()
{
SPDesktop *d = NULL;
@@ -1112,7 +1128,7 @@ inkscape_next_desktop ()
-SPDesktop *
+static SPDesktop *
inkscape_prev_desktop ()
{
SPDesktop *d = NULL;
@@ -1254,6 +1270,10 @@ inkscape_active_document (void)
{
if (SP_ACTIVE_DESKTOP) {
return sp_desktop_document (SP_ACTIVE_DESKTOP);
+ } else if (!inkscape->document_set.empty()) {
+ // If called from the command line there will be no desktop
+ // So 'fall back' to take the first listed document in the Inkscape instance
+ return inkscape->document_set.begin()->first;
}
return NULL;