From 60d6b85399ac2329cb30b7771b519c9d0fe7d2ff Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 30 Aug 2005 05:06:36 +0000 Subject: [PATCH] Add gtk_window_[sg]et_deletable. Add 2005-08-30 Matthias Clasen * gtk/gtk-sections.txt: Add gtk_window_[sg]et_deletable. Add gtk_selection_data_targets_include_uri. --- docs/reference/ChangeLog | 1 + docs/reference/gtk/gtk-sections.txt | 1 + gtk/gtk.symbols | 1 + gtk/gtkselection.c | 47 +++++++++++++++++++++++++++++ gtk/gtkselection.h | 1 + 5 files changed, 51 insertions(+) diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index baf49e9d9f..f8cec45e74 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,6 +1,7 @@ 2005-08-30 Matthias Clasen * gtk/gtk-sections.txt: Add gtk_window_[sg]et_deletable. + Add gtk_selection_data_targets_include_uri. 2005-08-29 Matthias Clasen diff --git a/docs/reference/gtk/gtk-sections.txt b/docs/reference/gtk/gtk-sections.txt index c2e43b41f1..26b4e4a441 100644 --- a/docs/reference/gtk/gtk-sections.txt +++ b/docs/reference/gtk/gtk-sections.txt @@ -5146,6 +5146,7 @@ gtk_selection_data_get_uris gtk_selection_data_get_targets gtk_selection_data_targets_include_image gtk_selection_data_targets_include_text +gtk_selection_data_targets_include_uri gtk_selection_remove_all gtk_selection_clear gtk_selection_data_copy diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols index 1cd9e596e7..5e31af30f4 100644 --- a/gtk/gtk.symbols +++ b/gtk/gtk.symbols @@ -2611,6 +2611,7 @@ gtk_selection_data_set_text gtk_selection_data_set_uris gtk_selection_data_targets_include_image gtk_selection_data_targets_include_text +gtk_selection_data_targets_include_uri gtk_selection_owner_set gtk_selection_owner_set_for_display gtk_selection_remove_all diff --git a/gtk/gtkselection.c b/gtk/gtkselection.c index cb5e872ca2..57294758fa 100644 --- a/gtk/gtkselection.c +++ b/gtk/gtkselection.c @@ -1587,6 +1587,8 @@ gtk_selection_data_targets_include_text (GtkSelectionData *selection_data) gint i; gboolean result = FALSE; + /* Keep in sync with gtk_target_list_add_text_targets() + */ init_atoms (); if (gtk_selection_data_get_targets (selection_data, &targets, &n_targets)) @@ -1638,6 +1640,8 @@ gtk_selection_data_targets_include_image (GtkSelectionData *selection_data, GtkTargetList *list; GList *l; + /* Keep in sync with gtk_target_list_add_image_targets() + */ init_atoms (); if (gtk_selection_data_get_targets (selection_data, &targets, &n_targets)) @@ -1659,6 +1663,49 @@ gtk_selection_data_targets_include_image (GtkSelectionData *selection_data, return result; } + +/** + * gtk_selection_data_targets_include_uri: + * @selection_data: a #GtkSelectionData object + * + * Given a #GtkSelectionData object holding a list of targets, + * determines if any of the targets in @targets can be used to + * provide a list or URIs. + * + * Return value: %TRUE if @selection_data holds a list of targets, + * and a suitable target for text is included, otherwise %FALSE. + * + * Since: 2.10 + **/ +gboolean +gtk_selection_data_targets_include_uri (GtkSelectionData *selection_data) +{ + GdkAtom *targets; + gint n_targets; + gint i; + gboolean result = FALSE; + + /* Keep in sync with gtk_target_list_add_uri_targets() + */ + init_atoms (); + + if (gtk_selection_data_get_targets (selection_data, &targets, &n_targets)) + { + for (i=0; i < n_targets; i++) + { + if (targets[i] == text_uri_list_atom) + { + result = TRUE; + break; + } + } + + g_free (targets); + } + + return result; +} + /************************************************************* * gtk_selection_init: diff --git a/gtk/gtkselection.h b/gtk/gtkselection.h index 70985b8435..a37b3f35af 100644 --- a/gtk/gtkselection.h +++ b/gtk/gtkselection.h @@ -155,6 +155,7 @@ gboolean gtk_selection_data_get_targets (GtkSelectionData *selection_d gboolean gtk_selection_data_targets_include_text (GtkSelectionData *selection_data); gboolean gtk_selection_data_targets_include_image (GtkSelectionData *selection_data, gboolean writable); +gboolean gtk_selection_data_targets_include_uri (GtkSelectionData *selection_data); /* Called when a widget is destroyed */