summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2015-12-24 18:21:38 +0100
committerBenjamin Otte <otte@redhat.com>2016-01-11 17:03:07 +0100
commit4e627e108e1b8af5bf2ffc4fdd6dc2eab3ad1166 (patch)
tree58a250eb1200142b5eec9f3c3b3a35b741fed494 /tests
parentfa7816d99c70a759d67ddc09bc2cadf7cf2a29dd (diff)
downloadgtk+-4e627e108e1b8af5bf2ffc4fdd6dc2eab3ad1166.tar.gz
testnotebookdnd: Add an action widget
Just so we have some test that tests action widgets.
Diffstat (limited to 'tests')
-rw-r--r--tests/testnotebookdnd.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/tests/testnotebookdnd.c b/tests/testnotebookdnd.c
index 1bdd57e32c..6cef57ee2c 100644
--- a/tests/testnotebookdnd.c
+++ b/tests/testnotebookdnd.c
@@ -150,17 +150,39 @@ on_button_drag_data_received (GtkWidget *widget,
g_idle_add (remove_in_idle, *child);
}
+static void
+action_clicked_cb (GtkWidget *button,
+ GtkWidget *notebook)
+{
+ GtkWidget *page, *title;
+
+ page = gtk_entry_new ();
+ gtk_entry_set_text (GTK_ENTRY (page), "Addition");
+ gtk_widget_show (page);
+
+ title = gtk_label_new ("Addition");
+
+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, title);
+ gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK (notebook), page, TRUE);
+ gtk_notebook_set_tab_detachable (GTK_NOTEBOOK (notebook), page, TRUE);
+}
+
static GtkWidget*
create_notebook (gchar **labels,
const gchar *group,
GtkPositionType pos)
{
- GtkWidget *notebook, *title, *page;
- gint count = 0;
+ GtkWidget *notebook, *title, *page, *action_widget;
notebook = gtk_notebook_new ();
gtk_widget_set_vexpand (notebook, TRUE);
gtk_widget_set_hexpand (notebook, TRUE);
+
+ action_widget = gtk_button_new_from_icon_name ("list-add-symbolic", GTK_ICON_SIZE_BUTTON);
+ g_signal_connect (action_widget, "clicked", G_CALLBACK (action_clicked_cb), notebook);
+ gtk_widget_show (action_widget);
+ gtk_notebook_set_action_widget (GTK_NOTEBOOK (notebook), action_widget, GTK_PACK_END);
+
g_signal_connect (notebook, "create-window",
G_CALLBACK (window_creation_function), NULL);
@@ -180,7 +202,6 @@ create_notebook (gchar **labels,
gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK (notebook), page, TRUE);
gtk_notebook_set_tab_detachable (GTK_NOTEBOOK (notebook), page, TRUE);
- count++;
labels++;
}