[gtk/dnd-gestures-2: 140/175] filechooserbutton: Use GDK content formats api



commit e45648d7dc5338f3d5685bde6fa97eceaf6b74f2
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Jan 7 00:45:29 2020 -0500

    filechooserbutton: Use GDK content formats api

 gtk/gtkfilechooserbutton.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c
index f20423198e..0ecb93a2b0 100644
--- a/gtk/gtkfilechooserbutton.c
+++ b/gtk/gtkfilechooserbutton.c
@@ -443,6 +443,7 @@ gtk_file_chooser_button_init (GtkFileChooserButton *button)
   GtkFileChooserButtonPrivate *priv = gtk_file_chooser_button_get_instance_private (button);
   GtkWidget *box;
   GtkWidget *icon;
+  GdkContentFormatsBuilder *builder;
   GdkContentFormats *target_list;
   GtkDropTarget *dest;
 
@@ -496,9 +497,10 @@ gtk_file_chooser_button_init (GtkFileChooserButton *button)
                                      NULL, NULL);
 
   /* DnD */
-  target_list = gdk_content_formats_new (NULL, 0);
-  target_list = gtk_content_formats_add_uri_targets (target_list);
-  target_list = gtk_content_formats_add_text_targets (target_list);
+  builder = gdk_content_formats_builder_new ();
+  gdk_content_formats_builder_add_gtype (builder, G_TYPE_STRING);
+  gdk_content_formats_builder_add_gtype (builder, GDK_TYPE_FILE_LIST);
+  target_list = gdk_content_formats_builder_free_to_formats (builder);
   dest = gtk_drop_target_new (target_list, GDK_ACTION_COPY);
   g_signal_connect (dest, "drag-drop", G_CALLBACK (gtk_file_chooser_button_drag_drop), button);
   gtk_widget_add_controller (GTK_WIDGET (button), GTK_EVENT_CONTROLLER (dest));


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