[Xfce4-commits] [panel-plugins/xfce4-genmon-plugin] 01/01: Fix PangoFontDescription not being able to display initial default string
noreply at xfce.org
noreply at xfce.org
Wed Nov 16 04:03:12 CET 2016
This is an automated email from the git hooks/post-receive script.
ToZ pushed a commit to branch master
in repository panel-plugins/xfce4-genmon-plugin.
commit 598f3ca8b88d801272b1a29d92ed875eb520e3f5
Author: ToZ <tony.paulic at gmail.com>
Date: Tue Nov 15 18:51:07 2016 -0500
Fix PangoFontDescription not being able to display initial default string
---
panel-plugin/main.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/panel-plugin/main.c b/panel-plugin/main.c
index 4436bb1..003b0cf 100644
--- a/panel-plugin/main.c
+++ b/panel-plugin/main.c
@@ -311,6 +311,8 @@ static genmon_t *genmon_create_control (XfcePanelPlugin *plugin)
struct param_t *poConf;
struct monitor_t *poMonitor;
GtkOrientation orientation = xfce_panel_plugin_get_orientation (plugin);
+ GtkSettings *settings;
+ gchar *default_font;
#if GTK_CHECK_VERSION (3, 16, 0)
GtkCssProvider *css_provider;
@@ -332,7 +334,16 @@ static genmon_t *genmon_create_control (XfcePanelPlugin *plugin)
poConf->iPeriod_ms = 30 * 1000;
poPlugin->iTimerId = 0;
- poConf->acFont = g_strdup ("(default)");
+ // PangoFontDescription needs a font and we can't use "(Default)" anymore.
+ // Use GtkSettings to get the current default font and use that, or set default to "Sans 10"
+ settings = gtk_settings_get_default();
+ if (g_object_class_find_property(G_OBJECT_GET_CLASS(settings), "gtk-font-name"))
+ {
+ g_object_get(settings, "gtk-font-name", &default_font, NULL);
+ poConf->acFont = g_strdup (default_font);
+ }
+ else
+ poConf->acFont = g_strdup ("Sans 10");
poMonitor->wEventBox = gtk_event_box_new ();
gtk_event_box_set_visible_window (
@@ -440,6 +451,7 @@ static genmon_t *genmon_create_control (XfcePanelPlugin *plugin)
GTK_STYLE_PROVIDER (css_provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_free(css);
+ g_free(default_font);
return poPlugin;
}/* genmon_create_control() */
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list