[gtk: 1/2] filefilter: Fix <suffixes> in buildable




commit 8eb9844a45cc66df48265cd7ac58b8ee68cc0628
Author: James Westman <james jwestman net>
Date:   Thu Mar 17 10:49:39 2022 -0500

    filefilter: Fix <suffixes> in buildable
    
    A bug in GtkFileFilter's GtkBuildable implementation caused the
    <suffixes> tag not to be recognized.

 gtk/gtkfilefilter.c             | 6 ++++--
 testsuite/gtk/ui/filefilter1.ui | 4 ++++
 2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkfilefilter.c b/gtk/gtkfilefilter.c
index ae45ad72a4..c9a4d3040a 100644
--- a/gtk/gtkfilefilter.c
+++ b/gtk/gtkfilefilter.c
@@ -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;
 
diff --git a/testsuite/gtk/ui/filefilter1.ui b/testsuite/gtk/ui/filefilter1.ui
index f8df737720..85acb18b9a 100644
--- a/testsuite/gtk/ui/filefilter1.ui
+++ b/testsuite/gtk/ui/filefilter1.ui
@@ -9,5 +9,9 @@
       <pattern>*.txt</pattern>
       <pattern>*.png</pattern>
     </patterns>
+    <suffixes>
+      <suffix>txt</suffix>
+      <suffix>png</suffix>
+    </suffixes>
   </object>
 </interface>


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