[baobab] Do not use deprecated GtkStyleContext methods
- From: Stefano Facchini <sfacchini src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [baobab] Do not use deprecated GtkStyleContext methods
- Date: Wed, 10 Jun 2020 12:51:45 +0000 (UTC)
commit 9da230fdb63c1c1792a506b46475c7b72c6155ca
Author: Stefano Facchini <stefano facchini gmail com>
Date: Wed Jun 10 14:51:19 2020 +0200
Do not use deprecated GtkStyleContext methods
src/baobab-ringschart.vala | 11 ++++++-----
src/baobab-treemap.vala | 14 ++++++--------
src/baobab.css | 7 ++++++-
3 files changed, 18 insertions(+), 14 deletions(-)
---
diff --git a/src/baobab-ringschart.vala b/src/baobab-ringschart.vala
index 6fe2841..0a80067 100644
--- a/src/baobab-ringschart.vala
+++ b/src/baobab-ringschart.vala
@@ -198,7 +198,8 @@ namespace Baobab {
cr.rectangle (tooltip_rect.x + tooltip_rect.width, tooltip_rect.y, -tooltip_rect.width,
tooltip_rect.height);
cr.clip ();
- var bg_color = context.get_background_color (context_state);
+ Gdk.RGBA bg_color;
+ context.lookup_color ("tooltip_bg_color", out bg_color);
cr.set_line_width (1);
cr.move_to (sector_center_x, sector_center_y);
Gdk.cairo_set_source_rgba (cr, bg_color);
@@ -239,14 +240,14 @@ namespace Baobab {
get_allocation (out allocation);
var context = get_style_context ();
- var context_state = context.get_state ();
context.save ();
var toplevel_context = get_toplevel ().get_style_context ();
- var toplevel_context_state = toplevel_context.get_state ();
- var border_color = context.get_border_color (context_state);
- var bg_color = toplevel_context.get_background_color (toplevel_context_state);
+ Gdk.RGBA border_color;
+ context.lookup_color ("chart_borders", out border_color);
+ Gdk.RGBA bg_color;
+ toplevel_context.lookup_color ("theme_bg_color", out bg_color);
var center_x = allocation.width / 2;
var center_y = allocation.height / 2;
diff --git a/src/baobab-treemap.vala b/src/baobab-treemap.vala
index 6db9fcf..4a63542 100644
--- a/src/baobab-treemap.vala
+++ b/src/baobab-treemap.vala
@@ -34,6 +34,10 @@ namespace Baobab {
public class Treemap : Chart {
+ static construct {
+ set_css_name ("treemap");
+ }
+
const int ITEM_BORDER_WIDTH = 1;
const int ITEM_PADDING = 6;
const int ITEM_TEXT_PADDING = 3;
@@ -59,16 +63,12 @@ namespace Baobab {
uint border = ITEM_BORDER_WIDTH;
var context = get_style_context ();
- context.save ();
- context.set_state (Gtk.StateFlags.NORMAL);
cr.set_line_width (border);
cr.rectangle (x + border, y + border, width - border * 2, height - border * 2);
Gdk.cairo_set_source_rgba (cr, fill_color);
- cr.fill_preserve ();
- var border_color = context.get_border_color (context.get_state ());
- Gdk.cairo_set_source_rgba (cr, border_color);
- cr.stroke ();
+ cr.fill ();
+ context.render_frame (cr, x + 0.5, y + 0.5, width - 1, height - 1);
if (show_text) {
var layout = create_pango_layout (null);
@@ -83,8 +83,6 @@ namespace Baobab {
context.render_layout (cr, x + width / 2 - rect.width / 2, y + height / 2 - rect.height
/ 2, layout);
}
}
-
- context.restore ();
}
protected override void draw_item (Cairo.Context cr, ChartItem item, bool highlighted) {
diff --git a/src/baobab.css b/src/baobab.css
index 776a918..b246959 100644
--- a/src/baobab.css
+++ b/src/baobab.css
@@ -65,14 +65,19 @@ window infobar.error {
border-bottom-color: @borders;
}
+@define-color chart_borders darker(@borders);
ringschart {
padding: 13px 13px 13px 13px;
}
+@define-color tooltip_bg_color rgba(0, 0, 0, 0.8);
ringschart.subfolder-tip {
color: white;
- background-color: rgba(0, 0, 0, 0.8);
+ background-color: @tooltip_bg_color;
border-radius: 3px;
padding: 3px 3px 3px 3px;
}
+treemap {
+ border: solid 1px @chart_borders;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]