[Xfce4-commits] <xfce4-sensors-plugin:master> - remember font size both for plugin and stand-alone app - allow chosing the font size before having widgets use it
Fabian
noreply at xfce.org
Sun Mar 28 21:14:04 CEST 2010
Updating branch refs/heads/master
to a52554d7c96ff9785883b7c78421658ec7ffc002 (commit)
from 434f4a6fcf425ad209ada153cc41568b6e9ed985 (commit)
commit a52554d7c96ff9785883b7c78421658ec7ffc002
Author: Fabian <timystery at arcor.de>
Date: Sun Mar 28 20:27:52 2010 +0200
- remember font size both for plugin and stand-alone app
- allow chosing the font size before having widgets use it
include/sensors-interface-common.h | 3 ++-
lib/configuration.c | 7 +++++++
lib/cpu.c | 5 +++--
panel-plugin/sensors-plugin.c | 4 ++++
src/callbacks.c | 7 +++++--
5 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/include/sensors-interface-common.h b/include/sensors-interface-common.h
index 012678f..0013549 100644
--- a/include/sensors-interface-common.h
+++ b/include/sensors-interface-common.h
@@ -89,8 +89,9 @@ typedef struct {
gint timeout_id;
/* font size for display in panel */
- gchar* font_size;
+ gchar *font_size;
gint font_size_numerical;
+ gchar *font;
/* temperature scale for display in panel */
t_tempscale scale;
diff --git a/lib/configuration.c b/lib/configuration.c
index 18101b7..f2a0a8b 100644
--- a/lib/configuration.c
+++ b/lib/configuration.c
@@ -34,6 +34,7 @@
/* Package includes */
#include <configuration.h>
+#include <cpu.h>
#include <sensors-interface.h>
#include <types.h>
@@ -106,6 +107,8 @@ sensors_write_config (XfcePanelPlugin *plugin, t_sensors *sensors)
xfce_rc_write_int_entry (rc, "Font_Size_Numerical",
sensors->font_size_numerical);
+ xfce_rc_write_entry (rc, "Font", font);
+
xfce_rc_write_int_entry (rc, "Lines_Size", sensors->lines_size);
xfce_rc_write_int_entry (rc, "Update_Interval", sensors->sensors_refresh_time);
@@ -208,6 +211,10 @@ sensors_read_general_config (XfceRc *rc, t_sensors *sensors)
if ((value = xfce_rc_read_entry (rc, "Font_Size", NULL)) && *value) {
sensors->font_size = g_strdup(value);
}
+
+ if ((value = xfce_rc_read_entry (rc, "Font", NULL)) && *value) {
+ font = g_strdup(value);
+ }
sensors->font_size_numerical = xfce_rc_read_int_entry (rc,
"Font_Size_Numerical", 2);
diff --git a/lib/cpu.c b/lib/cpu.c
index f27bab3..93cf573 100644
--- a/lib/cpu.c
+++ b/lib/cpu.c
@@ -47,7 +47,7 @@ static void gtk_cpu_destroy(GtkObject *object);
//extern gchar *font;
-gchar *font;
+gchar *font = NULL;
GtkType
@@ -165,7 +165,8 @@ gtk_cpu_class_init (GtkCpuClass *klass)
object_class->destroy = gtk_cpu_destroy;
- font = g_strdup("Sans 12");
+ if (font==NULL)
+ font = g_strdup("Sans 12");
TRACE("leave gtk_cpu_class_init\n");
}
diff --git a/panel-plugin/sensors-plugin.c b/panel-plugin/sensors-plugin.c
index 0536941..fccefed 100644
--- a/panel-plugin/sensors-plugin.c
+++ b/panel-plugin/sensors-plugin.c
@@ -2297,6 +2297,10 @@ sensors_plugin_construct (XfcePanelPlugin *plugin)
sensors->plugin_config_file = xfce_panel_plugin_lookup_rc_file(plugin);
sensors_read_config (plugin, sensors);
+
+ //if (font)
+ //g_free (font);
+ //font = g_strdup(sensors->font);
/* Try to resize the sensors to fit the user settings.
Do also modify the tooltip text. */
diff --git a/src/callbacks.c b/src/callbacks.c
index 5a98467..fa87b39 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -40,8 +40,11 @@
void on_font_set (GtkWidget *widget, gpointer data)
{
- font = g_strdup(gtk_font_button_get_font_name(GTK_FONT_BUTTON(widget)));
- refresh_view(data); /* data is pointer to sensors_dialog */
+ if (font!=NULL)
+ g_free (font);
+
+ font = g_strdup(gtk_font_button_get_font_name(GTK_FONT_BUTTON(widget)));
+ refresh_view(data); /* data is pointer to sensors_dialog */
}
More information about the Xfce4-commits
mailing list