From aa4e9831c4367dcd43ada97d1aff0d4e94d0d3fd Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Tue, 9 Jun 2009 14:39:28 +0000 Subject: [PATCH] Add filetypes.common Configuration Files menu item. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3848 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 6 ++++++ src/filetypes.c | 6 ++++++ src/ui_utils.c | 8 ++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index f44eb676..59362f1a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-06-09 Nick Treleaven + + * src/filetypes.c, src/ui_utils.c: + Add filetypes.common Configuration Files menu item. + + 2009-06-08 Enrico Tröger * src/callbacks.c: diff --git a/src/filetypes.c b/src/filetypes.c index 33e69949..f03b2962 100644 --- a/src/filetypes.c +++ b/src/filetypes.c @@ -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); } diff --git a/src/ui_utils.c b/src/ui_utils.c index 989fc9f2..06162601 100644 --- a/src/ui_utils.c +++ b/src/ui_utils.c @@ -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); } }