SF.net SVN: geany:[3957] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Mon Jul 13 12:38:32 UTC 2009


Revision: 3957
          http://geany.svn.sourceforge.net/geany/?rev=3957&view=rev
Author:   ntrel
Date:     2009-07-13 12:38:32 +0000 (Mon, 13 Jul 2009)

Log Message:
-----------
Reload filetypes.common after saving it.

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-07-13 12:25:35 UTC (rev 3956)
+++ trunk/ChangeLog	2009-07-13 12:38:32 UTC (rev 3957)
@@ -4,6 +4,8 @@
    src/document.h, src/main.c, THANKS:
    Apply patch from Eugene Arshinov to reload color schemes via menu
    (thanks).
+ * src/filetypes.c:
+   Reload filetypes.common after saving it.
 
 
 2009-07-10  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/src/filetypes.c
===================================================================
--- trunk/src/filetypes.c	2009-07-13 12:25:35 UTC (rev 3956)
+++ trunk/src/filetypes.c	2009-07-13 12:38:32 UTC (rev 3957)
@@ -648,6 +648,15 @@
 }
 
 
+/* Iterates all valid documents.
+ * Use like a @c for statement.
+ * @param i @c guint index for document_index(). */
+#define documents_foreach(i) \
+	for (i = 0; i < documents_array->len; i++)\
+		if (!document_index(i)->is_valid)\
+			{}\
+		else /* prevent outside 'else' matching our macro 'if' */
+
 static void on_document_save(G_GNUC_UNUSED GObject *object, GeanyDocument *doc)
 {
 	g_return_if_fail(NZV(doc->real_path));
@@ -657,8 +666,16 @@
 		filetypes_read_extensions();
 	else if (utils_str_equal(doc->real_path,
 		utils_build_path(app->configdir, GEANY_FILEDEFS_SUBDIR, "filetypes.common", NULL)))
-		ui_set_statusbar(FALSE, "%s",
-			_("For all changes you make in this file to take effect, you need to restart Geany."));
+	{
+		guint i;
+
+		/* Note: we don't reload other filetypes, even though the named styles may have changed.
+		 * The user can do this manually with 'Tools->Reload Configuration' */
+		filetypes_load_config(GEANY_FILETYPES_NONE, TRUE);
+
+		documents_foreach(i)
+			document_reload_config(documents[i]);
+	}
 }
 
 


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