[gnome-games] ui: Fix CSS theming
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] ui: Fix CSS theming
- Date: Thu, 12 May 2016 11:57:06 +0000 (UTC)
commit 743827b9686da4f8603429e9a88cd82926e8f77f
Author: Adrien Plazas <kekun plazas laposte net>
Date: Thu May 12 13:53:32 2016 +0200
ui: Fix CSS theming
The way CSS theming works changed in GTK+ 3.20, this updates the custom
theming to accomodate to the new theming style.
Fixes #294
data/gtk-style.css | 7 ++++---
src/ui/collection-icon-view.vala | 4 ++++
src/ui/game-thumbnail.vala | 14 ++++++--------
3 files changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/data/gtk-style.css b/data/gtk-style.css
index 44a8099..fd4c0a1 100644
--- a/data/gtk-style.css
+++ b/data/gtk-style.css
@@ -6,13 +6,14 @@
@define-color games_thumbnail_border_color #3b3c38;
@define-color games_thumbnail_bg_color #2d2d2d;
-GamesCollectionIconView.frame {
+gamescollectioniconview .frame {
background-color: @games_collection_bg_color;
}
-GamesGameThumbnail {
+gamesgamethumbnail {
background-color: @games_thumbnail_bg_color;
- border: 1px;
+ border-width: 1px;
+ border-style: solid;
border-radius: 2px;
border-color: @games_thumbnail_border_color;
color: @games_thumbnail_color;
diff --git a/src/ui/collection-icon-view.vala b/src/ui/collection-icon-view.vala
index 000d540..9e2e4e4 100644
--- a/src/ui/collection-icon-view.vala
+++ b/src/ui/collection-icon-view.vala
@@ -42,6 +42,10 @@ private class Games.CollectionIconView : Gtk.Stack {
[GtkChild]
private Gtk.FlowBox flow_box;
+ static construct {
+ set_css_name ("gamescollectioniconview");
+ }
+
construct {
flow_box.max_children_per_line = uint.MAX;
flow_box.set_filter_func (filter_box);
diff --git a/src/ui/game-thumbnail.vala b/src/ui/game-thumbnail.vala
index ac7f534..2f3d016 100644
--- a/src/ui/game-thumbnail.vala
+++ b/src/ui/game-thumbnail.vala
@@ -35,6 +35,10 @@ private class Games.GameThumbnail: Gtk.DrawingArea {
int height;
}
+ static construct {
+ set_css_name ("gamesgamethumbnail");
+ }
+
public override bool draw (Cairo.Context cr) {
var window = get_window ();
var style = get_style_context ();
@@ -148,17 +152,11 @@ private class Games.GameThumbnail: Gtk.DrawingArea {
}
private void draw_background (DrawingContext context) {
- var color = context.style.get_background_color (context.state);
- context.cr.set_source_rgba (color.red, color.green, color.blue, color.alpha);
- rounded_rectangle (context.cr, 0.5, 0.5, context.width - 1, context.height - 1, FRAME_RADIUS);
- context.cr.fill ();
+ context.style.render_background (context.cr, 0.0, 0.0, context.width, context.height);
}
private void draw_border (DrawingContext context) {
- var color = context.style.get_border_color (context.state);
- context.cr.set_source_rgba (color.red, color.green, color.blue, color.alpha);
- rounded_rectangle (context.cr, 0.5, 0.5, context.width - 1, context.height - 1, FRAME_RADIUS);
- context.cr.stroke ();
+ context.style.render_frame (context.cr, 0.0, 0.0, context.width, context.height);
}
private void rounded_rectangle (Cairo.Context cr, double x, double y, double width, double height,
double radius) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]