glib r7417 - in branches/glib-2-16: . glib



Author: ebassi
Date: Sun Aug 31 19:47:38 2008
New Revision: 7417
URL: http://svn.gnome.org/viewvc/glib?rev=7417&view=rev

Log:
2008-08-31  Emmanuele Bassi  <ebassi gnome org>

	* glib/gbookmarkfile.c:
	(parse_bookmark_element), (parse_application_element),
	(parse_mime_type_element), (parse_icon_element): Relax the
	attributes checking of the GBookmarkFile parser for the
	attributes that the desktop bookmark file specification
	defines and controls. (See bug 550096)

Modified:
   branches/glib-2-16/ChangeLog
   branches/glib-2-16/glib/gbookmarkfile.c

Modified: branches/glib-2-16/glib/gbookmarkfile.c
==============================================================================
--- branches/glib-2-16/glib/gbookmarkfile.c	(original)
+++ branches/glib-2-16/glib/gbookmarkfile.c	Sun Aug 31 19:47:38 2008
@@ -700,6 +700,10 @@
         visited = attribute_values[i];
       else
         {
+          /* bookmark is defined by the XBEL spec, so we need
+           * to error out if the element has different or
+           * missing attributes
+           */
           g_set_error (error, G_MARKUP_ERROR,
 		       G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE,
           	       _("Unexpected attribute '%s' for element '%s'"),
@@ -775,17 +779,9 @@
         count = attribute_values[i];
       else if (IS_ATTRIBUTE (attr, BOOKMARK_TIMESTAMP_ATTRIBUTE))
         stamp = attribute_values[i];
-      else
-        {
-          g_set_error (error, G_MARKUP_ERROR,
-		       G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE,
-          	       _("Unexpected attribute '%s' for element '%s'"),
-          	       attr,
-          	       BOOKMARK_APPLICATION_ELEMENT);
-          return;
-        }        
     }
 
+  /* the "name" and "exec" attributes are mandatory */
   if (!name)
     {
       g_set_error (error, G_MARKUP_ERROR,
@@ -854,15 +850,6 @@
     {
       if (IS_ATTRIBUTE (attr, MIME_TYPE_ATTRIBUTE))
         type = attribute_values[i];
-      else
-        {
-          g_set_error (error, G_MARKUP_ERROR,
-		       G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE,
-          	       _("Unexpected attribute '%s' for element '%s'"),
-          	       attr,
-          	       MIME_TYPE_ELEMENT);
-          return;
-        }        
     }
 
   if (!type)
@@ -901,17 +888,9 @@
         href = attribute_values[i];
       else if (IS_ATTRIBUTE (attr, BOOKMARK_TYPE_ATTRIBUTE))
         type = attribute_values[i];
-      else
-        {
-          g_set_error (error, G_MARKUP_ERROR,
-		       G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE,
-          	       _("Unexpected attribute '%s' for element '%s'"),
-          	       attr,
-          	       BOOKMARK_ICON_ELEMENT);
-          return;
-        }        
     }
 
+  /* the "href" attribute is mandatory */
   if (!href)
     {
       g_set_error (error, G_MARKUP_ERROR,



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