[Xfce4-commits] <xfce4-cpufreq-plugin:master> Fix icon size
Florian Rivoal
noreply at xfce.org
Thu Dec 30 18:12:02 CET 2010
Updating branch refs/heads/master
to 5352bc4fccc2ea0e000545005683829fddc4edd9 (commit)
from b87d144af9239e9ff9dc5b154a455afaf7a273ae (commit)
commit 5352bc4fccc2ea0e000545005683829fddc4edd9
Author: Florian Rivoal <frivoal at xfce.org>
Date: Fri Dec 31 02:11:00 2010 +0900
Fix icon size
The icon in the panel was displayed with a inapropriate size, that
wouldn't be adjusted to resizing. Now it works.
panel-plugin/xfce4-cpufreq-plugin.c | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/panel-plugin/xfce4-cpufreq-plugin.c b/panel-plugin/xfce4-cpufreq-plugin.c
index bafb824..8e22eb2 100644
--- a/panel-plugin/xfce4-cpufreq-plugin.c
+++ b/panel-plugin/xfce4-cpufreq-plugin.c
@@ -151,7 +151,18 @@ cpufreq_widgets (void)
if(cpuFreq->options->show_icon)
{
- cpuFreq->icon = gtk_image_new_from_icon_name ("cpu", -1);
+
+ GdkPixbuf *buf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
+ "cpu", size - 8, 0, NULL);
+ if (buf)
+ {
+ cpuFreq->icon = gtk_image_new_from_pixbuf (buf);
+ g_object_unref (G_OBJECT (buf));
+ }
+ else
+ {
+ cpuFreq->icon = gtk_image_new_from_icon_name ("cpu", GTK_ICON_SIZE_BUTTON);
+ }
gtk_box_pack_start (GTK_BOX (box), cpuFreq->icon, FALSE, FALSE, 0);
}
@@ -245,10 +256,7 @@ cpufreq_free (XfcePanelPlugin *plugin)
static gboolean
cpufreq_set_size (XfcePanelPlugin *plugin, gint wsize)
{
- if (xfce_panel_plugin_get_orientation (plugin) == GTK_ORIENTATION_HORIZONTAL)
- gtk_widget_set_size_request (GTK_WIDGET (plugin), -1, wsize);
- else
- gtk_widget_set_size_request (GTK_WIDGET (plugin), wsize, -1);
+ cpufreq_widgets ();
return TRUE;
}
More information about the Xfce4-commits
mailing list