aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--src/prefs-dialog.c31
2 files changed, 37 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index cf4f0f5f9..51b47eee5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2003-10-28 Christian Persch <chpe@cvs.gnome.org>
+
+ * src/prefs-dialog.c: (sort_detectors), (create_optionmenu),
+ (prefs_dialog_init):
+
+ Always list "Off" as first item in the list of autodetectors.
+ Fixes bug #125723.
+
2003-10-28 Marco Pesenti Gritti <marco@gnome.org>
* src/bookmarks/ephy-bookmarks-editor.c: (cmd_bookmarks_import):
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index 0b297374f..ddcc91567 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -721,6 +721,33 @@ sort_encodings (gconstpointer a, gconstpointer b)
return strcmp (key1, key2);
}
+static int
+sort_detectors (gconstpointer a, gconstpointer b)
+{
+ EphyNode *node1 = (EphyNode *) a;
+ EphyNode *node2 = (EphyNode *) b;
+ const char *code1, *code2;
+
+ code1 = ephy_node_get_property_string
+ (node1, EPHY_NODE_ENCODING_PROP_ENCODING);
+ code2 = ephy_node_get_property_string
+ (node2, EPHY_NODE_ENCODING_PROP_ENCODING);
+
+ /* "" is the code for No Autodetector; make sure it's first
+ * in the list.
+ */
+ if (strcmp (code1, "") == 0)
+ {
+ return -1;
+ }
+ if (strcmp (code2, "") == 0)
+ {
+ return 1;
+ }
+
+ return sort_encodings (a, b);
+}
+
static void
create_optionmenu (PrefsDialog *dialog,
int property,
@@ -739,8 +766,6 @@ create_optionmenu (PrefsDialog *dialog,
optionmenu = ephy_dialog_get_control (EPHY_DIALOG (dialog),
property);
- list = g_list_sort (list, (GCompareFunc) sort_encodings);
-
num = g_list_length (list);
codes = g_new0 (char *, num);
@@ -1006,11 +1031,13 @@ prefs_dialog_init (PrefsDialog *pd)
(EPHY_EMBED_SHELL (ephy_shell)));
list = ephy_encodings_get_encodings (encodings, LG_ALL);
+ list = g_list_sort (list, (GCompareFunc) sort_encodings);
create_optionmenu (pd, DEFAULT_ENCODING_PROP, list,
CONF_LANGUAGE_DEFAULT_ENCODING, "ISO-8859-1");
g_list_free (list);
list = ephy_encodings_get_detectors (encodings);
+ list = g_list_sort (list, (GCompareFunc) sort_detectors);
create_optionmenu (pd, AUTO_ENCODING_PROP, list,
CONF_LANGUAGE_AUTODETECT_ENCODING, "");
g_list_free (list);