diff -ru xfce4-cpu-freq-plugin-0.0.1.orig/panel-plugin/cpu-freq-dialogs.c xfce4-cpu-freq-plugin-0.0.1/panel-plugin/cpu-freq-dialogs.c --- xfce4-cpu-freq-plugin-0.0.1.orig/panel-plugin/cpu-freq-dialogs.c 2006-08-20 13:52:41.000000000 +0200 +++ xfce4-cpu-freq-plugin-0.0.1/panel-plugin/cpu-freq-dialogs.c 2009-04-02 13:31:05.246335908 +0200 @@ -21,11 +21,6 @@ #include #endif -#define BORDER 4 -#define TIMEOUT_MIN 0.5 -#define TIMEOUT_MAX 3 -#define TIMEOUT_STEP 0.5 - #include "cpu-freq-plugin.h" #include "cpu-freq-dialogs.h" @@ -67,8 +62,7 @@ static void spinner_changed (GtkWidget *spinner, CpuFreqPluginConfigure *configure) { - gdouble timeout = gtk_spin_button_get_value (spinner); - timeout *= 100; + guint timeout = gtk_spin_button_get_value_as_int (spinner); cpuFreq->options->monitor_timeout = timeout; cpu_freq_restart_monitor_timeout_handle (); } @@ -148,7 +142,7 @@ TIMEOUT_MAX, TIMEOUT_STEP); gtk_spin_button_set_value (spinner, - (gdouble)cpuFreq->options->monitor_timeout / 100); + (gdouble)cpuFreq->options->monitor_timeout); gtk_box_pack_start (GTK_BOX (hbox), spinner, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(spinner), "value-changed", diff -ru xfce4-cpu-freq-plugin-0.0.1.orig/panel-plugin/cpu-freq-dialogs.h xfce4-cpu-freq-plugin-0.0.1/panel-plugin/cpu-freq-dialogs.h --- xfce4-cpu-freq-plugin-0.0.1.orig/panel-plugin/cpu-freq-dialogs.h 2006-08-20 13:52:41.000000000 +0200 +++ xfce4-cpu-freq-plugin-0.0.1/panel-plugin/cpu-freq-dialogs.h 2009-04-02 13:23:31.441335564 +0200 @@ -29,6 +29,11 @@ } CpuFreqPluginConfigure; +#define BORDER 4 +#define TIMEOUT_MIN 1 +#define TIMEOUT_MAX 9 +#define TIMEOUT_STEP 1 + G_BEGIN_DECLS void diff -ru xfce4-cpu-freq-plugin-0.0.1.orig/panel-plugin/cpu-freq-plugin.c xfce4-cpu-freq-plugin-0.0.1/panel-plugin/cpu-freq-plugin.c --- xfce4-cpu-freq-plugin-0.0.1.orig/panel-plugin/cpu-freq-plugin.c 2006-08-20 13:52:41.000000000 +0200 +++ xfce4-cpu-freq-plugin-0.0.1/panel-plugin/cpu-freq-plugin.c 2009-04-02 13:25:49.864335649 +0200 @@ -29,7 +29,6 @@ #include "cpu-freq-dialogs.h" #include "cpu-freq-overview.h" -#define BORDER 4 #define SPACING 2 #define SMALL_PANEL_SIZE 34 @@ -234,7 +233,7 @@ cpu_freq_restart_monitor_timeout_handle (void) { g_source_remove (cpuFreq->timeoutHandle); - cpuFreq->timeoutHandle = g_timeout_add ( + cpuFreq->timeoutHandle = gtr_timeout_add_seconds ( cpuFreq->options->monitor_timeout, (GSourceFunc) file_modified, NULL); @@ -254,7 +253,7 @@ gboolean status; gint i; status = cpu_freq_start_monitor_timeout (); - cpuFreq->timeoutHandle = g_timeout_add ( + cpuFreq->timeoutHandle = gtr_timeout_add_seconds ( cpuFreq->options->monitor_timeout, (GSourceFunc) file_modified, NULL); @@ -278,7 +277,10 @@ cpuFreq->options->cpu_number = xfce_rc_read_int_entry (rc, "cpu_number", 0); cpuFreq->options->monitor_timeout = - xfce_rc_read_int_entry (rc, "monitor_timeout", 100); + xfce_rc_read_int_entry (rc, "monitor_timeout", 1); + if (cpuFreq->options->monitor_timeout > TIMEOUT_MAX || + cpuFreq->options->monitor_timeout < TIMEOUT_MIN) + cpuFreq->options->monitor_timeout = TIMEOUT_MIN; cpuFreq->options->show_icon = xfce_rc_read_bool_entry (rc, "show_icon", TRUE); cpuFreq->options->show_label_freq = @@ -394,4 +396,16 @@ G_CALLBACK (cpu_freq_configure), NULL); } +guint +gtr_timeout_add_seconds(guint interval, + GSourceFunc function, + gpointer data) +{ + #if GLIB_CHECK_VERSION( 2,14,0 ) + return g_timeout_add_seconds(interval, function, data); + #else + return g_timeout_add(interval*1000, function, data); + #endif +} + XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL (cpu_freq_construct); diff -ru xfce4-cpu-freq-plugin-0.0.1.orig/panel-plugin/cpu-freq-plugin.h xfce4-cpu-freq-plugin-0.0.1/panel-plugin/cpu-freq-plugin.h --- xfce4-cpu-freq-plugin-0.0.1.orig/panel-plugin/cpu-freq-plugin.h 2006-08-20 13:52:41.000000000 +0200 +++ xfce4-cpu-freq-plugin-0.0.1/panel-plugin/cpu-freq-plugin.h 2009-04-02 12:15:54.554335865 +0200 @@ -78,6 +78,11 @@ void cpu_freq_restart_monitor_timeout_handle (void); +guint +gtr_timeout_add_seconds(guint interval, + GSourceFunc function, + gpointer data); + G_END_DECLS #endif /* _CPU_FREQ_H */