[Xfce4-commits] <xfce4-clipman-plugin:master> tests: Add option -p in test_targets.c to print text

Mike Massonnet noreply at xfce.org
Sun Oct 24 08:22:01 CEST 2010


Updating branch refs/heads/master
         to 36a00dcabb00efaeb691b635172af6b7154c8a81 (commit)
       from 5098003bcae75c2f09bc2e3c20d47100c3f05e9f (commit)

commit 36a00dcabb00efaeb691b635172af6b7154c8a81
Author: Mike Massonnet <mmassonnet at xfce.org>
Date:   Sun Oct 24 08:19:47 2010 +0200

    tests: Add option -p in test_targets.c to print text

 tests/test_targets.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/tests/test_targets.c b/tests/test_targets.c
index a918212..26ea1c3 100644
--- a/tests/test_targets.c
+++ b/tests/test_targets.c
@@ -1,6 +1,8 @@
 #include <glib.h>
 #include <gtk/gtk.h>
 
+gboolean print_text = FALSE;
+
 static void
 cb (GtkClipboard *clipboard,
     GdkEvent *event,
@@ -41,6 +43,13 @@ cb (GtkClipboard *clipboard,
   g_print ("\n");
 
   g_free (atoms);
+
+  if (print_text)
+    {
+      gchar *text = gtk_clipboard_wait_for_text (clipboard);
+      g_print ("text: %.30s[...]\n\n", text);
+      g_free (text);
+    }
 }
 
 int main (int argc, char *argv[])
@@ -49,6 +58,11 @@ int main (int argc, char *argv[])
 
   gtk_init (&argc, &argv);
 
+  if (argc > 1 && !g_strcmp0 (argv[1], "-p"))
+    print_text = TRUE;
+  else if (argc > 2 && !g_strcmp0 (argv[2], "-p"))
+    print_text = TRUE;
+
   if (argc > 1 && !g_strcmp0 (argv[1], "-s"))
     clipboard = gtk_clipboard_get (GDK_SELECTION_PRIMARY);
   else



More information about the Xfce4-commits mailing list