[gtk/dnd-gestures-2: 143/150] testdnd2: Use GDK content formats api



commit cc0d553576ff29123dd029c932e4460d4be53395
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Jan 7 00:46:37 2020 -0500

    testdnd2: Use GDK content formats api

 tests/testdnd2.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/tests/testdnd2.c b/tests/testdnd2.c
index 8a04745a66..53c779bf94 100644
--- a/tests/testdnd2.c
+++ b/tests/testdnd2.c
@@ -220,8 +220,7 @@ get_data (const char *mimetype,
   GdkContentFormats *formats;
   gboolean want_text;
 
-  formats = gdk_content_formats_new (NULL, 0);
-  formats = gtk_content_formats_add_text_targets (formats);
+  formats = gdk_content_formats_new_for_gtype (G_TYPE_STRING);
   want_text = gdk_content_formats_contain_mime_type (formats, mimetype);
   gdk_content_formats_unref (formats);
 
@@ -288,14 +287,16 @@ make_image (const gchar *icon_name, int hotspot)
   GtkDragSource *source;
   GtkDropTarget *dest;
   GdkContentFormats *formats;
+  GdkContentFormatsBuilder *builder;
   GdkContentProvider *content;
 
   image = gtk_image_new_from_icon_name (icon_name);
   gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
 
-  formats = gdk_content_formats_new (NULL, 0);
-  formats = gtk_content_formats_add_image_targets (formats, FALSE);
-  formats = gtk_content_formats_add_text_targets (formats);
+  builder = gdk_content_formats_builder_new ();
+  gdk_content_formats_builder_add_gtype (builder, GDK_TYPE_TEXTURE);
+  gdk_content_formats_builder_add_gtype (builder, G_TYPE_STRING);
+  formats = gdk_content_formats_builder_free_to_formats (builder);
 
   content = gdk_content_provider_new_with_formats (formats, get_data, image);
   source = gtk_drag_source_new ();


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