Add filetypes.common Configuration Files menu item.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3848 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2009-06-09 14:39:28 +00:00
parent 583c4bdd09
commit aa4e9831c4
3 changed files with 18 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2009-06-09 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/filetypes.c, src/ui_utils.c:
Add filetypes.common Configuration Files menu item.
2009-06-08 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/callbacks.c:

View File

@ -655,6 +655,10 @@ static void on_document_save(G_GNUC_UNUSED GObject *object, GeanyDocument *doc)
if (utils_str_equal(doc->real_path,
utils_build_path(app->configdir, "filetype_extensions.conf", NULL)))
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."));
}
@ -662,6 +666,8 @@ static void setup_config_file_menus(void)
{
ui_add_config_file_menu_item(
utils_build_path(app->configdir, "filetype_extensions.conf", NULL), NULL, NULL);
ui_add_config_file_menu_item(
utils_build_path(app->configdir, GEANY_FILEDEFS_SUBDIR, "filetypes.common", NULL), NULL, NULL);
g_signal_connect(geany_object, "document-save", G_CALLBACK(on_document_save), NULL);
}

View File

@ -1700,9 +1700,13 @@ void ui_table_add_row(GtkTable *table, gint row, ...)
static void on_config_file_clicked(GtkWidget *widget, gpointer user_data)
{
const gchar *file_name = user_data;
GeanyFiletype *ft = NULL;
if (strstr(file_name, G_DIR_SEPARATOR_S "filetypes."))
ft = filetypes[GEANY_FILETYPES_CONF];
if (g_file_test(file_name, G_FILE_TEST_EXISTS))
document_open_file(file_name, FALSE, NULL, NULL);
document_open_file(file_name, FALSE, ft, NULL);
else
{
gchar *utf8 = utils_get_utf8_from_locale(file_name);
@ -1715,7 +1719,7 @@ static void on_config_file_clicked(GtkWidget *widget, gpointer user_data)
if (g_file_test(global_file, G_FILE_TEST_EXISTS))
g_file_get_contents(global_file, &global_content, NULL, NULL);
document_new_file(utf8, NULL, global_content);
document_new_file(utf8, ft, global_content);
utils_free_pointers(4, utf8, base_name, global_file, global_content, NULL);
}
}