[gvfs/mtp-1.14.0: 47/49] Add display name support to gvfs-ls.



commit 76713a563e5eb81b73e6aa7341fd4fa8c76c4be2
Author: Philip Langdale <philipl overt org>
Date:   Sat Aug 11 10:19:33 2012 -0700

    Add display name support to gvfs-ls.

 programs/gvfs-ls.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/programs/gvfs-ls.c b/programs/gvfs-ls.c
index b15cf91..2c45273 100644
--- a/programs/gvfs-ls.c
+++ b/programs/gvfs-ls.c
@@ -78,7 +78,7 @@ type_to_string (GFileType type)
 static void
 show_info (GFileInfo *info)
 {
-  const char *name, *type;
+  const char *name, *display_name, *type;
   goffset size;
   char **attributes;
   int i;
@@ -91,12 +91,16 @@ show_info (GFileInfo *info)
   if (name == NULL)
     name = "";
 
+  display_name = g_file_info_get_display_name (info);
+  if (display_name == NULL)
+    display_name = name;
+
   size = g_file_info_get_size (info);
   type = type_to_string (g_file_info_get_file_type (info));
   if (show_long)
-    g_print ("%s\t%"G_GUINT64_FORMAT"\t(%s)", name, (guint64)size, type);
+    g_print ("%s\t%s\t\t\t%"G_GUINT64_FORMAT"\t(%s)", name, display_name, (guint64)size, type);
   else
-    g_print ("%s", name);
+    g_print ("%s", display_name);
 
   first_attr = TRUE;
   attributes = g_file_info_list_attributes (info, NULL);
@@ -106,6 +110,7 @@ show_info (GFileInfo *info)
 
       if (!show_long ||
 	  strcmp (attributes[i], G_FILE_ATTRIBUTE_STANDARD_NAME) == 0 ||
+	  strcmp (attributes[i], G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME) == 0 ||
 	  strcmp (attributes[i], G_FILE_ATTRIBUTE_STANDARD_SIZE) == 0 ||
 	  strcmp (attributes[i], G_FILE_ATTRIBUTE_STANDARD_TYPE) == 0 ||
 	  strcmp (attributes[i], G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN) == 0)
@@ -426,6 +431,7 @@ main (int argc, char *argv[])
     }
 
   attributes = g_strconcat (G_FILE_ATTRIBUTE_STANDARD_NAME ","
+                            G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME ","
 			    G_FILE_ATTRIBUTE_STANDARD_TYPE ","
 			    G_FILE_ATTRIBUTE_STANDARD_SIZE ","
 			    G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]