[gtk/tooltip-redo: 2/3] testtooltips: Test tooltips on popovers
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/tooltip-redo: 2/3] testtooltips: Test tooltips on popovers
- Date: Sun, 29 Dec 2019 06:04:51 +0000 (UTC)
commit 215c776ff9d7dea0429bf0fae0feeaa9f8f88b01
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Dec 28 23:16:57 2019 -0500
testtooltips: Test tooltips on popovers
They do not currently work right.
tests/testtooltips.c | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
---
diff --git a/tests/testtooltips.c b/tests/testtooltips.c
index 04eda125e1..60614dbb59 100644
--- a/tests/testtooltips.c
+++ b/tests/testtooltips.c
@@ -280,6 +280,8 @@ main (int argc, char *argv[])
GtkWidget *button;
GtkWidget *label;
GtkWidget *tooltip;
+ GtkWidget *popover;
+ GtkWidget *box2;
GtkWidget *tooltip_window;
GtkWidget *tooltip_button;
@@ -356,6 +358,7 @@ main (int argc, char *argv[])
button = gtk_check_button_new_with_label ("This one has a custom tooltip window!");
gtk_container_add (GTK_CONTAINER (box), button);
+#if 0
tooltip_window = gtk_window_new (GTK_WINDOW_POPUP);
tooltip_button = gtk_label_new ("blaat!");
gtk_container_add (GTK_CONTAINER (tooltip_window), tooltip_button);
@@ -366,6 +369,7 @@ main (int argc, char *argv[])
GDK_SURFACE_TYPE_HINT_TOOLTIP);
gtk_window_set_transient_for (GTK_WINDOW (tooltip_window),
GTK_WINDOW (window));
+#endif
g_signal_connect (button, "query-tooltip",
G_CALLBACK (query_tooltip_custom_cb), NULL);
@@ -435,21 +439,31 @@ main (int argc, char *argv[])
G_CALLBACK (query_tooltip_drawing_area_cb), NULL);
gtk_container_add (GTK_CONTAINER (box), drawing_area);
- button = gtk_label_new ("Custom tooltip I");
- label = gtk_label_new ("See, custom");
+ button = gtk_menu_button_new ();
+ gtk_widget_set_halign (button, GTK_ALIGN_END);
+ gtk_container_add (GTK_CONTAINER (box), button);
+ popover = gtk_popover_new (NULL);
+ gtk_menu_button_set_popover (GTK_MENU_BUTTON (button), popover);
+ box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+ gtk_container_add (GTK_CONTAINER (popover), box2);
+
+ 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_container_add (GTK_CONTAINER (box2), button);
g_signal_connect (button, "query-tooltip",
G_CALLBACK (query_tooltip_label_cb), label);
- gtk_container_add (GTK_CONTAINER (box), button);
- button = gtk_label_new ("Custom tooltip II");
- label = gtk_label_new ("See, custom, too");
+ gtk_container_add (GTK_CONTAINER (box2), gtk_label_new ("Some\nother\nstuff"));
+
+ 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);
- gtk_container_add (GTK_CONTAINER (box), button);
g_signal_connect (button, "query-tooltip",
G_CALLBACK (query_tooltip_label_cb), label);
+ gtk_container_add (GTK_CONTAINER (box), button);
/* Done! */
gtk_widget_show (window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]