SF.net SVN: geany: [357] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Mon May 22 15:28:56 UTC 2006


Revision: 357
Author:   ntrel
Date:     2006-05-22 08:28:48 -0700 (Mon, 22 May 2006)
ViewCVS:  http://svn.sourceforge.net/geany/?rev=357&view=rev

Log Message:
-----------
insert the file type extension and fix a warning when inserting a fileheader in a new document

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/callbacks.c
    trunk/src/templates.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-05-22 13:43:56 UTC (rev 356)
+++ trunk/ChangeLog	2006-05-22 15:28:48 UTC (rev 357)
@@ -1,3 +1,10 @@
+2006-05-22  Nick Treleaven  <nick.treleaven at btinternet.com>
+
+ * src/callbacks.c, src/templates.c:
+   insert the file type extension and fix a warning when inserting a
+   fileheader in a new document
+
+
 2006-05-22  Enrico Troeger  <enrico.troeger at uvena.de>
 
  * src/keybindings.c, src/utils.c: improved toggle visibility of

Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c	2006-05-22 13:43:56 UTC (rev 356)
+++ trunk/src/callbacks.c	2006-05-22 15:28:48 UTC (rev 357)
@@ -2126,12 +2126,16 @@
 {
 	gint idx = document_get_cur_idx();
 	gchar *text;
+	gchar *ext = NULL;
 
+	if (doc_list[idx].file_name == NULL)
+		ext = doc_list[idx].file_type->extension;
+
 	switch (doc_list[idx].file_type->id)
 	{
 		case GEANY_FILETYPES_PASCAL:
 		{
-			text = templates_get_template_fileheader(GEANY_TEMPLATE_FILEHEADER_PASCAL, NULL, idx);
+			text = templates_get_template_fileheader(GEANY_TEMPLATE_FILEHEADER_PASCAL, ext, idx);
 			break;
 		}
 		case GEANY_FILETYPES_PYTHON:
@@ -2140,12 +2144,12 @@
 		case GEANY_FILETYPES_MAKE:
 		case GEANY_FILETYPES_PERL:
 		{
-			text = templates_get_template_fileheader(GEANY_TEMPLATE_FILEHEADER_ROUTE, NULL, idx);
+			text = templates_get_template_fileheader(GEANY_TEMPLATE_FILEHEADER_ROUTE, ext, idx);
 			break;
 		}
 		default:
 		{
-			text = templates_get_template_fileheader(GEANY_TEMPLATE_FILEHEADER, NULL, idx);
+			text = templates_get_template_fileheader(GEANY_TEMPLATE_FILEHEADER, ext, idx);
 		}
 	}
 

Modified: trunk/src/templates.c
===================================================================
--- trunk/src/templates.c	2006-05-22 13:43:56 UTC (rev 356)
+++ trunk/src/templates.c	2006-05-22 15:28:48 UTC (rev 357)
@@ -190,7 +190,7 @@
 	gchar *filename;
 	gchar *date = utils_get_date_time();
 
-	if (idx == -1)
+	if (idx == -1 || doc_list[idx].file_name == NULL)
 	{
 		if (extension != NULL)
 			filename = g_strconcat(GEANY_STRING_UNTITLED, ".", extension, NULL);


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