From 5e05c763b2f1c1800957af688cd85ba107df0919 Mon Sep 17 00:00:00 2001 From: Bruce Cowan <bruce@bcowan.me.uk> Date: Mon, 18 Feb 2013 00:35:08 +0000 Subject: [PATCH] Some theming changes --- rugby-cell-renderer-score.c | 32 ++++++++++++++------------------ rugby.css | 21 ++++++--------------- 2 files changed, 20 insertions(+), 33 deletions(-) diff --git a/rugby-cell-renderer-score.c b/rugby-cell-renderer-score.c index d7dbcc7..7459dee 100644 --- a/rugby-cell-renderer-score.c +++ b/rugby-cell-renderer-score.c @@ -17,9 +17,9 @@ struct _RugbyCellRendererScorePrivate }; /* Style classes for the different types of score */ -#define RUGBY_STYLE_CLASS_TRY "try" -#define RUGBY_STYLE_CLASS_UTRY "utry" -#define RUGBY_STYLE_CLASS_KICK "kick" +#define RUGBY_STYLE_CLASS_TRY "score-try" +#define RUGBY_STYLE_CLASS_UTRY "score-utry" +#define RUGBY_STYLE_CLASS_KICK "score-kick" G_DEFINE_TYPE (RugbyCellRendererScore, rugby_cell_renderer_score, GTK_TYPE_CELL_RENDERER) @@ -136,7 +136,7 @@ render_bar (GtkStyleContext *context, break; } - gtk_render_activity (context, cr, x, y, width, height); + gtk_render_background (context, cr, x, y, width, height); gtk_style_context_restore (context); } @@ -153,7 +153,7 @@ rugby_cell_renderer_score_render (GtkCellRenderer *cell, GtkStyleContext *context; gint xpad, ypad; gdouble x, y, total_w, w, h; - GtkBorder padding, border; + GtkBorder border; gint tries, utries, kicks; gint total; gint i; @@ -166,29 +166,25 @@ rugby_cell_renderer_score_render (GtkCellRenderer *cell, total_w = cell_area->width - xpad * 2; h = cell_area->height - ypad * 2; + //gtk_style_context_add_class (context, GTK_STYLE_CLASS_PROGRESSBAR); gtk_style_context_save (context); - gtk_style_context_add_class (context, GTK_STYLE_CLASS_TROUGH); + gtk_style_context_add_class (context, "level-cell"); gtk_render_background (context, cr, x, y, total_w, h); gtk_render_frame (context, cr, x, y, total_w, h); - gtk_style_context_get_border (context, GTK_STATE_FLAG_NORMAL, &border); - gtk_style_context_get_padding (context, GTK_STATE_FLAG_NORMAL, &padding); - - x += border.left + padding.left; - y += border.top + padding.top; - total_w -= border.left + border.right + padding.left + padding.right; - h -= border.top + border.bottom + padding.top + padding.bottom; - - gtk_style_context_restore (context); - tries = priv->tries; utries = priv->utries; kicks = priv->kicks; total = tries * TRY_POINTS + utries * UTRY_POINTS + kicks * KICK_POINTS; - gtk_style_context_save (context); - gtk_style_context_add_class (context, GTK_STYLE_CLASS_PROGRESSBAR); + gtk_style_context_get_border (context, GTK_STATE_FLAG_NORMAL, &border); + x += border.left; + y += border.top; + total_w -= border.left + border.right; + h -= border.top + border.bottom; + + gtk_style_context_add_class (context, "fill-block"); w = total_w / (total / 7.0); for (i = 0; i < tries; i++) diff --git a/rugby.css b/rugby.css index 3966dc1..9410eb1 100644 --- a/rugby.css +++ b/rugby.css @@ -1,26 +1,17 @@ -.try +.cell.level-cell.fill-block.score-try { /* Scarlet red */ - background-image: -gtk-gradient (linear, - left top, left bottom, - from (#ef2929), - to (#a40000)); + background-color: #cc0000; } -.utry +.cell.level-cell.fill-block.score-utry { /* Chameleon */ - background-image: -gtk-gradient (linear, - left top, left bottom, - from (#8ae234), - to (#4e9a06)); + background-color: #edd400; } -.kick +.cell.level-cell.fill-block.score-kick { /* Butter */ - background-image: -gtk-gradient (linear, - left top, left bottom, - from (#fce94f), - to (#c4a000)); + background-color: #73d216; } -- GitLab