"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Pinta/Actions/File/SaveDocumentImplementationAction.cs" between
pinta-1.7.tar.gz and pinta-1.7.1.tar.gz

About: Pinta is a powerful image drawing and editing program (modeled after Paint.NET).

SaveDocumentImplementationAction.cs  (pinta-1.7):SaveDocumentImplementationAction.cs  (pinta-1.7.1)
skipping to change at line 198 skipping to change at line 198
if (format == null || format.IsReadOnly ()) { if (format == null || format.IsReadOnly ()) {
MessageDialog md = new MessageDialog (parent, Dia logFlags.Modal, MessageType.Error, ButtonsType.Ok, Catalog.GetString ("Pinta doe s not support saving images in this file format."), file); MessageDialog md = new MessageDialog (parent, Dia logFlags.Modal, MessageType.Error, ButtonsType.Ok, Catalog.GetString ("Pinta doe s not support saving images in this file format."), file);
md.Title = Catalog.GetString ("Error"); md.Title = Catalog.GetString ("Error");
md.Run (); md.Run ();
md.Destroy (); md.Destroy ();
return false; return false;
} }
// If the user tries to save over a read only file, give
a more informative error message than "Unhandled Exception"
FileInfo file_info = new FileInfo (file);
if (file_info.Exists && file_info.IsReadOnly) {
MessageDialog md = new MessageDialog (parent, Dia
logFlags.Modal, MessageType.Error,
ButtonsType.Ok, Catalog.GetString ("Canno
t save read only file."));
md.Title = Catalog.GetString ("Error");
md.Run ();
md.Destroy ();
return false;
}
// Commit any pending changes // Commit any pending changes
PintaCore.Tools.Commit (); PintaCore.Tools.Commit ();
try { try {
format.Exporter.Export (document, file, parent); format.Exporter.Export (document, file, parent);
} catch (GLib.GException e) { // Errors from GDK } catch (GLib.GException e) { // Errors from GDK
if (e.Message == "Image too large to be saved as ICO") { if (e.Message == "Image too large to be saved as ICO") {
string primary = Catalog.GetString ("Imag e too large"); string primary = Catalog.GetString ("Imag e too large");
string secondary = Catalog.GetString ("IC O files can not be larger than 255 x 255 pixels."); string secondary = Catalog.GetString ("IC O files can not be larger than 255 x 255 pixels.");
string message = string.Format (markup, p rimary, secondary); string message = string.Format (markup, p rimary, secondary);
MessageDialog md = new MessageDialog (par ent, DialogFlags.Modal, MessageType.Error, MessageDialog md = new MessageDialog (par ent, DialogFlags.Modal, MessageType.Error,
ButtonsType.Ok, message); ButtonsType.Ok, message);
md.Run (); md.Run ();
md.Destroy (); md.Destroy ();
return false; return false;
} else if (e.Message.Contains ("Permission denied
") && e.Message.Contains ("Failed to open")) {
string primary = Catalog.GetString ("Fail
ed to save image");
// Translators: {0} is the name of a file
that the user does not have write permission for.
string secondary = string.Format(Catalog.
GetString ("You do not have access to modify '{0}'. The file or folder may be re
ad-only."), file);
string message = string.Format (markup, p
rimary, secondary);
var md = new MessageDialog (parent, Dialo
gFlags.Modal, MessageType.Error, ButtonsType.Ok, message);
md.Run ();
md.Destroy ();
return false;
} else { } else {
throw e; // Only catch exceptions we know the reason for throw e; // Only catch exceptions we know the reason for
} }
} catch (OperationCanceledException) { } catch (OperationCanceledException) {
return false; return false;
} }
document.Filename = Path.GetFileName (file); // Set Pathname and Filename properties which triggers th
document.IsDirty = false; e document.Renamed event
document.PathAndFileName = file;
PintaCore.Tools.CurrentTool.DoAfterSave(); PintaCore.Tools.CurrentTool.DoAfterSave();
// Mark the document as clean following the tool's after-
save handler, which might
// adjust history (e.g. undo changes that were committed
before saving).
document.Workspace.History.SetClean ();
//Now the Document has been saved to the file it's associ ated with in this session. //Now the Document has been saved to the file it's associ ated with in this session.
document.HasBeenSavedInSession = true; document.HasBeenSavedInSession = true;
return true; return true;
} }
private bool ConfirmOverwrite (FileChooserDialog fcd, string file ) private bool ConfirmOverwrite (FileChooserDialog fcd, string file )
{ {
string primary = Catalog.GetString ("A file named \"{0}\" already exists. Do you want to replace it?"); string primary = Catalog.GetString ("A file named \"{0}\" already exists. Do you want to replace it?");
string secondary = Catalog.GetString ("The file already e xists in \"{1}\". Replacing it will overwrite its contents."); string secondary = Catalog.GetString ("The file already e xists in \"{1}\". Replacing it will overwrite its contents.");
 End of changes. 4 change blocks. 
17 lines changed or deleted 27 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)