Use g_get_charset to retrieve the locale codeset.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4821 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Emanuele Giaquinta 2008-05-14 08:58:04 +00:00 committed by exg
commit b44bcd68cb
2 changed files with 8 additions and 21 deletions

View file

@ -24,9 +24,6 @@
#include "misc.h" #include "misc.h"
#include "levels.h" #include "levels.h"
#include "settings.h" #include "settings.h"
#ifdef HAVE_NL_LANGINFO
# include <langinfo.h>
#endif
#include "servers.h" #include "servers.h"
#include "channels.h" #include "channels.h"
@ -144,6 +141,8 @@ void fe_common_core_register_options(void)
void fe_common_core_init(void) void fe_common_core_init(void)
{ {
const char *str;
settings_add_bool("lookandfeel", "timestamps", TRUE); settings_add_bool("lookandfeel", "timestamps", TRUE);
settings_add_level("lookandfeel", "timestamp_level", "ALL"); settings_add_level("lookandfeel", "timestamp_level", "ALL");
settings_add_time("lookandfeel", "timestamp_timeout", "0"); settings_add_time("lookandfeel", "timestamp_timeout", "0");
@ -159,13 +158,8 @@ void fe_common_core_init(void)
settings_add_bool("lookandfeel", "use_status_window", TRUE); settings_add_bool("lookandfeel", "use_status_window", TRUE);
settings_add_bool("lookandfeel", "use_msgs_window", FALSE); settings_add_bool("lookandfeel", "use_msgs_window", FALSE);
#if defined (HAVE_NL_LANGINFO) && defined(CODESET) g_get_charset(&str);
settings_add_str("lookandfeel", "term_charset", settings_add_str("lookandfeel", "term_charset", str);
*nl_langinfo(CODESET) != '\0' ?
nl_langinfo(CODESET) : "ISO8859-1");
#else
settings_add_str("lookandfeel", "term_charset", "ISO8859-1");
#endif
themes_init(); themes_init();
theme_register(fecommon_core_formats); theme_register(fecommon_core_formats);

View file

@ -29,10 +29,6 @@
#include "formats.h" #include "formats.h"
#include "recode.h" #include "recode.h"
#ifdef HAVE_NL_LANGINFO
# include <langinfo.h>
#endif
static char *recode_fallback = NULL; static char *recode_fallback = NULL;
static char *recode_out_default = NULL; static char *recode_out_default = NULL;
static char *term_charset = NULL; static char *term_charset = NULL;
@ -172,14 +168,11 @@ static void read_settings(void)
g_free(term_charset); g_free(term_charset);
term_charset = g_strdup(settings_get_str("term_charset")); term_charset = g_strdup(settings_get_str("term_charset"));
if (!is_valid_charset(term_charset)) { if (!is_valid_charset(term_charset)) {
const char *str;
g_free(term_charset); g_free(term_charset);
#if defined (HAVE_NL_LANGINFO) && defined(CODESET) g_get_charset(&str);
term_charset = is_valid_charset(old_term_charset) ? g_strdup(old_term_charset) : term_charset = is_valid_charset(old_term_charset) ? g_strdup(old_term_charset) : g_strdup(str);
*nl_langinfo(CODESET) != '\0' ? g_strdup(nl_langinfo(CODESET)) :
"ISO8859-1";
#else
term_charset = is_valid_charset(old_term_charset) ? g_strdup(old_term_charset) : "ISO8859-1";
#endif
settings_set_str("term_charset", term_charset); settings_set_str("term_charset", term_charset);
/* FIXME: move the check of term_charset into fe-text/term.c /* FIXME: move the check of term_charset into fe-text/term.c
it breaks the proper term_input_type it breaks the proper term_input_type