SF.net SVN: geany:[4494] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Sun Dec 20 15:36:52 UTC 2009


Revision: 4494
          http://geany.svn.sourceforge.net/geany/?rev=4494&view=rev
Author:   eht16
Date:     2009-12-20 15:36:52 +0000 (Sun, 20 Dec 2009)

Log Message:
-----------
Add document_need_save_as().
Show the Save As also for documents created from filetype templates instead of saving them directly with the untitled filename.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/callbacks.c
    trunk/src/dialogs.c
    trunk/src/document.c
    trunk/src/document.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-12-20 12:03:28 UTC (rev 4493)
+++ trunk/ChangeLog	2009-12-20 15:36:52 UTC (rev 4494)
@@ -5,6 +5,14 @@
    closed within the next lines to avoid auto adding double \end{}.
 
 
+2009-12-19  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
+
+ * src/callbacks.c, src/dialogs.c, src/document.c, src/document.h:
+   Add document_need_save_as().
+   Show the Save As also for documents created from filetype templates
+   instead of saving them directly with the untitled filename.
+
+
 2009-12-09  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
 
  * geany.glade, src/interface.c:

Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c	2009-12-20 12:03:28 UTC (rev 4493)
+++ trunk/src/callbacks.c	2009-12-20 15:36:52 UTC (rev 4494)
@@ -182,7 +182,7 @@
 
 	if (doc != NULL && cur_page >= 0)
 	{
-		if (doc->file_name == NULL)
+		if (document_need_save_as(doc))
 			dialogs_show_save_as();
 		else
 			document_save_file(doc, FALSE);
@@ -211,7 +211,7 @@
 		doc = document_get_from_page(i);
 		if (! doc->changed)
 			continue;
-		if (doc->file_name == NULL)
+		if (document_need_save_as(doc))
 		{
 			/* display unnamed document */
 			gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook),

Modified: trunk/src/dialogs.c
===================================================================
--- trunk/src/dialogs.c	2009-12-20 12:03:28 UTC (rev 4493)
+++ trunk/src/dialogs.c	2009-12-20 15:36:52 UTC (rev 4494)
@@ -700,7 +700,7 @@
 	{
 		case GTK_RESPONSE_YES:
 		{
-			if (doc->file_name == NULL)
+			if (document_need_save_as(doc))
 			{
 				ret = dialogs_show_save_as();
 			}

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2009-12-20 12:03:28 UTC (rev 4493)
+++ trunk/src/document.c	2009-12-20 15:36:52 UTC (rev 4494)
@@ -1555,6 +1555,16 @@
 }
 
 
+/* Return TRUE if the document hasn't been saved before, i.e. either the filename or
+ * the real_path is not set. */
+gboolean document_need_save_as(GeanyDocument *doc)
+{
+	g_return_val_if_fail(doc != NULL, FALSE);
+
+	return (doc->file_name == NULL || doc->real_path == NULL);
+}
+
+
 /**
  * Saves the document, detecting the filetype.
  *

Modified: trunk/src/document.h
===================================================================
--- trunk/src/document.h	2009-12-20 12:03:28 UTC (rev 4493)
+++ trunk/src/document.h	2009-12-20 15:36:52 UTC (rev 4494)
@@ -250,4 +250,6 @@
 
 gchar *document_get_basename_for_display(GeanyDocument *doc, gint length);
 
+gboolean document_need_save_as(GeanyDocument *doc);
+
 #endif


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