[glib] gio-tool: Do not print settable arguments unless they are any



commit bcb1bfda52a8c650c19c419e247ccfac9451640a
Author: Ondrej Holy <oholy redhat com>
Date:   Fri Dec 16 14:36:53 2016 +0100

    gio-tool: Do not print settable arguments unless they are any
    
    "Settable arguments:" is printed even if they are not any arguments
    to print. Do not print it similarly as it is done for "Writable
    namespaces:".
    
    https://bugzilla.gnome.org/show_bug.cgi?id=776169

 gio/gio-tool-info.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/gio/gio-tool-info.c b/gio/gio-tool-info.c
index d709693..570322d 100644
--- a/gio/gio-tool-info.c
+++ b/gio/gio-tool-info.c
@@ -223,15 +223,18 @@ get_writable_info (GFile *file)
       return FALSE;
     }
 
-  g_print (_("Settable attributes:\n"));
-  for (i = 0; i < list->n_infos; i++)
+  if (list->n_infos > 0)
     {
-      flags = attribute_flags_to_string (list->infos[i].flags);
-      g_print (" %s (%s%s%s)\n",
-               list->infos[i].name,
-               attribute_type_to_string (list->infos[i].type),
-               (*flags != 0)?", ":"", flags);
-      g_free (flags);
+      g_print (_("Settable attributes:\n"));
+      for (i = 0; i < list->n_infos; i++)
+        {
+          flags = attribute_flags_to_string (list->infos[i].flags);
+          g_print (" %s (%s%s%s)\n",
+                   list->infos[i].name,
+                   attribute_type_to_string (list->infos[i].type),
+                   (*flags != 0)?", ":"", flags);
+          g_free (flags);
+        }
     }
 
   g_file_attribute_info_list_unref (list);


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