filefilter: Fix <suffixes> in buildable
authorJames Westman <james@jwestman.net>
Thu, 17 Mar 2022 15:49:39 +0000 (10:49 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 17 Mar 2022 20:18:28 +0000 (16:18 -0400)
A bug in GtkFileFilter's GtkBuildable implementation caused the
<suffixes> tag not to be recognized.

gtk/gtkfilefilter.c
testsuite/gtk/ui/filefilter1.ui

index ae45ad72a4b9b7d0f54df75019306681c5930513..c9a4d3040abdf06c8d02451d0f13293faafed2b3 100644 (file)
@@ -283,7 +283,8 @@ parser_start_element (GtkBuildableParseContext  *context,
     }
 
   if (strcmp (element_name, "mime-types") == 0 ||
-      strcmp (element_name, "patterns") == 0)
+      strcmp (element_name, "patterns") == 0 ||
+      strcmp (element_name, "suffixes") == 0)
     {
       if (!_gtk_builder_check_parent (data->builder, context, "object", error))
         return;
@@ -422,7 +423,8 @@ gtk_file_filter_buildable_custom_tag_end (GtkBuildable *buildable,
                                           gpointer      user_data)
 {
   if (strcmp (tagname, "mime-types") == 0 ||
-      strcmp (tagname, "patterns") == 0)
+      strcmp (tagname, "patterns") == 0 ||
+      strcmp (tagname, "suffixes") == 0)
     {
       SubParserData *data = (SubParserData*)user_data;
 
index f8df7377209931d4ecee3f0fe59312d088607645..85acb18b9a350cdc922d9c366bf1845a5f4804d3 100644 (file)
@@ -9,5 +9,9 @@
       <pattern>*.txt</pattern>
       <pattern>*.png</pattern>
     </patterns>
+    <suffixes>
+      <suffix>txt</suffix>
+      <suffix>png</suffix>
+    </suffixes>
   </object>
 </interface>