[Xfce4-commits] <xfce4-cpufreq-plugin:master> Support showing icon only (bug #7474).
Harald Judt
noreply at xfce.org
Tue Aug 20 20:26:03 CEST 2013
Updating branch refs/heads/master
to 406dd2e9872a64a883aca80d8727587688926e20 (commit)
from 8e98219a76463e3634a75214d70c857c8ac5cb85 (commit)
commit 406dd2e9872a64a883aca80d8727587688926e20
Author: Harald Judt <h.judt at gmx.at>
Date: Tue Aug 20 18:54:47 2013 +0200
Support showing icon only (bug #7474).
panel-plugin/xfce4-cpufreq-configure.c | 14 ++++++++++++--
panel-plugin/xfce4-cpufreq-plugin.c | 8 +++++++-
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/panel-plugin/xfce4-cpufreq-configure.c b/panel-plugin/xfce4-cpufreq-configure.c
index 6b9924c..56939f7 100644
--- a/panel-plugin/xfce4-cpufreq-configure.c
+++ b/panel-plugin/xfce4-cpufreq-configure.c
@@ -57,10 +57,18 @@ check_button_changed (GtkWidget *button, CpuFreqPluginConfigure *configure)
cpufreq_update_icon (cpuFreq);
}
- else if (button == configure->one_line) {
+ else if (button == configure->one_line)
cpuFreq->options->one_line =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
- }
+
+ if (!cpuFreq->options->show_label_freq &&
+ !cpuFreq->options->show_label_governor) {
+ if (!cpuFreq->options->show_icon)
+ gtk_toggle_button_set_active
+ (GTK_TOGGLE_BUTTON (configure->display_icon), TRUE);
+ gtk_widget_set_sensitive (configure->display_icon, FALSE);
+ } else
+ gtk_widget_set_sensitive (configure->display_icon, TRUE);
cpuFreq->layout_changed = TRUE;
cpufreq_update_plugin ();
@@ -305,6 +313,8 @@ cpufreq_configure (XfcePanelPlugin *plugin)
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), cpuFreq->options->show_icon);
g_signal_connect (G_OBJECT (button), "toggled", G_CALLBACK (check_button_changed), configure);
+ if (!cpuFreq->options->show_label_freq && !cpuFreq->options->show_label_governor)
+ gtk_widget_set_sensitive (configure->display_icon, FALSE);
button = configure->display_freq = gtk_check_button_new_with_mnemonic (_("Show CPU fre_quency"));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
diff --git a/panel-plugin/xfce4-cpufreq-plugin.c b/panel-plugin/xfce4-cpufreq-plugin.c
index 5a3836c..054fe37 100644
--- a/panel-plugin/xfce4-cpufreq-plugin.c
+++ b/panel-plugin/xfce4-cpufreq-plugin.c
@@ -120,8 +120,11 @@ cpufreq_update_label (CpuInfo *cpu)
gint size, both;
if (!cpuFreq->options->show_label_governor &&
- !cpuFreq->options->show_label_freq)
+ !cpuFreq->options->show_label_freq) {
+ if (cpuFreq->label != NULL)
+ gtk_widget_hide (cpuFreq->label);
return TRUE;
+ }
both = cpu->cur_governor != NULL &&
cpuFreq->options->show_label_freq &&
@@ -472,6 +475,9 @@ cpufreq_read_config (void)
cpuFreq->options->keep_compact = xfce_rc_read_bool_entry (rc, "keep_compact", FALSE);
cpuFreq->options->one_line = xfce_rc_read_bool_entry (rc, "one_line", FALSE);
+ if (!cpuFreq->options->show_label_freq && !cpuFreq->options->show_label_governor)
+ cpuFreq->options->show_icon = TRUE;
+
value = xfce_rc_read_entry (rc, "fontname", NULL);
if (value) {
g_free (cpuFreq->options->fontname);
More information about the Xfce4-commits
mailing list