[gtk+/wip/matthiasc/tab-strip] Add needs-attention to the test
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/matthiasc/tab-strip] Add needs-attention to the test
- Date: Mon, 13 Jun 2016 18:53:42 +0000 (UTC)
commit 73e7219b531a2a8cc2813416039b57358242fdb0
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Jun 13 08:35:44 2016 -0400
Add needs-attention to the test
tests/testtabstrip.c | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/tests/testtabstrip.c b/tests/testtabstrip.c
index 1cbd9dd..d9dd623 100644
--- a/tests/testtabstrip.c
+++ b/tests/testtabstrip.c
@@ -48,6 +48,25 @@ populate (GtkWidget *stack)
add_child (stack, "Enigma machine - Wikipedia, the free ecyclopedia");
}
+static void
+attention (GtkButton *button, GtkStack *stack)
+{
+ GList *children;
+ children = gtk_container_get_children (GTK_CONTAINER (stack));
+ gtk_container_child_set (GTK_CONTAINER (stack), children->data,
+ "needs-attention", TRUE,
+ NULL);
+ gtk_container_child_set (GTK_CONTAINER (stack), g_list_last (children)->data,
+ "needs-attention", TRUE,
+ NULL);
+ g_list_free (children);
+}
+
+static const char css[] =
+ "tab.needs-attention { border-bottom: solid 4px red; }"
+ "scrolledwindow undershoot.left.needs-attention { background: none; border-left: solid 4px red; }"
+ "scrolledwindow undershoot.right.needs-attention { background: none; border-right: solid 4px red; }";
+
int
main (int argc, char *argv[])
{
@@ -57,9 +76,15 @@ main (int argc, char *argv[])
GtkWidget *tabs;
GtkWidget *stack;
GtkWidget *button;
+ GtkWidget *hbox;
+ GtkCssProvider *provider;
gtk_init (NULL, NULL);
+ provider = gtk_css_provider_new ();
+ gtk_css_provider_load_from_data (provider, css, -1, NULL);
+ gtk_style_context_add_provider_for_screen (gdk_screen_get_default (), provider, 800);
+
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (window), 600, 800);
titlebar = gtk_header_bar_new ();
@@ -88,6 +113,12 @@ main (int argc, char *argv[])
gtk_box_pack_start (GTK_BOX (vbox), tabs, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), stack, TRUE, TRUE, 0);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+ button = gtk_button_new_with_label ("Attention");
+ g_signal_connect (button, "clicked", G_CALLBACK (attention), stack);
+ gtk_container_add (GTK_CONTAINER (hbox), button);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+
populate (stack);
gtk_widget_show_all (window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]