diff src/gtk/misc-gtk.c @ 291:265244924868

2003-10-19 Brian Masney <masneyb@gftp.org> * lib/protocols.c lib/gftp.h - added gftp_string_from_utf8(). Also, make gftp_string_{to,from}_utf8() be defined all the time. When using glib 1.2, the functions will always return NULL. * lib/protocols.c - when creating a directory or renaming files, make sure the new name is converted from UTF8 to the local character set or the charset specified in the remote_charsets option. * src/gtk/misc-gtk.c (update_window_info) - when showing the directory we are currently in, make sure it is converted to UTF8
author masneyb
date Sun, 19 Oct 2003 12:28:26 +0000
parents 2ad324cf4930
children 3b9d5797050f
line wrap: on
line diff
--- a/src/gtk/misc-gtk.c	Sat Oct 18 15:21:39 2003 +0000
+++ b/src/gtk/misc-gtk.c	Sun Oct 19 12:28:26 2003 +0000
@@ -50,10 +50,10 @@
   gftp_color * color;
   GdkColor fore;
 #else
-  char *utf8_str;
   GtkTextBuffer * textbuf;
   GtkTextIter iter, iter2;
   const char *descr;
+  char *utf8_str;
 #endif
 
   va_start (argp, string);
@@ -70,17 +70,14 @@
   va_end (argp);
 
 #if GTK_MAJOR_VERSION > 1
-  if (!g_utf8_validate (logstr, -1, NULL))
+  if ((utf8_str = gftp_string_to_utf8 (request, logstr)) != NULL)
     {
-      if ((utf8_str = gftp_string_to_utf8 (request, logstr)) != NULL)
-        {
-          if (free_logstr)
-            g_free (logstr);
-          else
-            free_logstr = 1;
+      if (free_logstr)
+        g_free (logstr);
+      else
+        free_logstr = 1;
 
-          logstr = utf8_str;
-        }
+      logstr = utf8_str;
     }
 #endif
 
@@ -294,7 +291,7 @@
 void
 update_window (gftp_window_data * wdata)
 {
-  char *dir, *tempstr, *temp1str, *fspec;
+  char *dir, *tempstr, *temp1str, *fspec, *utf8_directory;
   int connected, start;
 
   connected = GFTP_IS_CONNECTED (wdata->request);
@@ -312,12 +309,23 @@
       gtk_label_set (GTK_LABEL (wdata->hoststxt), tempstr);
       g_free (tempstr);
 
+      utf8_directory = NULL;
       if ((dir = wdata->request->directory) == NULL)
         temp1str = "";
       else
-        temp1str = dir;
+        {
+          utf8_directory = gftp_string_to_utf8 (wdata->request, 
+                                                wdata->request->directory);
+          if (utf8_directory != NULL)
+            temp1str = utf8_directory;
+          else
+            temp1str = dir;
+        }
 
       gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (wdata->combo)->entry),temp1str);
+
+      if (utf8_directory != NULL)
+        g_free (utf8_directory);
     }
   else if (wdata->hoststxt != NULL)
     {