[gtk] testmodelbutton: Add explanatory comments to CSS



commit 08126ffdf27bcdf3e8382bc7b17583a288c202b4
Author: Daniel Boles <dboles src gmail com>
Date:   Sun Apr 8 16:07:35 2018 +0100

    testmodelbutton: Add explanatory comments to CSS
    
    and load at an earlier, more sensible place, before creating any widgets

 tests/testmodelbutton.c | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)
---
diff --git a/tests/testmodelbutton.c b/tests/testmodelbutton.c
index c32b5aa87a..c7268e48c3 100644
--- a/tests/testmodelbutton.c
+++ b/tests/testmodelbutton.c
@@ -22,6 +22,21 @@ on_application_activate (GApplication *gapplication,
   GtkWidget *model_button;
   GtkWidget *widget;
 
+  gtk_css_provider_load_from_data (css_provider,
+    "window > box { padding: 0.5em; }"
+    "window > box > * { margin: 0.5em; }"
+    /* :iconic == FALSE */
+    "modelbutton > check { background: red; }"
+    "modelbutton > radio { background: green; }"
+    "modelbutton > arrow { background: blue; }"
+    /* :iconic == TRUE */
+    "button.model { background: yellow; }"
+    , -1);
+  g_assert (GDK_IS_DISPLAY (display));
+  gtk_style_context_add_provider_for_display (display,
+                                              GTK_STYLE_PROVIDER (css_provider),
+                                              GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+
   action = g_simple_action_new ("beep", NULL);
   g_signal_connect (action, "activate", G_CALLBACK (on_action_beep), NULL);
   g_action_map_add_action (G_ACTION_MAP (application), G_ACTION (action));
@@ -54,19 +69,6 @@ on_application_activate (GApplication *gapplication,
   gtk_container_add (GTK_CONTAINER (box), widget);
 
   widget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-  gtk_css_provider_load_from_data (css_provider,
-    "window > box { padding: 0.5em; }"
-    "window > box > * { margin: 0.5em; }"
-    "modelbutton > check { background: red; }"
-    "modelbutton > radio { background: green; }"
-    "modelbutton > arrow { background: blue; }"
-    "button.model { background: yellow; }"
-    , -1);
-  g_assert (GDK_IS_DISPLAY (display));
-  gtk_style_context_add_provider_for_display (display,
-                                              GTK_STYLE_PROVIDER (css_provider),
-                                              GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
-
   gtk_container_add (GTK_CONTAINER (widget), box);
   gtk_widget_show (widget);
   gtk_application_add_window (GTK_APPLICATION (application), GTK_WINDOW (widget));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]