summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 80b8a7f)
raw | patch | inline | side by side (parent: 80b8a7f)
author | theadib <theadib@users.sourceforge.net> | |
Sat, 1 Aug 2009 23:31:02 +0000 (23:31 +0000) | ||
committer | theadib <theadib@users.sourceforge.net> | |
Sat, 1 Aug 2009 23:31:02 +0000 (23:31 +0000) |
index eabf147f64980afa2acbb18027dc682c961da6a3..e6ce40bc0f517e948d3a5772a1ef940c01b4a0cb 100644 (file)
namespace Implementation {
/** \brief Make GTK+ events continue to come through a little bit
-
+
This just keeps coming the events through so that we'll make the GUI
update and look pretty.
*/
\param module Extention to be used
\param doc Document to be saved
\param filename The name to save the final file as
+ \return false in case of any failure writing the file, otherwise true
Well, at some point people need to save - it is really what makes
the entire application useful. And, it is possible that someone
tempfd_in = Inkscape::IO::file_open_tmp(tempfilename_in, "ink_ext_XXXXXX.svg");
} catch (...) {
/// \todo Popup dialog here
- return;
+ throw Inkscape::Extension::Output::save_failed();
}
if (helper_extension.size() == 0) {
execute(command, params, tempfilename_in, fileout);
std::string lfilename = Glib::filename_from_utf8(filenameArg);
- fileout.toFile(lfilename);
+ bool success = fileout.toFile(lfilename);
// make sure we don't leak file descriptors from g_file_open_tmp
close(tempfd_in);
// FIXME: convert to utf8 (from "filename encoding") and unlink_utf8name
unlink(tempfilename_in.c_str());
+ if(success == false) {
+ throw Inkscape::Extension::Output::save_failed();
+ }
+
return;
}
{
using Inkscape::Util::List;
- using Inkscape::XML::AttributeRecord;
+ using Inkscape::XML::AttributeRecord;
std::vector<gchar const *> attribs;
// Make a list of all attributes of the old root node.
for (std::list<std::string>::const_iterator i = in_params.begin();
i != in_params.end(); i++) {
//g_message("Script parameter: %s",(*i)g.c_str());
- argv.push_back(*i);
+ argv.push_back(*i);
}
if (!(filein.empty())) {
index 4620375f928f584dfc320eb09f64cd41b32b4fdc..8e25fb3517b53a74e249952442650a68c230ee1c 100644 (file)
/**
*
*/
- void checkStderr (const Glib::ustring &filename,
+ void checkStderr (const Glib::ustring &filename,
Gtk::MessageType type,
const Glib::ustring &message);
Glib::RefPtr<Glib::IOChannel> _channel;
Glib::RefPtr<Glib::MainLoop> _main_loop;
bool _dead;
-
+
public:
file_listener () : _dead(false) { };
virtual ~file_listener () {
// Note, doing a copy here, on purpose
Glib::ustring string (void) { return _string; };
- void toFile (const Glib::ustring &name) {
+ bool toFile (const Glib::ustring &name) {
+ try {
Glib::RefPtr<Glib::IOChannel> stdout_file = Glib::IOChannel::create_from_file(name, "w");
stdout_file->set_encoding();
stdout_file->write(_string);
- return;
+ } catch (Glib::FileError &e) {
+ return false;
+ }
+ return true;
};
};
index e1481d0002e7cdce122b6ed81f4d5a69a58139b0..742e938de20307e62f3d74763f4a34a2dec4f486 100644 (file)
--- a/src/extension/output.cpp
+++ b/src/extension/output.cpp
imp->save(this, doc, filename);
}
catch (...) {
- g_warning("There was an error saving the file.");
+ throw Inkscape::Extension::Output::save_failed();
}
return;
index a7828d3fc115e0bcb291b6e2fea29603c46b68d7..33ee544a107c22ae33a5e70e8c753a5bff56107e 100644 (file)
--- a/src/extension/system.cpp
+++ b/src/extension/system.cpp
@@ -277,7 +277,19 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension,
doc->setModifiedSinceSave(false);
}
- omod->save(doc, fileName);
+ try {
+ omod->save(doc, fileName);
+ }
+ catch(...) {
+ // free used ressources
+ if ( !official) {
+ g_free(saved_output_extension);
+ g_free(saved_dataloss);
+ }
+ g_free(fileName);
+
+ throw Inkscape::Extension::Output::save_failed();
+ }
// If it is an unofficial save, set the modified attributes back to what they were.
if ( !official) {