Use g_filename_display_basename() rather than get_basename() when we're
authorGuy Harris <guy@alum.mit.edu>
Sun, 3 Jun 2012 19:31:59 +0000 (19:31 -0000)
committerGuy Harris <guy@alum.mit.edu>
Sun, 3 Jun 2012 19:31:59 +0000 (19:31 -0000)
getting the basename for display purposes, so it's converted from the
GLib/GTK+ locale filename encoding to UTF-8.  (For Windows, the locale
filename encoding is UTF-8, and the internal encoding is UTF-16, so the
file names should *probably* all be valid UTF-8 - Windows may not
support invalid UTF-16 in file names.  For Qt, I'm not sure whether the
file dialogs ever return file names in some non-UTF-8 encoding.)

svn path=/trunk/; revision=43044

file.c
ui/gtk/capture_file_dlg.c
ui/gtk/main_statusbar.c

diff --git a/file.c b/file.c
index 4b0c5a114fb80aa50696657af002eb23e5ebc553..ddc441879dd815d017f768fc3b604eb8c71643df 100644 (file)
--- a/file.c
+++ b/file.c
@@ -523,7 +523,7 @@ cf_read(capture_file *cf, gboolean reloading)
 
   reset_tap_listeners();
 
-  name_ptr = get_basename(cf->filename);
+  name_ptr = g_filename_display_basename(cf->filename);
 
   if (reloading)
     cf_callback_invoke(cf_cb_file_reload_started, cf);
@@ -978,7 +978,7 @@ cf_get_display_name(capture_file *cf)
   if (!cf->is_tempfile) {
     /* Get the last component of the file name, and use that. */
     if (cf->filename){
-      displayname = get_basename(cf->filename);
+      displayname = g_filename_display_basename(cf->filename);
     } else {
       displayname="(No file)";
     }
index 18437b53f07de911ba8926ae3c5c88bb7c89ecc8..04a7cda96f863729b1972a9083f912b80be42d77 100644 (file)
@@ -173,7 +173,7 @@ preview_set_filename(GtkWidget *prev, const gchar *cf_name)
     }
 
     label = (GtkWidget *)g_object_get_data(G_OBJECT(prev), PREVIEW_FILENAME_KEY);
-    gtk_label_set_text(GTK_LABEL(label), get_basename(cf_name));
+    gtk_label_set_text(GTK_LABEL(label), g_filename_display_basename(cf_name));
 
     if (test_for_directory(cf_name) == EISDIR) {
         label = (GtkWidget *)g_object_get_data(G_OBJECT(prev), PREVIEW_FORMAT_KEY);
index d7efa82a42404fdd6b39e923e41995389428b336..b7797d9ffafbf16ce2f18acf0068d680799dda7b 100644 (file)
@@ -745,7 +745,7 @@ statusbar_cf_file_read_started_cb(capture_file *cf, const char *action)
     /* Ensure we pop any previous loaded filename */
     statusbar_pop_file_msg();
 
-    name_ptr = get_basename(cf->filename);
+    name_ptr = g_filename_display_basename(cf->filename);
 
     statusbar_push_file_msg(" %s: %s", action, name_ptr);
 }
@@ -926,7 +926,7 @@ static void
 statusbar_cf_file_save_started_cb(gchar *filename)
 {
     statusbar_pop_file_msg();
-    statusbar_push_file_msg(" Saving: %s...", get_basename(filename));
+    statusbar_push_file_msg(" Saving: %s...", g_filename_display_basename(filename));
 }
 
 static void