SF.net SVN: geany:[4294] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Sun Oct 11 10:51:12 UTC 2009
Revision: 4294
http://geany.svn.sourceforge.net/geany/?rev=4294&view=rev
Author: eht16
Date: 2009-10-11 10:51:12 +0000 (Sun, 11 Oct 2009)
Log Message:
-----------
Apply set default encoding for existing files only if the files are non-Unicode (patch by Alexey Antipov, thanks).
Modified Paths:
--------------
trunk/ChangeLog
trunk/THANKS
trunk/geany.glade
trunk/src/about.c
trunk/src/document.c
trunk/src/encodings.c
trunk/src/interface.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-10-04 21:18:36 UTC (rev 4293)
+++ trunk/ChangeLog 2009-10-11 10:51:12 UTC (rev 4294)
@@ -1,3 +1,11 @@
+2009-10-11 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
+
+ * geany.glade, THANKS, src/about.c, src/document.c, src/encodings.c,
+ src/interface.c:
+ Apply set default encoding for existing files only if the files are
+ non-Unicode (patch by Alexey Antipov, thanks).
+
+
2009-10-04 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/highlighting.c:
Modified: trunk/THANKS
===================================================================
--- trunk/THANKS 2009-10-04 21:18:36 UTC (rev 4293)
+++ trunk/THANKS 2009-10-11 10:51:12 UTC (rev 4294)
@@ -70,6 +70,7 @@
Forgeot Eric <eforgeot(at)yahoo(dot)fr> - Txt2Tags filetype patch
Lex Trotman <elextr<at>gmail<dot>com> - Build commands configuration improvements, and more
Ross McKay <rosko<at>zeta<dot>org<dot>au> - ASP preferred language option
+Alexey Antipov <1a_antipov(at)mail(dot)ru> - Apply file open encoding only to non-Unicode files
Translators:
------------
Modified: trunk/geany.glade
===================================================================
--- trunk/geany.glade 2009-10-04 21:18:36 UTC (rev 4293)
+++ trunk/geany.glade 2009-10-11 10:51:12 UTC (rev 4294)
@@ -7204,7 +7204,7 @@
<child>
<widget class="GtkLabel" id="label_open_encoding">
<property name="visible">True</property>
- <property name="label" translatable="yes">Default encoding (existing files):</property>
+ <property name="label" translatable="yes">Default encoding (existing non-Unicode files):</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -7232,7 +7232,7 @@
<child>
<widget class="GtkEventBox" id="eventbox3">
<property name="visible">True</property>
- <property name="tooltip" translatable="yes">Sets the default encoding for opening existing files</property>
+ <property name="tooltip" translatable="yes">Sets the default encoding for opening existing non-Unicode files</property>
<property name="visible_window">True</property>
<property name="above_child">False</property>
@@ -7257,9 +7257,9 @@
<child>
<widget class="GtkCheckButton" id="check_open_encoding">
<property name="visible">True</property>
- <property name="tooltip" translatable="yes">This option disables the automatic detection of the file encoding when opening files and opens the file with the specified encoding (usually not needed)</property>
+ <property name="tooltip" translatable="yes">This option disables the automatic detection of the file encoding when opening non-Unicode files and opens the file with the specified encoding (usually not needed)</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes">Use fixed encoding when opening files</property>
+ <property name="label" translatable="yes">Use fixed encoding when opening non-Unicode files</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
Modified: trunk/src/about.c
===================================================================
--- trunk/src/about.c 2009-10-04 21:18:36 UTC (rev 4293)
+++ trunk/src/about.c 2009-10-11 10:51:12 UTC (rev 4294)
@@ -80,7 +80,7 @@
static const gint prev_translators_len = G_N_ELEMENTS(prev_translators);
static const gchar *contributors =
-"Alexander Rodin, Andrew Rowland, Anh Phạm, blackdog, Bo Lorentsen, Bob Doan, Bronisław Białek, Catalin Marinas, "
+"Alexander Rodin, Alexey Antipov, Andrew Rowland, Anh Phạm, blackdog, Bo Lorentsen, Bob Doan, Bronisław Białek, Catalin Marinas, "
"Chris Macksey, Christoph Berg, Colomban Wendling, Conrad Steenberg, Daniel Richard G., Dave Moore, Dirk Weber, "
"Elias Pschernig, Eric Forgeot, Eugene Arshinov, Felipe Pena, François Cami, "
"Giuseppe Torelli, Guillaume de Rorthais, Guillaume Hoffmann, Herbert Voss, Jason Oster, Jean-François Wauthy, Jeff Pohlmeyer, "
Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c 2009-10-04 21:18:36 UTC (rev 4293)
+++ trunk/src/document.c 2009-10-11 10:51:12 UTC (rev 4294)
@@ -1242,10 +1242,6 @@
{ /* doc possibly changed */
display_filename = utils_str_middle_truncate(utf8_filename, 100);
- /* if default encoding for opening files is set, use it if no forced encoding is set */
- if (file_prefs.default_open_encoding >= 0 && forced_enc == NULL)
- forced_enc = encodings[file_prefs.default_open_encoding].charset;
-
if (! load_text_file(locale_filename, display_filename, &filedata, forced_enc))
{
g_free(display_filename);
Modified: trunk/src/encodings.c
===================================================================
--- trunk/src/encodings.c 2009-10-04 21:18:36 UTC (rev 4293)
+++ trunk/src/encodings.c 2009-10-11 10:51:12 UTC (rev 4294)
@@ -527,7 +527,7 @@
gchar *utf8_content;
gboolean check_regex = FALSE;
gboolean check_locale = FALSE;
- gint i, len;
+ gint i, len, preferred_charset;
if ((gint)size == -1)
{
@@ -547,22 +547,40 @@
/* current locale is not UTF-8, we have to check this charset */
check_locale = ! g_get_charset((const gchar**) &charset);
- for (i = 0; i < GEANY_ENCODINGS_MAX; i++)
+ /* First check for preferred charset, if specified */
+ preferred_charset = file_prefs.default_open_encoding;
+
+ if (preferred_charset == encodings[GEANY_ENCODING_NONE].idx || preferred_charset < 0 || preferred_charset >= GEANY_ENCODINGS_MAX)
+ preferred_charset = -1;
+
+ /* -1 means "Preferred charset" */
+ for (i = -1; i < GEANY_ENCODINGS_MAX; i++)
{
- if (G_UNLIKELY(i == encodings[GEANY_ENCODING_NONE].idx) || G_UNLIKELY(i == -1))
+ if (G_UNLIKELY(i == encodings[GEANY_ENCODING_NONE].idx) || G_UNLIKELY(i == -2))
continue;
- if (check_regex)
+ if (i == -1)
{
+ if (preferred_charset != -1)
+ {
+ charset = encodings[preferred_charset].charset;
+ geany_debug("Preferred charset: %s", charset);
+ i = -2;
+ }
+ else
+ continue;
+ }
+ else if (check_regex)
+ {
check_regex = FALSE;
charset = regex_charset;
- i = -1;
+ i = -2;
}
else if (check_locale)
{
check_locale = FALSE;
charset = locale_charset;
- i = -1;
+ i = -2;
}
else
charset = encodings[i].charset;
Modified: trunk/src/interface.c
===================================================================
--- trunk/src/interface.c 2009-10-04 21:18:36 UTC (rev 4293)
+++ trunk/src/interface.c 2009-10-11 10:51:12 UTC (rev 4294)
@@ -3985,7 +3985,7 @@
(GtkAttachOptions) (0), 0, 0);
gtk_misc_set_alignment (GTK_MISC (label153), 0, 0.5);
- label_open_encoding = gtk_label_new (_("Default encoding (existing files):"));
+ label_open_encoding = gtk_label_new (_("Default encoding (existing non-Unicode files):"));
gtk_widget_show (label_open_encoding);
gtk_table_attach (GTK_TABLE (table5), label_open_encoding, 0, 1, 2, 3,
(GtkAttachOptions) (GTK_FILL),
@@ -3997,18 +3997,18 @@
gtk_table_attach (GTK_TABLE (table5), eventbox3, 1, 2, 2, 3,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (GTK_FILL), 0, 0);
- gtk_tooltips_set_tip (tooltips, eventbox3, _("Sets the default encoding for opening existing files"), NULL);
+ gtk_tooltips_set_tip (tooltips, eventbox3, _("Sets the default encoding for opening existing non-Unicode files"), NULL);
combo_open_encoding = gtk_combo_box_new_text ();
gtk_widget_show (combo_open_encoding);
gtk_container_add (GTK_CONTAINER (eventbox3), combo_open_encoding);
- check_open_encoding = gtk_check_button_new_with_mnemonic (_("Use fixed encoding when opening files"));
+ check_open_encoding = gtk_check_button_new_with_mnemonic (_("Use fixed encoding when opening non-Unicode files"));
gtk_widget_show (check_open_encoding);
gtk_table_attach (GTK_TABLE (table5), check_open_encoding, 0, 2, 1, 2,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
- gtk_tooltips_set_tip (tooltips, check_open_encoding, _("This option disables the automatic detection of the file encoding when opening files and opens the file with the specified encoding (usually not needed)"), NULL);
+ gtk_tooltips_set_tip (tooltips, check_open_encoding, _("This option disables the automatic detection of the file encoding when opening non-Unicode files and opens the file with the specified encoding (usually not needed)"), NULL);
label219 = gtk_label_new (_("<b>Encodings</b>"));
gtk_widget_show (label219);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list