Mercurial > gftp.yaz
changeset 675:84d38c525f46
2005-1-24 Brian Masney <masneyb@gftp.org>
* src/text/gftp-text.c (gftp_text_ask_question, gftp_text_write_string)
- convert the string from UTF8 to the users' current locale before it is
displayed
* src/text/gftp-text.c src/text/gftp-text.h - fixed signed/unsigned
mismatch when calculating the window size
* src/gtk/transfer.c (update_file_status) - expanded the maximum length
of the dlstr variable
author | masneyb |
---|---|
date | Tue, 25 Jan 2005 01:11:00 +0000 |
parents | cecd264e1e40 |
children | 72a6de68d9c8 |
files | ChangeLog src/gtk/transfer.c src/text/gftp-text.c src/text/gftp-text.h |
diffstat | 4 files changed, 40 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon Jan 24 00:56:58 2005 +0000 +++ b/ChangeLog Tue Jan 25 01:11:00 2005 +0000 @@ -1,3 +1,14 @@ +2005-1-24 Brian Masney <masneyb@gftp.org> + * src/text/gftp-text.c (gftp_text_ask_question, gftp_text_write_string) + - convert the string from UTF8 to the users' current locale before it is + displayed + + * src/text/gftp-text.c src/text/gftp-text.h - fixed signed/unsigned + mismatch when calculating the window size + + * src/gtk/transfer.c (update_file_status) - expanded the maximum length + of the dlstr variable + 2005-1-23 Brian Masney <masneyb@gftp.org> * po/POTFILES.in - added lib/fsp.c @@ -3236,7 +3247,7 @@ * cvsclean - added this script - * *.[ch] - added $Id: ChangeLog,v 1.396 2005/01/23 14:12:02 masneyb Exp $ tags + * *.[ch] - added $Id: ChangeLog,v 1.397 2005/01/25 01:10:59 masneyb Exp $ tags * debian/* - updated files from Debian maintainer
--- a/src/gtk/transfer.c Mon Jan 24 00:56:58 2005 +0000 +++ b/src/gtk/transfer.c Tue Jan 25 01:11:00 2005 +0000 @@ -686,7 +686,7 @@ static void update_file_status (gftp_transfer * tdata) { - char totstr[150], dlstr[100], winstr[150], gotstr[50], ofstr[50]; + char totstr[150], dlstr[150], winstr[150], gotstr[50], ofstr[50]; unsigned long remaining_secs, lkbs; int hours, mins, secs, pcent, st; intptr_t show_trans_in_title;
--- a/src/text/gftp-text.c Mon Jan 24 00:56:58 2005 +0000 +++ b/src/text/gftp-text.c Tue Jan 25 01:11:00 2005 +0000 @@ -20,11 +20,11 @@ #include "gftp-text.h" static const char cvsid[] = "$Id$"; -int +unsigned int gftp_text_get_win_size (void) { struct winsize size; - int ret; + unsigned int ret; if (ioctl (0, TIOCGWINSZ, (char *) &size) < 0) ret = 80; @@ -36,14 +36,19 @@ static void -gftp_text_write_string (char *string) +gftp_text_write_string (gftp_request * request, char *string) { - char *stpos, *endpos, savechar; - int sw; + gchar *stpos, *endpos, *locale_str, savechar; + unsigned int sw; sw = gftp_text_get_win_size (); - stpos = string; + locale_str = gftp_string_from_utf8 (request, string); + if (locale_str == NULL) + stpos = string; + else + stpos = locale_str; + do { if ((endpos = strchr (stpos, '\n')) == NULL) @@ -77,6 +82,9 @@ sw = sw; } while (stpos != endpos); + + if (locale_str != NULL) + g_free (locale_str); } @@ -134,7 +142,7 @@ if (level == gftp_logging_misc_nolog) printf ("%s", outstr); else - gftp_text_write_string (outstr); + gftp_text_write_string (request, outstr); printf ("%s", GFTPUI_COMMON_COLOR_DEFAULT); @@ -147,6 +155,7 @@ gftp_text_ask_question (const char *question, int echo, char *buf, size_t size) { struct termios term, oldterm; + gchar *locale_question; sigset_t sig, sigsave; char *pos, *termname; int singlechar; @@ -176,7 +185,16 @@ else infd = stdin; - printf ("%s%s%s ", GFTPUI_COMMON_COLOR_BLUE, question, GFTPUI_COMMON_COLOR_DEFAULT); + locale_question = g_locale_from_utf8 (question, -1, NULL, NULL, NULL); + if (locale_question != NULL) + { + printf ("%s%s%s ", GFTPUI_COMMON_COLOR_BLUE, locale_question, + GFTPUI_COMMON_COLOR_DEFAULT); + g_free (locale_question); + } + else + printf ("%s%s%s ", GFTPUI_COMMON_COLOR_BLUE, question, + GFTPUI_COMMON_COLOR_DEFAULT); if (size == 1) {
--- a/src/text/gftp-text.h Mon Jan 24 00:56:58 2005 +0000 +++ b/src/text/gftp-text.h Tue Jan 25 01:11:00 2005 +0000 @@ -30,7 +30,7 @@ #include <readline/history.h> #endif -int gftp_text_get_win_size ( void ); +unsigned int gftp_text_get_win_size ( void ); char * gftp_text_ask_question ( const char *question, int echo,