Revision: 626 Author: eht16 Date: 2006-07-25 02:12:51 -0700 (Tue, 25 Jul 2006) ViewCVS: http://svn.sourceforge.net/geany/?rev=626&view=rev
Log Message: ----------- Save default encoding for new files as charset string.
Modified Paths: -------------- trunk/ChangeLog trunk/src/document.c trunk/src/encodings.c trunk/src/keyfile.c trunk/src/main.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2006-07-25 08:27:12 UTC (rev 625) +++ trunk/ChangeLog 2006-07-25 09:12:51 UTC (rev 626) @@ -1,3 +1,9 @@ +2006-07-25 Enrico Tröger enrico.troeger@uvena.de + + * src/encodings.c, src/document.c, src/keyfile.c, src/main.c: + Save default encoding for new files as charset string. + + 2006-07-24 Enrico Tröger enrico.troeger@uvena.de
* src/geany.h, tagmanager/strlist.c, tagmanager/tm_project.c, @@ -4,7 +10,9 @@ tagmanager/parse.c, tagmanager/general.h, tagmanager/ctags.c, tagmanager/tm_workspace.c: Fixed some cross compiling/Win32 issues. * geany.glade, src/callbacks.c, src/document.c, src/interface.c, - src/main.c: Added menu item to the document menu to add/remove BOM. + src/main.c: + Added menu item to the document menu to add/remove BOM. + Replaced switch_notebook_page by ignore_callback flag. * src/win32.c, src/dialogs.c: Convert Unicode strings to wide characters to avoid weird display. * src/document.c: Set CR/LF as EOL mode on new files on Windows.
Modified: trunk/src/document.c =================================================================== --- trunk/src/document.c 2006-07-25 08:27:12 UTC (rev 625) +++ trunk/src/document.c 2006-07-25 09:12:51 UTC (rev 626) @@ -356,8 +356,7 @@ sci_set_text(doc_list[idx].sci, template); g_free(template);
- doc_list[idx].encoding = g_strdup( - encodings_get_charset(&encodings[app->pref_editor_default_encoding])); + doc_list[idx].encoding = g_strdup(encodings[app->pref_editor_default_encoding].charset); document_set_filetype(idx, ft); utils_set_window_title(idx); utils_build_show_hide(idx);
Modified: trunk/src/encodings.c =================================================================== --- trunk/src/encodings.c 2006-07-25 08:27:12 UTC (rev 625) +++ trunk/src/encodings.c 2006-07-25 09:12:51 UTC (rev 626) @@ -121,6 +121,8 @@ { gint i;
+ if (charset == NULL) return &encodings[GEANY_ENCODING_UTF_8]; + i = 0; while (i < GEANY_ENCODINGS_MAX) {
Modified: trunk/src/keyfile.c =================================================================== --- trunk/src/keyfile.c 2006-07-25 08:27:12 UTC (rev 625) +++ trunk/src/keyfile.c 2006-07-25 09:12:51 UTC (rev 626) @@ -30,6 +30,7 @@ #include "utils.h" #include "document.h" #include "sciwrappers.h" +#include "encodings.h"
static gchar *scribble_text = NULL; @@ -118,7 +119,6 @@ g_key_file_set_integer_list(config, PACKAGE, "geometry", app->geometry, 4); } g_key_file_set_integer(config, PACKAGE, "pref_editor_tab_width", app->pref_editor_tab_width); - g_key_file_set_integer(config, PACKAGE, "pref_editor_default_encoding", app->pref_editor_default_encoding); g_key_file_set_boolean(config, PACKAGE, "pref_main_confirm_exit", app->pref_main_confirm_exit); g_key_file_set_boolean(config, PACKAGE, "pref_main_load_session", app->pref_main_load_session); g_key_file_set_boolean(config, PACKAGE, "pref_main_save_winpos", app->pref_main_save_winpos); @@ -135,6 +135,7 @@ g_key_file_set_boolean(config, PACKAGE, "pref_editor_new_line", app->pref_editor_new_line); g_key_file_set_boolean(config, PACKAGE, "pref_editor_replace_tabs", app->pref_editor_replace_tabs); g_key_file_set_boolean(config, PACKAGE, "pref_editor_trail_space", app->pref_editor_trail_space); + g_key_file_set_string(config, PACKAGE, "pref_editor_default_encoding", encodings[app->pref_editor_default_encoding].charset); g_key_file_set_string(config, PACKAGE, "pref_template_developer", app->pref_template_developer); g_key_file_set_string(config, PACKAGE, "pref_template_company", app->pref_template_company); g_key_file_set_string(config, PACKAGE, "pref_template_mail", app->pref_template_mail); @@ -288,8 +289,18 @@
app->pref_editor_tab_width = utils_get_setting_integer(config, PACKAGE, "pref_editor_tab_width", 4); - // set default encoding to UTF8 (Unicode) - index 16 - app->pref_editor_default_encoding = utils_get_setting_integer(config, PACKAGE, "pref_editor_default_encoding", 16); + tmp_string = utils_get_setting_string(config, PACKAGE, "pref_editor_default_encoding", + encodings[GEANY_ENCODING_UTF_8].charset); + if (tmp_string) + { + const GeanyEncoding *enc = encodings_get_from_charset(tmp_string); + if (enc != NULL) + app->pref_editor_default_encoding = enc->idx; + else + app->pref_editor_default_encoding = GEANY_ENCODING_UTF_8; + + g_free(tmp_string); + } app->pref_main_confirm_exit = utils_get_setting_boolean(config, PACKAGE, "pref_main_confirm_exit", TRUE); app->pref_main_load_session = utils_get_setting_boolean(config, PACKAGE, "pref_main_load_session", TRUE); app->pref_main_save_winpos = utils_get_setting_boolean(config, PACKAGE, "pref_main_save_winpos", TRUE);
Modified: trunk/src/main.c =================================================================== --- trunk/src/main.c 2006-07-25 08:27:12 UTC (rev 625) +++ trunk/src/main.c 2006-07-25 09:12:51 UTC (rev 626) @@ -508,11 +508,11 @@ main_init(); gtk_widget_set_size_request(app->window, GEANY_WINDOW_MINIMAL_WIDTH, GEANY_WINDOW_MINIMAL_HEIGHT); gtk_window_set_default_size(GTK_WINDOW(app->window), GEANY_WINDOW_DEFAULT_WIDTH, GEANY_WINDOW_DEFAULT_HEIGHT); + encodings_init(); configuration_load(); keybindings_init(); notebook_init(); templates_init(); - encodings_init(); document_init_doclist(); // do this here to let cmdline options overwrite configuration settings #ifdef HAVE_VTE
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.