[gtk+] Simplify foreign drawing example
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Simplify foreign drawing example
- Date: Tue, 19 Jan 2016 14:32:42 +0000 (UTC)
commit cba7b2c56b22481211c21070198b8b3f87ead417
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Jan 19 06:28:55 2016 -0500
Simplify foreign drawing example
This is code will be copied, so take out unnecessary complication.
demos/gtk-demo/foreigndrawing.c | 51 +++++++++-----------------------------
1 files changed, 12 insertions(+), 39 deletions(-)
---
diff --git a/demos/gtk-demo/foreigndrawing.c b/demos/gtk-demo/foreigndrawing.c
index db4d246..350829f 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]