X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Fautorecover.cpp;h=d8b1ae61bdc1cb944199ff3d82a224d9e47ea303;hb=74d03302d1e6f05f1f90d4c2a3b38a03aa51dc86;hp=06c1db38aec0dc08cca32b564501db224775fd3a;hpb=3a3c4bca3a17137bec5d7960560934b91ef4146e;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/autorecover.cpp b/synfig-studio/trunk/src/gtkmm/autorecover.cpp index 06c1db3..d8b1ae6 100644 --- a/synfig-studio/trunk/src/gtkmm/autorecover.cpp +++ b/synfig-studio/trunk/src/gtkmm/autorecover.cpp @@ -1,20 +1,21 @@ -/* === S I N F G =========================================================== */ +/* === S Y N F I G ========================================================= */ /*! \file autorecover.cpp ** \brief Template File ** ** $Id: autorecover.cpp,v 1.1.1.1 2005/01/07 03:34:35 darco Exp $ ** ** \legal -** Copyright (c) 2002 Robert B. Quattlebaum Jr. +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley ** -** This software and associated documentation -** are CONFIDENTIAL and PROPRIETARY property of -** the above-mentioned copyright holder. +** This package is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 2 of +** the License, or (at your option) any later version. ** -** You may not copy, print, publish, or in any -** other way distribute this software without -** a prior written agreement with -** the copyright holder. +** This package is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. ** \endlegal */ /* ========================================================================= */ @@ -30,10 +31,13 @@ #include "autorecover.h" +#ifdef HAVE_SYS_ERRNO_H +#include +#endif //#include #include "app.h" -#include -#include +#include +#include #include #include #include "instance.h" @@ -64,7 +68,7 @@ using namespace std; using namespace etl; -using namespace sinfg; +using namespace synfig; using namespace studio; /* === M A C R O S ========================================================= */ @@ -87,11 +91,11 @@ AutoRecover::AutoRecover() if(mkdir(get_shadow_directory().c_str(),ACCESSPERMS)<0) { if(errno!=EEXIST) - sinfg::error("UNABLE TO CREATE \"%s\"",get_shadow_directory().c_str()); + synfig::error("UNABLE TO CREATE \"%s\"",get_shadow_directory().c_str()); } else { - sinfg::info("Created directory \"%s\"",get_shadow_directory().c_str()); + synfig::info("Created directory \"%s\"",get_shadow_directory().c_str()); } } @@ -99,7 +103,7 @@ AutoRecover::~AutoRecover() { } -sinfg::String +synfig::String AutoRecover::get_shadow_directory() { return Glib::build_filename(App::get_user_app_directory(),"tmp"); @@ -122,8 +126,8 @@ AutoRecover::set_timeout(int milliseconds) // auto_backup_connect=App::main.get_context()->signal_timeout().connect(sigc::mem_fun(&AutoRecover::auto_backup),timeout); } -sinfg::String -AutoRecover::get_shadow_file_name(const sinfg::String& filename) +synfig::String +AutoRecover::get_shadow_file_name(const synfig::String& filename) { unsigned int hash1(0xdeadbeef); unsigned int hash2(0x83502529); @@ -165,15 +169,15 @@ AutoRecover::cleanup_pid(int pid) int status=0; if(waitpid(pid,&status,WNOHANG)==-1) { - sinfg::info("PID %d isn't a zombie yet",pid); + synfig::info("PID %d isn't a zombie yet",pid); return true; } if(WEXITSTATUS(status)!=0) { - sinfg::error("Autobackup seems to have failed! (PID=%d)",pid); + synfig::error("Autobackup seems to have failed! (PID=%d)",pid); } else - sinfg::info("PID=%d has been cleaned up",pid); + synfig::info("PID=%d has been cleaned up",pid); #endif return false; } @@ -219,12 +223,12 @@ AutoRecover::auto_backup() } if(savecount) - sinfg::info("AutoRecover::auto_backup(): %d Files backed up.",savecount); + synfig::info("AutoRecover::auto_backup(): %d Files backed up.",savecount); } catch(...) { - sinfg::error("AutoRecover::auto_backup(): UNKNOWN EXCEPTION THROWN."); - sinfg::error("AutoRecover::auto_backup(): FILES NOT BACKED UP."); + synfig::error("AutoRecover::auto_backup(): UNKNOWN EXCEPTION THROWN."); + synfig::error("AutoRecover::auto_backup(): FILES NOT BACKED UP."); } #ifdef HAVE_FORK @@ -313,7 +317,7 @@ AutoRecover::normal_shutdown() } void -AutoRecover::clear_backup(sinfg::Canvas::Handle canvas) +AutoRecover::clear_backup(synfig::Canvas::Handle canvas) { if(canvas) remove(get_shadow_file_name(canvas->get_file_name()).c_str());