Revision: 4803 http://geany.svn.sourceforge.net/geany/?rev=4803&view=rev Author: ntrel Date: 2010-04-06 16:37:27 +0000 (Tue, 06 Apr 2010)
Log Message: ----------- Re-detect any document filetypes set to None after reloading filetype extensions (closes #2979661).
Modified Paths: -------------- trunk/ChangeLog trunk/src/filetypes.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2010-04-05 22:03:49 UTC (rev 4802) +++ trunk/ChangeLog 2010-04-06 16:37:27 UTC (rev 4803) @@ -1,3 +1,10 @@ +2010-04-06 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> + + * src/filetypes.c: + Re-detect any document filetypes set to None after reloading + filetype extensions (closes #2979661). + + 2010-04-05 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* data/filetypes.perl:
Modified: trunk/src/filetypes.c =================================================================== --- trunk/src/filetypes.c 2010-04-05 22:03:49 UTC (rev 4802) +++ trunk/src/filetypes.c 2010-04-06 16:37:27 UTC (rev 4803) @@ -1579,7 +1579,6 @@ "filetype_extensions.conf", NULL); gchar *userconfigfile = g_strconcat(app->configdir, G_DIR_SEPARATOR_S, "filetype_extensions.conf", NULL); - gchar **list; GKeyFile *sysconfig = g_key_file_new(); GKeyFile *userconfig = g_key_file_new();
@@ -1591,20 +1590,30 @@ { gboolean userset = g_key_file_has_key(userconfig, "Extensions", filetypes[i]->name, NULL); - list = g_key_file_get_string_list( + gchar **list = g_key_file_get_string_list( (userset) ? userconfig : sysconfig, "Extensions", filetypes[i]->name, &len, NULL); + if (G_LIKELY(list) && G_LIKELY(len > 0)) { g_strfreev(filetypes[i]->pattern); filetypes[i]->pattern = list; } - else g_strfreev(list); + else + g_strfreev(list); }
g_free(sysconfigfile); g_free(userconfigfile); g_key_file_free(sysconfig); g_key_file_free(userconfig); + + foreach_document(i) + { + GeanyDocument *doc = documents[i]; + if (doc->file_type->id != GEANY_FILETYPES_NONE) + continue; + document_set_filetype(doc, filetypes_detect_from_document(doc)); + } }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.