[Xfce4-commits] <xfce4-clipman-plugin:master> [tests/test-targets] Print format/length of targets

Mike Massonnet noreply at xfce.org
Sun Nov 15 16:04:03 CET 2009


Updating branch refs/heads/master
         to 64d4ec055e60575506a95119daeed144a4b1a3ac (commit)
       from c3192a6ff4bd40985741d9b1daf550d86ec3d9c5 (commit)

commit 64d4ec055e60575506a95119daeed144a4b1a3ac
Author: Mike Massonnet <mmassonnet at xfce.org>
Date:   Sun Nov 15 13:57:31 2009 +0100

    [tests/test-targets] Print format/length of targets

 tests/test_targets.c |   25 ++++++++++++++++++++++---
 1 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/tests/test_targets.c b/tests/test_targets.c
index 7f9f47b..a918212 100644
--- a/tests/test_targets.c
+++ b/tests/test_targets.c
@@ -6,7 +6,9 @@ cb (GtkClipboard *clipboard,
     GdkEvent *event,
     gpointer udata)
 {
+  GtkSelectionData *selection_data;
   GdkAtom *atoms;
+  gchar *atom_name;
   gint n_atoms;
 
   if (!gtk_clipboard_wait_for_targets (clipboard, &atoms, &n_atoms))
@@ -15,9 +17,26 @@ cb (GtkClipboard *clipboard,
   gint i;
   for (i = 0; i < n_atoms; i++)
     {
-      gchar *name = gdk_atom_name (atoms[i]);
-      g_print ("%s\n", name);
-      g_free (name);
+      if (atoms[i] == gdk_atom_intern_static_string ("TARGETS")
+          || atoms[i] == gdk_atom_intern_static_string ("MULTIPLE")
+          || atoms[i] == gdk_atom_intern_static_string ("DELETE")
+          || atoms[i] == gdk_atom_intern_static_string ("INSERT_PROPERTY")
+          || atoms[i] == gdk_atom_intern_static_string ("INSERT_SELECTION")
+          || atoms[i] == gdk_atom_intern_static_string ("PIXMAP"))
+        continue;
+
+      atom_name = gdk_atom_name (atoms[i]);
+      selection_data = gtk_clipboard_wait_for_contents (clipboard, atoms[i]);
+      if (selection_data != NULL)
+        {
+          g_print ("%s (f:%d, l:%d)\n", atom_name, selection_data->format, selection_data->length);
+          gtk_selection_data_free (selection_data);
+        }
+      else
+        {
+          g_print ("%s\n", atom_name);
+        }
+      g_free (atom_name);
     }
   g_print ("\n");
 



More information about the Xfce4-commits mailing list