static void on_document_save(G_GNUC_UNUSED GObject *object, GeanyDocument *doc) { gchar *f; g_return_if_fail(!EMPTY(doc->real_path)); f = g_build_filename(app->configdir, "filetype_extensions.conf", NULL); if (utils_str_equal(doc->real_path, f)) filetypes_reload_extensions(); g_free(f); f = g_build_filename(app->configdir, GEANY_FILEDEFS_SUBDIR, "filetypes.common", NULL); if (utils_str_equal(doc->real_path, f)) { 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); foreach_document(i) document_reload_config(documents[i]); } g_free(f); }
static void on_document_save(G_GNUC_UNUSED GObject *object, GeanyDocument *doc) { gchar *f, *basename; g_return_if_fail(!EMPTY(doc->real_path)); f = g_build_filename(app->configdir, "filetype_extensions.conf", NULL); if (utils_str_equal(doc->real_path, f)) filetypes_reload_extensions(); g_free(f); basename = g_path_get_basename(doc->real_path); if (g_str_has_prefix(basename, "filetypes.")) { guint i; for (i = 0; i < filetypes_array->len; i++) { GeanyFiletype *ft = filetypes[i]; f = filetypes_get_filename(ft, TRUE); if (utils_str_equal(doc->real_path, f)) { guint j; /* 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(i, TRUE); foreach_document(j) document_reload_config(documents[j]); g_free(f); break; } g_free(f); } } g_free(basename); }