From 63394a6ddc29eac797bfdd7bbb2c429d4b5ffd9f Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 12 Jun 2017 15:12:22 +0200 Subject: override_font() deprecation warning: replace by GtkCssProvider blocks. Additionally, don't hard-code Cabin font anymore, use font_name gsettings property instead. --- src/dash-button.vala | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/dash-button.vala') diff --git a/src/dash-button.vala b/src/dash-button.vala index 4554dc2..d48ef70 100644 --- a/src/dash-button.vala +++ b/src/dash-button.vala @@ -22,6 +22,10 @@ public class DashButton : FlatButton, Fadable protected FadeTracker fade_tracker { get; protected set; } private Gtk.Label text_label; + public static string font = AGSettings.get_string (AGSettings.KEY_FONT_NAME); + public static string font_family = font.split_set(" ")[0]; + public static int font_size = int.parse(font.split_set(" ")[1]); + private string _text = ""; public string text { @@ -29,16 +33,18 @@ public class DashButton : FlatButton, Fadable set { _text = value; - text_label.set_markup ("%s".printf (value)); + text_label.set_markup ("%s".printf (font_family, font_size+2, value)); } } - public DashButton (string text) { fade_tracker = new FadeTracker (this); var hbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); + if (font_size < 6) + font_size = 6; + /* Add text */ text_label = new Gtk.Label (""); text_label.use_markup = true; -- cgit v1.2.3