diff options
author | Matthias Clasen <mclasen@redhat.com> | 2004-10-22 22:50:32 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2004-10-22 22:50:32 +0000 |
commit | a811584d01706df3651a93a3b0c2c9f86249ca52 (patch) | |
tree | 224c8567dc2065e9f428f8c307db07963690a92f /gtk/gtkdnd.c | |
parent | 9d0a283f341aaf37a568579715b6c92fa518fd89 (diff) | |
download | gtk+-a811584d01706df3651a93a3b0c2c9f86249ca52.tar.gz |
Use the new file DND api.
2004-10-22 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkfilechooserbutton.c (gtk_file_chooser_button_drag_data_received)
(gtk_file_chooser_button_init): Use the new file DND api.
* gtk/gtkdnd.h:
* gtk/gtkdnd.c (gtk_drag_dest_add_uri_targets)
(gtk_drag_source_add_uri_targets):
* gtk/gtkselection.h:
* gtk/gtkselection.c (gtk_target_list_add_uri_targets):
(gtk_selection_data_set_uris):
(gtk_selection_data_get_uris): New functions to allow
handling file DND "without knowing jack shit".
* configure.in: Bump glib requirement to 2.5.4.
* gtk/gtkfilechooserdefault.c (shortcuts_drop_uris): Use
g_uri_list_extract_uris().
Diffstat (limited to 'gtk/gtkdnd.c')
-rw-r--r-- | gtk/gtkdnd.c | 60 |
1 files changed, 57 insertions, 3 deletions
diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c index a2edb049ea..c59bd0f995 100644 --- a/gtk/gtkdnd.c +++ b/gtk/gtkdnd.c @@ -1079,6 +1079,33 @@ gtk_drag_dest_add_image_targets (GtkWidget *widget) gtk_target_list_unref (target_list); } +/** + * gtk_drag_dest_add_uri_targets: + * @widget: a #GtkWidget that's a drag destination + * + * Add the URI targets supported by #GtkSelection to + * the target list of the drag destination. The targets + * are added with @info = 0. If you need another value, + * use gtk_target_list_add_uri_targets() and + * gtk_drag_dest_set_target_list(). + * + * Since: 2.6 + **/ +void +gtk_drag_dest_add_uri_targets (GtkWidget *widget) +{ + GtkTargetList *target_list; + + target_list = gtk_drag_dest_get_target_list (widget); + if (target_list) + gtk_target_list_ref (target_list); + else + target_list = gtk_target_list_new (NULL, 0); + gtk_target_list_add_uri_targets (target_list, 0); + gtk_drag_dest_set_target_list (widget, target_list); + gtk_target_list_unref (target_list); +} + /************************************************************* * _gtk_drag_dest_handle_event: * Called from widget event handling code on Drag events @@ -2230,7 +2257,7 @@ gtk_drag_source_set_target_list (GtkWidget *widget, * the target list of the drag source. The targets * are added with @info = 0. If you need another value, * use gtk_target_list_add_text_targets() and - * gtk_drag_dest_set_target_list(). + * gtk_drag_source_set_target_list(). * * Since: 2.6 **/ @@ -2256,8 +2283,8 @@ gtk_drag_source_add_text_targets (GtkWidget *widget) * Add the writable image targets supported by #GtkSelection to * the target list of the drag source. The targets * are added with @info = 0. If you need another value, - * use gtk_target_list_add_text_targets() and - * gtk_drag_dest_set_target_list(). + * use gtk_target_list_add_image_targets() and + * gtk_drag_source_set_target_list(). * * Since: 2.6 **/ @@ -2276,6 +2303,33 @@ gtk_drag_source_add_image_targets (GtkWidget *widget) gtk_target_list_unref (target_list); } +/** + * gtk_drag_source_add_uri_targets: + * @widget: a #GtkWidget that's is a drag source + * + * Add the URI targets supported by #GtkSelection to + * the target list of the drag source. The targets + * are added with @info = 0. If you need another value, + * use gtk_target_list_add_uri_targets() and + * gtk_drag_source_set_target_list(). + * + * Since: 2.6 + **/ +void +gtk_drag_source_add_uri_targets (GtkWidget *widget) +{ + GtkTargetList *target_list; + + target_list = gtk_drag_source_get_target_list (widget); + if (target_list) + gtk_target_list_ref (target_list); + else + target_list = gtk_target_list_new (NULL, 0); + gtk_target_list_add_uri_targets (target_list, 0); + gtk_drag_source_set_target_list (widget, target_list); + gtk_target_list_unref (target_list); +} + static void gtk_drag_source_unset_icon (GtkDragSourceSite *site) { |