]> Pileus Git - ~andy/gtk/commitdiff
Add code to test gtk_tooltip_set_custom()
authorMatthias Clasen <mclasen@redhat.com>
Tue, 24 Jul 2007 03:50:49 +0000 (03:50 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Tue, 24 Jul 2007 03:50:49 +0000 (03:50 +0000)
2007-07-23  Matthias Clasen  <mclasen@redhat.com>

        * tests/testtooltips.c: Add code to test gtk_tooltip_set_custom()

svn path=/trunk/; revision=18533

ChangeLog
tests/testtooltips.c

index 93e88218e02eeae007cb1d6d58547db3737d9116..0cb397c02f81c7a37956874fe4c1bb007ffdde14 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-07-23  Matthias Clasen  <mclasen@redhat.com>
+
+       * tests/testtooltips.c: Add code to test gtk_tooltip_set_custom()
+
 2007-07-23  Christian Persch  <chpe@gnome.org>
 
        * tests/testtooltips.c: (query_tooltip_tree_view_cb): Remove obsolete
index 2040e7a8c25973e77e2e5d7a9c3b49109f17896e..586d2ff4df8c0229e70fe2b396ee0ab070bba30b 100644 (file)
@@ -239,6 +239,21 @@ drawing_area_expose (GtkWidget      *drawing_area,
   return FALSE;
 }
 
+static gboolean
+query_tooltip_label_cb (GtkWidget  *widget,
+                       gint        x,
+                       gint        y,
+                       gboolean    keyboard_tip,
+                       GtkTooltip *tooltip,
+                       gpointer    data)
+{
+  GtkWidget *custom = data;
+
+  gtk_tooltip_set_custom (tooltip, custom);
+
+  return TRUE;
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -246,6 +261,7 @@ main (int argc, char *argv[])
   GtkWidget *box;
   GtkWidget *drawing_area;
   GtkWidget *button;
+  GtkWidget *label;
 
   GtkWidget *tooltip_window;
   GtkWidget *tooltip_button;
@@ -390,6 +406,22 @@ main (int argc, char *argv[])
                    G_CALLBACK (query_tooltip_drawing_area_cb), NULL);
   gtk_box_pack_start (GTK_BOX (box), drawing_area, FALSE, FALSE, 2);
 
+  button = gtk_label_new ("Custom tooltip I");
+  label = gtk_label_new ("See, custom");
+  g_object_ref_sink (label);
+  g_object_set (button, "has-tooltip", TRUE, NULL);
+  g_signal_connect (button, "query-tooltip",
+                   G_CALLBACK (query_tooltip_label_cb), label);
+  gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 2);
+
+  button = gtk_label_new ("Custom tooltip II");
+  label = gtk_label_new ("See, custom, too");
+  g_object_ref_sink (label);
+  g_object_set (button, "has-tooltip", TRUE, NULL);
+  gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 2);
+  g_signal_connect (button, "query-tooltip",
+                   G_CALLBACK (query_tooltip_label_cb), label);
+
   /* Done! */
   gtk_widget_show_all (window);