Initial version of language selector GUI
This commit is contained in:
parent
4732505e30
commit
5acd848f79
|
@ -451,6 +451,9 @@ const struct prefs vars[] = {
|
||||||
{"gui_input_style", P_OFFINT (style_inputbox), TYPE_BOOL},
|
{"gui_input_style", P_OFFINT (style_inputbox), TYPE_BOOL},
|
||||||
{"gui_join_dialog", P_OFFINT (gui_join_dialog), TYPE_BOOL},
|
{"gui_join_dialog", P_OFFINT (gui_join_dialog), TYPE_BOOL},
|
||||||
{"gui_lagometer", P_OFFINT (lagometer), TYPE_INT},
|
{"gui_lagometer", P_OFFINT (lagometer), TYPE_INT},
|
||||||
|
#ifdef WIN32
|
||||||
|
{"gui_lang", P_OFFSET (gui_lang), TYPE_STR},
|
||||||
|
#endif
|
||||||
{"gui_mode_buttons", P_OFFINT (chanmodebuttons), TYPE_BOOL},
|
{"gui_mode_buttons", P_OFFINT (chanmodebuttons), TYPE_BOOL},
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
{"gui_one_instance", P_OFFINT (gui_one_instance), TYPE_BOOL},
|
{"gui_one_instance", P_OFFINT (gui_one_instance), TYPE_BOOL},
|
||||||
|
@ -746,6 +749,7 @@ load_config (void)
|
||||||
prefs.timestamp = 1;
|
prefs.timestamp = 1;
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
prefs.identd = 1;
|
prefs.identd = 1;
|
||||||
|
strcpy (prefs.gui_lang, g_getenv ("LC_ALL") ? g_getenv ("LC_ALL") : "en_US");
|
||||||
#endif
|
#endif
|
||||||
strcpy (prefs.spell_langs, g_getenv ("LC_ALL") ? g_getenv ("LC_ALL") : "en_US");
|
strcpy (prefs.spell_langs, g_getenv ("LC_ALL") ? g_getenv ("LC_ALL") : "en_US");
|
||||||
strcpy (prefs.stamp_format, "[%H:%M:%S] ");
|
strcpy (prefs.stamp_format, "[%H:%M:%S] ");
|
||||||
|
|
|
@ -951,6 +951,7 @@ main (int argc, char *argv[])
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
char hexchat_lang[13]; /* LC_ALL= plus 5 chars of gui_lang and trailing \0 */
|
||||||
HANDLE mutex;
|
HANDLE mutex;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -971,6 +972,10 @@ main (int argc, char *argv[])
|
||||||
load_config ();
|
load_config ();
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
/* we MUST do this after load_config () otherwise it would fail */
|
||||||
|
snprintf (hexchat_lang, 12, "LC_ALL=%s", prefs.gui_lang);
|
||||||
|
putenv (hexchat_lang);
|
||||||
|
|
||||||
if (prefs.gui_one_instance && !portable_mode ())
|
if (prefs.gui_one_instance && !portable_mode ())
|
||||||
{
|
{
|
||||||
DWORD error;
|
DWORD error;
|
||||||
|
|
|
@ -117,6 +117,7 @@ struct xchatprefs
|
||||||
char font_normal[4 * FONTNAMELEN + 1];
|
char font_normal[4 * FONTNAMELEN + 1];
|
||||||
char font_main[FONTNAMELEN + 1];
|
char font_main[FONTNAMELEN + 1];
|
||||||
char font_alternative[3 * FONTNAMELEN + 1];
|
char font_alternative[3 * FONTNAMELEN + 1];
|
||||||
|
char gui_lang[6]; /* Just enough for xx_YY plus trailing \0 */
|
||||||
#else
|
#else
|
||||||
char font_normal[FONTNAMELEN + 1];
|
char font_normal[FONTNAMELEN + 1];
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -100,9 +100,13 @@ typedef struct
|
||||||
} setting;
|
} setting;
|
||||||
|
|
||||||
|
|
||||||
static const setting textbox_settings[] =
|
static const setting appearance_settings[] =
|
||||||
{
|
{
|
||||||
{ST_HEADER, N_("Text Box Appearance"),0,0,0},
|
#ifdef WIN32
|
||||||
|
{ST_HEADER, N_("Localization"),0,0,0},
|
||||||
|
{ST_ENTRY, N_("HexChat language:"), P_OFFSETNL(gui_lang), 0, 0, sizeof prefs.gui_lang},
|
||||||
|
#endif
|
||||||
|
{ST_HEADER, N_("Text Box"),0,0,0},
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
{ST_EFONT, N_("Main font:"), P_OFFSETNL(font_main), 0, 0, sizeof prefs.font_main},
|
{ST_EFONT, N_("Main font:"), P_OFFSETNL(font_main), 0, 0, sizeof prefs.font_main},
|
||||||
#else
|
#else
|
||||||
|
@ -1820,7 +1824,7 @@ setup_add_page (const char *title, GtkWidget *book, GtkWidget *tab)
|
||||||
static const char *const cata[] =
|
static const char *const cata[] =
|
||||||
{
|
{
|
||||||
N_("Interface"),
|
N_("Interface"),
|
||||||
N_("Text box"),
|
N_("Appearance"),
|
||||||
N_("Input box"),
|
N_("Input box"),
|
||||||
N_("User list"),
|
N_("User list"),
|
||||||
N_("Channel switcher"),
|
N_("Channel switcher"),
|
||||||
|
@ -1847,7 +1851,7 @@ setup_create_pages (GtkWidget *box)
|
||||||
|
|
||||||
book = gtk_notebook_new ();
|
book = gtk_notebook_new ();
|
||||||
|
|
||||||
setup_add_page (cata[1], book, setup_create_page (textbox_settings));
|
setup_add_page (cata[1], book, setup_create_page (appearance_settings));
|
||||||
setup_add_page (cata[2], book, setup_create_page (inputbox_settings));
|
setup_add_page (cata[2], book, setup_create_page (inputbox_settings));
|
||||||
setup_add_page (cata[3], book, setup_create_page (userlist_settings));
|
setup_add_page (cata[3], book, setup_create_page (userlist_settings));
|
||||||
setup_add_page (cata[4], book, setup_create_page (tabs_settings));
|
setup_add_page (cata[4], book, setup_create_page (tabs_settings));
|
||||||
|
@ -2130,6 +2134,10 @@ setup_apply (struct xchatprefs *pr)
|
||||||
|
|
||||||
#define DIFF(a) (pr->a != prefs.a)
|
#define DIFF(a) (pr->a != prefs.a)
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
if (DIFF (gui_lang))
|
||||||
|
noapply = TRUE;
|
||||||
|
#endif
|
||||||
if (DIFF (paned_userlist))
|
if (DIFF (paned_userlist))
|
||||||
noapply = TRUE;
|
noapply = TRUE;
|
||||||
if (DIFF (lagometer))
|
if (DIFF (lagometer))
|
||||||
|
|
Loading…
Reference in New Issue