summaryrefslogtreecommitdiff
path: root/demos
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2016-01-19 06:28:55 -0500
committerMatthias Clasen <mclasen@redhat.com>2016-01-19 08:36:27 -0500
commitcba7b2c56b22481211c21070198b8b3f87ead417 (patch)
tree414a8af27f1e45773b9eaa0d9c5842000bc25649 /demos
parentcccaf1d16bb42f343d4ba5b6ea2f81d5d9555d92 (diff)
downloadgtk+-cba7b2c56b22481211c21070198b8b3f87ead417.tar.gz
Simplify foreign drawing example
This is code will be copied, so take out unnecessary complication.
Diffstat (limited to 'demos')
-rw-r--r--demos/gtk-demo/foreigndrawing.c51
1 files changed, 12 insertions, 39 deletions
diff --git a/demos/gtk-demo/foreigndrawing.c b/demos/gtk-demo/foreigndrawing.c
index db4d2462f2..350829f98c 100644
--- a/demos/gtk-demo/foreigndrawing.c
+++ b/demos/gtk-demo/foreigndrawing.c
@@ -146,15 +146,9 @@ draw_horizontal_scrollbar (GtkWidget *widget,
GtkStyleContext *slider_context;
/* This information is taken from the GtkScrollbar docs, see "CSS nodes" */
- const char *path[3] = {
- "scrollbar.horizontal",
- "trough",
- "slider"
- };
-
- scrollbar_context = get_style (NULL, path[0]);
- trough_context = get_style (scrollbar_context, path[1]);
- slider_context = get_style (trough_context, path[2]);
+ scrollbar_context = get_style (NULL, "scrollbar.horizontal");
+ trough_context = get_style (scrollbar_context, "trough");
+ slider_context = get_style (trough_context, "slider");
gtk_style_context_set_state (scrollbar_context, state);
gtk_style_context_set_state (trough_context, state);
@@ -185,13 +179,8 @@ draw_text (GtkWidget *widget,
PangoLayout *layout;
/* This information is taken from the GtkLabel docs, see "CSS nodes" */
- const char *path[2] = {
- "label.view",
- "selection"
- };
-
- label_context = get_style (NULL, path[0]);
- selection_context = get_style (label_context, path[1]);
+ label_context = get_style (NULL, "label.view");
+ selection_context = get_style (label_context, "selection");
gtk_style_context_set_state (label_context, state);
@@ -223,13 +212,8 @@ draw_check (GtkWidget *widget,
GtkStyleContext *check_context;
/* This information is taken from the GtkCheckButton docs, see "CSS nodes" */
- const char *path[2] = {
- "checkbutton",
- "check"
- };
-
- button_context = get_style (NULL, path[0]);
- check_context = get_style (button_context, path[1]);
+ button_context = get_style (NULL, "checkbutton");
+ check_context = get_style (button_context, "check");
gtk_style_context_set_state (check_context, state);
@@ -253,13 +237,8 @@ draw_radio (GtkWidget *widget,
GtkStyleContext *check_context;
/* This information is taken from the GtkRadioButton docs, see "CSS nodes" */
- const char *path[2] = {
- "radiobutton",
- "radio"
- };
-
- button_context = get_style (NULL, path[0]);
- check_context = get_style (button_context, path[1]);
+ button_context = get_style (NULL, "radiobutton");
+ check_context = get_style (button_context, "radio");
gtk_style_context_set_state (check_context, state);
@@ -286,15 +265,9 @@ draw_progress (GtkWidget *widget,
GtkStyleContext *progress_context;
/* This information is taken from the GtkProgressBar docs, see "CSS nodes" */
- const char *path[3] = {
- "progressbar",
- "trough",
- "progress"
- };
-
- bar_context = get_style (NULL, path[0]);
- trough_context = get_style (bar_context, path[1]);
- progress_context = get_style (trough_context, path[2]);
+ bar_context = get_style (NULL, "progressbar");
+ trough_context = get_style (bar_context, "trough");
+ progress_context = get_style (trough_context, "progress");
gtk_render_background (trough_context, cr, x, y, width, height);
gtk_render_frame (trough_context, cr, x, y, width, height);