[brasero] Check for some special targets that may include URIs not just text.
- From: Philippe Rouquier <philippr src gnome org>
- To: svn-commits-list gnome org
- Subject: [brasero] Check for some special targets that may include URIs not just text.
- Date: Sat, 9 May 2009 08:30:34 -0400 (EDT)
commit 558cf73212772cf7c8a7754e5d359dd3da344707
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date: Fri May 8 21:16:53 2009 +0200
Check for some special targets that may include URIs not just text.
Add a target removed by previous patches when we decide if we want the data from the clipboard.
Again thanks a lot to Christian Persch who took the time to read my commit for a bug he had filed and spotted this.
---
src/brasero-audio-disc.c | 2 +-
src/brasero-data-disc.c | 2 +-
src/brasero-utils.c | 29 +++++++++++++++++++++++++++++
src/brasero-utils.h | 4 ++++
src/brasero-video-disc.c | 2 +-
5 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/src/brasero-audio-disc.c b/src/brasero-audio-disc.c
index ae8eb9a..6a19d33 100644
--- a/src/brasero-audio-disc.c
+++ b/src/brasero-audio-disc.c
@@ -3393,7 +3393,7 @@ brasero_audio_disc_clipboard_targets_cb (GtkClipboard *clipboard,
gint n_atoms,
BraseroAudioDisc *disc)
{
- if (gtk_targets_include_text (atoms, n_atoms))
+ if (brasero_clipboard_selection_may_have_uri (atoms, n_atoms))
gtk_clipboard_request_text (clipboard,
(GtkClipboardTextReceivedFunc) brasero_audio_disc_clipboard_text_cb,
disc);
diff --git a/src/brasero-data-disc.c b/src/brasero-data-disc.c
index 3fd44d5..1fc0e6d 100644
--- a/src/brasero-data-disc.c
+++ b/src/brasero-data-disc.c
@@ -400,7 +400,7 @@ brasero_data_disc_clipboard_targets_cb (GtkClipboard *clipboard,
gint n_atoms,
BraseroClipData *data)
{
- if (gtk_targets_include_text (atoms, n_atoms)) {
+ if (brasero_clipboard_selection_may_have_uri (atoms, n_atoms)) {
gtk_clipboard_request_text (clipboard,
(GtkClipboardTextReceivedFunc)
brasero_data_disc_clipboard_text_cb,
diff --git a/src/brasero-utils.c b/src/brasero-utils.c
index 31641d3..0452981 100644
--- a/src/brasero-utils.c
+++ b/src/brasero-utils.c
@@ -81,3 +81,32 @@ brasero_utils_launch_app (GtkWidget *widget,
}
}
}
+
+gboolean
+brasero_clipboard_selection_may_have_uri (GdkAtom *atoms,
+ gint n_atoms)
+{
+ GdkAtom *iter;
+
+ /* Check for a text target */
+ if (gtk_targets_include_text (atoms, n_atoms))
+ return TRUE;
+
+ /* Check for special targets like nautilus' and its file copied */
+ iter = atoms;
+ while (n_atoms > 0) {
+ gchar *target;
+
+ target = gdk_atom_name (*iter);
+ if (!strcmp (target, "x-special/gnome-copied-files")) {
+ g_free (target);
+ return TRUE;
+ }
+ g_free (target);
+
+ iter++;
+ n_atoms--;
+ }
+
+ return FALSE;
+}
diff --git a/src/brasero-utils.h b/src/brasero-utils.h
index bfaa47b..4462159 100644
--- a/src/brasero-utils.h
+++ b/src/brasero-utils.h
@@ -54,6 +54,10 @@ void
brasero_utils_launch_app (GtkWidget *widget,
GSList *list);
+gboolean
+brasero_utils_selection_may_have_uri (GdkAtom *atoms,
+ gint n_atoms);
+
G_END_DECLS
#endif /* _UTILS_H */
diff --git a/src/brasero-video-disc.c b/src/brasero-video-disc.c
index f406bd1..59c0617 100644
--- a/src/brasero-video-disc.c
+++ b/src/brasero-video-disc.c
@@ -776,7 +776,7 @@ brasero_video_disc_clipboard_targets_cb (GtkClipboard *clipboard,
gint n_atoms,
BraseroVideoDisc *self)
{
- if (gtk_targets_include_text (atoms, n_atoms))
+ if (brasero_clipboard_selection_may_have_uri (atoms, n_atoms))
gtk_clipboard_request_text (clipboard,
(GtkClipboardTextReceivedFunc) brasero_video_disc_clipboard_text_cb,
self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]