[Xfce4-commits] <xfce4-cpufreq-plugin:master> Only warn once about the lack of cpufreq support

Florian Rivoal noreply at xfce.org
Thu Dec 30 19:12:01 CET 2010


Updating branch refs/heads/master
         to f5b204d2590618955f0ead8f9ce672fdeae3ee3b (commit)
       from af547d40dc75cea61097a9fa05053fd7b2e607fc (commit)

commit f5b204d2590618955f0ead8f9ce672fdeae3ee3b
Author: Florian Rivoal <frivoal at xfce.org>
Date:   Fri Dec 31 03:08:50 2010 +0900

    Only warn once about the lack of cpufreq support
    
    Only warn about the lack of cpufreq support when the plugin is first
    added to the panel. On subsequent restart of the same instance, keep quiet.

 panel-plugin/xfce4-cpufreq-linux.c  |    8 +++++++-
 panel-plugin/xfce4-cpufreq-plugin.c |    2 ++
 panel-plugin/xfce4-cpufreq-plugin.h |    1 +
 3 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/panel-plugin/xfce4-cpufreq-linux.c b/panel-plugin/xfce4-cpufreq-linux.c
index c72f1b6..3e83557 100644
--- a/panel-plugin/xfce4-cpufreq-linux.c
+++ b/panel-plugin/xfce4-cpufreq-linux.c
@@ -406,7 +406,13 @@ cpufreq_linux_init (void)
 	else if (g_file_test ("/proc/cpufreq", G_FILE_TEST_EXISTS))
 		return cpufreq_cpu_read_procfs ();
 	else
-	{	xfce_warn (_("Your system does not support cpufreq.\nThe applet only shows the current cpu frequency"));
+	{
+		if (cpuFreq->options->show_warning)
+		{
+			xfce_warn (_("Your system does not support cpufreq.\nThe applet only shows the current cpu frequency"));
+			cpuFreq->options->show_warning = FALSE;
+		}
+
 		return cpufreq_cpu_read_procfs_cpuinfo ();
 	}
 }
diff --git a/panel-plugin/xfce4-cpufreq-plugin.c b/panel-plugin/xfce4-cpufreq-plugin.c
index cc58542..d6ba02a 100644
--- a/panel-plugin/xfce4-cpufreq-plugin.c
+++ b/panel-plugin/xfce4-cpufreq-plugin.c
@@ -202,6 +202,7 @@ cpufreq_read_config (void)
 	cpuFreq->options->show_icon           = xfce_rc_read_bool_entry (rc, "show_icon",  TRUE);
 	cpuFreq->options->show_label_freq     = xfce_rc_read_bool_entry (rc, "show_label_freq", TRUE);
 	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);
 
 	xfce_rc_close (rc);
 }
@@ -226,6 +227,7 @@ cpufreq_write_config (XfcePanelPlugin *plugin)
 	xfce_rc_write_bool_entry (rc, "show_icon",           cpuFreq->options->show_icon);
 	xfce_rc_write_bool_entry (rc, "show_label_freq",     cpuFreq->options->show_label_freq);
 	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_close (rc);
 }
diff --git a/panel-plugin/xfce4-cpufreq-plugin.h b/panel-plugin/xfce4-cpufreq-plugin.h
index 24d3661..d669557 100644
--- a/panel-plugin/xfce4-cpufreq-plugin.h
+++ b/panel-plugin/xfce4-cpufreq-plugin.h
@@ -43,6 +43,7 @@ typedef struct
 	gboolean show_icon;
 	gboolean show_label_governor;
 	gboolean show_label_freq;
+	gboolean show_warning;
 } CpuFreqPluginOptions;
 
 typedef struct



More information about the Xfce4-commits mailing list