summaryrefslogtreecommitdiff
path: root/battstat
diff options
context:
space:
mode:
authorrbuj <[email protected]>2021-12-13 23:18:26 +0100
committerVictor Kareh <[email protected]>2022-03-22 16:25:09 -0400
commitb3892cf644c693fef44b5daf55a0b66a667ac147 (patch)
tree4d1acd062b9b7adc49239036cfe156444c88374c /battstat
parent0685093d85f70823d71397e35f3c2acf09a0c083 (diff)
downloadmate-applets-b3892cf644c693fef44b5daf55a0b66a667ac147.tar.bz2
mate-applets-b3892cf644c693fef44b5daf55a0b66a667ac147.tar.xz
Fix some -Wfloat-conversion warnings
Diffstat (limited to 'battstat')
-rw-r--r--battstat/battstat-preferences.c7
-rw-r--r--battstat/battstat_applet.c7
2 files changed, 9 insertions, 5 deletions
diff --git a/battstat/battstat-preferences.c b/battstat/battstat-preferences.c
index 40d38f42..88f93919 100644
--- a/battstat/battstat-preferences.c
+++ b/battstat/battstat-preferences.c
@@ -91,15 +91,16 @@ spin_ptr_cb (GtkWidget *spin_ptr,
gpointer data)
{
BattstatPreferences *dialog = data;
+ gdouble red_val = gtk_spin_button_get_value (GTK_SPIN_BUTTON (spin_ptr));
- dialog->battstat->red_val = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spin_ptr));
+ dialog->battstat->red_val = (guint) red_val;
/* automatically calculate orangle and yellow values from the
* red value
*/
- dialog->battstat->orange_val = dialog->battstat->red_val * ORANGE_MULTIPLIER;
+ dialog->battstat->orange_val = (guint) (ORANGE_MULTIPLIER * red_val);
dialog->battstat->orange_val = MIN (dialog->battstat->orange_val, 100);
- dialog->battstat->yellow_val = dialog->battstat->red_val * YELLOW_MULTIPLIER;
+ dialog->battstat->yellow_val = (guint) (YELLOW_MULTIPLIER * red_val);
dialog->battstat->yellow_val = MIN (dialog->battstat->yellow_val, 100);
g_settings_set_int (dialog->battstat->settings,
diff --git a/battstat/battstat_applet.c b/battstat/battstat_applet.c
index 3382a540..99bdedfa 100644
--- a/battstat/battstat_applet.c
+++ b/battstat/battstat_applet.c
@@ -925,6 +925,7 @@ static void
load_preferences (ProgressData *battstat)
{
GSettings *settings = battstat->settings;
+ gdouble red_val;
if (DEBUG) g_print ("load_preferences ()\n");
@@ -933,10 +934,12 @@ load_preferences (ProgressData *battstat)
battstat->red_value_is_time = g_settings_get_boolean (settings, "red-value-is-time");
/* automatically calculate orangle and yellow values from the red value */
- battstat->orange_val = battstat->red_val * ORANGE_MULTIPLIER;
+ red_val = (gdouble) battstat->red_val;
+
+ battstat->orange_val = (guint) (ORANGE_MULTIPLIER * red_val);
battstat->orange_val = MIN (battstat->orange_val, 100);
- battstat->yellow_val = battstat->red_val * YELLOW_MULTIPLIER;
+ battstat->yellow_val = (guint) (YELLOW_MULTIPLIER * red_val);
battstat->yellow_val = MIN (battstat->yellow_val, 100);
battstat->lowbattnotification = g_settings_get_boolean (settings, "low-battery-notification");