diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2003-10-29 06:51:54 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2003-10-29 06:51:54 +0800 |
commit | 55e15cb762ccb0fa32fbab23a6afb59e9770e036 (patch) | |
tree | 32de71de476bccc29c13f2ed3c8170b130bd8c28 /src/prefs-dialog.c | |
parent | 4998a603941458209b5b6b2a69ba46335f2dbc27 (diff) | |
download | gsoc2013-epiphany-55e15cb762ccb0fa32fbab23a6afb59e9770e036.tar gsoc2013-epiphany-55e15cb762ccb0fa32fbab23a6afb59e9770e036.tar.gz gsoc2013-epiphany-55e15cb762ccb0fa32fbab23a6afb59e9770e036.tar.bz2 gsoc2013-epiphany-55e15cb762ccb0fa32fbab23a6afb59e9770e036.tar.lz gsoc2013-epiphany-55e15cb762ccb0fa32fbab23a6afb59e9770e036.tar.xz gsoc2013-epiphany-55e15cb762ccb0fa32fbab23a6afb59e9770e036.tar.zst gsoc2013-epiphany-55e15cb762ccb0fa32fbab23a6afb59e9770e036.zip |
Always list "Off" as first item in the list of autodetectors. Fixes bug
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.
Diffstat (limited to 'src/prefs-dialog.c')
-rw-r--r-- | src/prefs-dialog.c | 31 |
1 files changed, 29 insertions, 2 deletions
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); |