[Xfce4-commits] <xfce4-cpufreq-plugin:master> Add option to keep text in one line.
Harald Judt
noreply at xfce.org
Sun Aug 18 11:32:35 CEST 2013
Updating branch refs/heads/master
to 3e4d258e613679b5effdfb60b7109b6d6893af10 (commit)
from a16a636d61e86a803536066d7fbdb3577b218743 (commit)
commit 3e4d258e613679b5effdfb60b7109b6d6893af10
Author: Harald Judt <h.judt at gmx.at>
Date: Sun Aug 18 09:42:02 2013 +0200
Add option to keep text in one line.
This can be useful in single-row panel configurations, when you don't
want to shrink the text too much.
panel-plugin/xfce4-cpufreq-configure.c | 10 ++++++++++
panel-plugin/xfce4-cpufreq-configure.h | 1 +
panel-plugin/xfce4-cpufreq-plugin.c | 4 +++-
panel-plugin/xfce4-cpufreq-plugin.h | 1 +
4 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/panel-plugin/xfce4-cpufreq-configure.c b/panel-plugin/xfce4-cpufreq-configure.c
index 57afe43..bfff760 100644
--- a/panel-plugin/xfce4-cpufreq-configure.c
+++ b/panel-plugin/xfce4-cpufreq-configure.c
@@ -61,6 +61,11 @@ check_button_changed (GtkWidget *button, CpuFreqPluginConfigure *configure)
cpufreq_update_icon (cpuFreq);
}
+ else if (button == configure->one_line) {
+ cpuFreq->options->one_line =
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
+ }
+
cpuFreq->layout_changed = TRUE;
cpufreq_update_plugin ();
}
@@ -295,6 +300,11 @@ cpufreq_configure (XfcePanelPlugin *plugin)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), cpuFreq->options->keep_compact);
g_signal_connect (G_OBJECT (button), "toggled", G_CALLBACK (check_button_changed), configure);
+ button = configure->one_line = gtk_check_button_new_with_mnemonic (_("Show text in a single _line"));
+ gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), cpuFreq->options->one_line);
+ g_signal_connect (G_OBJECT (button), "toggled", G_CALLBACK (check_button_changed), configure);
+
button = configure->display_icon = gtk_check_button_new_with_mnemonic (_("Show CPU _icon"));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), cpuFreq->options->show_icon);
diff --git a/panel-plugin/xfce4-cpufreq-configure.h b/panel-plugin/xfce4-cpufreq-configure.h
index edddbaf..3ea3f43 100644
--- a/panel-plugin/xfce4-cpufreq-configure.h
+++ b/panel-plugin/xfce4-cpufreq-configure.h
@@ -32,6 +32,7 @@ typedef struct
GtkWidget *combo_cpu;
GtkWidget *spinner_timeout;
GtkWidget *keep_compact;
+ GtkWidget *one_line;
GtkWidget *fontname;
} CpuFreqPluginConfigure;
diff --git a/panel-plugin/xfce4-cpufreq-plugin.c b/panel-plugin/xfce4-cpufreq-plugin.c
index 0cce335..6874838 100644
--- a/panel-plugin/xfce4-cpufreq-plugin.c
+++ b/panel-plugin/xfce4-cpufreq-plugin.c
@@ -130,7 +130,7 @@ cpufreq_update_label (CpuInfo *cpu)
freq = cpufreq_get_human_readable_freq (cpu->cur_freq);
label = g_strconcat
(cpuFreq->options->show_label_freq ? freq : "",
- both ? "\n" : "",
+ both ? (cpuFreq->options->one_line ? " " : "\n") : "",
cpu->cur_governor != NULL &&
cpuFreq->options->show_label_governor ? cpu->cur_governor : "",
NULL);
@@ -454,6 +454,7 @@ cpufreq_read_config (void)
cpuFreq->options->show_label_governor = xfce_rc_read_bool_entry (rc, "show_label_governor", TRUE);
cpuFreq->options->show_warning = xfce_rc_read_bool_entry (rc, "show_warning", TRUE);
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);
value = xfce_rc_read_entry (rc, "fontname", NULL);
if (value) {
@@ -485,6 +486,7 @@ cpufreq_write_config (XfcePanelPlugin *plugin)
xfce_rc_write_bool_entry (rc, "show_label_governor", cpuFreq->options->show_label_governor);
xfce_rc_write_bool_entry (rc, "show_warning", cpuFreq->options->show_warning);
xfce_rc_write_bool_entry (rc, "keep_compact", cpuFreq->options->keep_compact);
+ xfce_rc_write_bool_entry (rc, "one_line", cpuFreq->options->one_line);
if (cpuFreq->options->fontname)
xfce_rc_write_entry (rc, "fontname", cpuFreq->options->fontname);
diff --git a/panel-plugin/xfce4-cpufreq-plugin.h b/panel-plugin/xfce4-cpufreq-plugin.h
index 8e4f232..e955d0d 100644
--- a/panel-plugin/xfce4-cpufreq-plugin.h
+++ b/panel-plugin/xfce4-cpufreq-plugin.h
@@ -59,6 +59,7 @@ typedef struct
gboolean show_label_freq;
gboolean show_warning;
gboolean keep_compact;
+ gboolean one_line;
gchar *fontname;
} CpuFreqPluginOptions;
More information about the Xfce4-commits
mailing list