[gtk/wip/otte/widgetfactory-dnd: 2/6] contentformats: Change the format of gdk_content_formats_to_string()




commit 6a5d555f58f1492383e52e34aa5748f3a2ca9bc1
Author: Benjamin Otte <otte redhat com>
Date:   Mon Jul 26 02:28:49 2021 +0200

    contentformats: Change the format of gdk_content_formats_to_string()
    
    Now, we just print a whitespace-separated list of GTypes and mime types.
    
    This makes this neat for 2 things:
    
    1. Parsing it (see next commit)
    2. Using it in GtkBuilder (see commits after that)
    
    In particular, the common case of supporting a single GType (or mime
    type) looks like just printing the GType (or mime type), which in
    GtkBuilder looks like
    <property name="formats">GdkTexture</property>

 gdk/gdkcontentformats.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/gdk/gdkcontentformats.c b/gdk/gdkcontentformats.c
index aa0541bd44..24ac00ad14 100644
--- a/gdk/gdkcontentformats.c
+++ b/gdk/gdkcontentformats.c
@@ -241,20 +241,18 @@ gdk_content_formats_print (GdkContentFormats *formats,
   g_return_if_fail (formats != NULL);
   g_return_if_fail (string != NULL);
 
-  g_string_append (string, "{ ");
   for (i = 0; i < formats->n_gtypes; i++)
     {
       if (i > 0)
-        g_string_append (string, ", ");
+        g_string_append (string, " ");
       g_string_append (string, g_type_name (formats->gtypes[i]));
     }
   for (i = 0; i < formats->n_mime_types; i++)
     {
       if (i > 0 || formats->n_gtypes > 0)
-        g_string_append (string, ", ");
+        g_string_append (string, " ");
       g_string_append (string, formats->mime_types[i]);
     }
-  g_string_append (string, " }");
 }
 
 /**


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