SF.net SVN: geany:[5466] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Mon Dec 6 18:04:42 UTC 2010


Revision: 5466
          http://geany.svn.sourceforge.net/geany/?rev=5466&view=rev
Author:   ntrel
Date:     2010-12-06 18:04:42 +0000 (Mon, 06 Dec 2010)

Log Message:
-----------
Improve error message for document_save_file() if doc->file_name is
NULL (reusing existing strings).
Add warning about this in the API docs.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/document.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-12-05 16:45:25 UTC (rev 5465)
+++ trunk/ChangeLog	2010-12-06 18:04:42 UTC (rev 5466)
@@ -1,3 +1,11 @@
+2010-12-06  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/document.c:
+   Improve error message for document_save_file() if doc->file_name is
+   NULL (reusing existing strings).
+   Add warning about this in the API docs.
+
+
 2010-12-03  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
 
  * scintilla/ScintillaGTK.cxx:

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2010-12-05 16:45:25 UTC (rev 5465)
+++ trunk/src/document.c	2010-12-06 18:04:42 UTC (rev 5466)
@@ -1823,15 +1823,18 @@
 
 
 /**
- *  Saves the document. Saving includes replacing tabs by spaces,
- *  stripping trailing spaces and adding a final new line at the end of the file (all only if
- *  user enabled these features). Then the @c "document-before-save" signal is emitted,
+ *  Saves the document. Saving may include replacing tabs by spaces,
+ *  stripping trailing spaces and adding a final new line at the end of the file, depending
+ *  on user preferences. Then the @c "document-before-save" signal is emitted,
  *  allowing plugins to modify the document before it is saved, and data is
  *  actually written to disk. The filetype is set again or auto-detected if it wasn't set yet.
  *  Afterwards, the @c "document-save" signal is emitted for plugins.
  *
  *  If the file is not modified, this functions does nothing unless force is set to @c TRUE.
  *
+ *  @note You should ensure @c doc->file_name is not @c NULL before calling this; otherwise
+ *  call dialogs_show_save_as().
+ *
  *  @param doc The document to save.
  *  @param force Whether to save the file even if it is not modified (e.g. for Save As).
  *
@@ -1852,7 +1855,7 @@
 
 	if (G_UNLIKELY(doc->file_name == NULL))
 	{
-		ui_set_statusbar(TRUE, _("Error saving file."));
+		ui_set_statusbar(TRUE, _("Error saving file (%s)."), _("Invalid filename"));
 		utils_beep();
 		return FALSE;
 	}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list