[gvfs] Allow unsetting attributes with gvfs-set-attributes



commit 68607708bc34cfdc357a823fb6f909d3696fec78
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Jun 25 09:19:07 2009 +0200

    Allow unsetting attributes with gvfs-set-attributes

 programs/gvfs-set-attribute.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/programs/gvfs-set-attribute.c b/programs/gvfs-set-attribute.c
index 7d24d9c..9504862 100644
--- a/programs/gvfs-set-attribute.c
+++ b/programs/gvfs-set-attribute.c
@@ -91,7 +91,9 @@ attribute_type_from_string (const char *str)
     return G_FILE_ATTRIBUTE_TYPE_INT64;
   if (strcmp (str, "object") == 0)
     return G_FILE_ATTRIBUTE_TYPE_OBJECT;
-  return G_FILE_ATTRIBUTE_TYPE_INVALID;
+  if (strcmp (str, "unset") == 0)
+    return G_FILE_ATTRIBUTE_TYPE_INVALID;
+  return -1;
 }
 
 int
@@ -179,6 +181,9 @@ main (int argc, char *argv[])
       value = &argv[3];
       break;
     case G_FILE_ATTRIBUTE_TYPE_INVALID:
+      value = NULL;
+      break;
+    case -1:
     case G_FILE_ATTRIBUTE_TYPE_OBJECT:
     default:
       g_printerr (_("Invalid attribute type %s\n"), attr_type);



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