From 6f8560319706bacf5a24e2a01de2cdb9d2ae9b35 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Orsini Date: Mon, 9 Apr 2012 11:00:47 +0000 Subject: [PATCH] fahrenheit support for unity launcher --- src/main.c | 3 ++- src/ui_appindicator.c | 2 +- src/ui_unity.c | 11 ++++++++--- src/ui_unity.h | 3 ++- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/main.c b/src/main.c index 8425c34..45e8140 100644 --- a/src/main.c +++ b/src/main.c @@ -224,7 +224,8 @@ gboolean ui_refresh_thread(gpointer data) #ifdef HAVE_UNITY ui_unity_launcher_entry_update(ui->sensors, - !cfg->unity_launcher_count_disabled); + !cfg->unity_launcher_count_disabled, + cfg->temperature_unit == CELCIUS); #endif if (ui->graph_update_interval != cfg->graph_update_interval) { diff --git a/src/ui_appindicator.c b/src/ui_appindicator.c index 77a2991..0a7c346 100644 --- a/src/ui_appindicator.c +++ b/src/ui_appindicator.c @@ -138,7 +138,7 @@ static void update_sensor_menu_item(GtkMenuItem *item, v = psensor_get_current_value(s); - if (!use_celcius) + if (is_temp_type(s->type) && !use_celcius) v = celcius_to_fahrenheit(v); str = g_strdup_printf("%s: %2.f %s", diff --git a/src/ui_unity.c b/src/ui_unity.c index 9e74002..6040fac 100644 --- a/src/ui_unity.c +++ b/src/ui_unity.c @@ -25,8 +25,12 @@ static UnityLauncherEntry *psensor_entry; static unsigned int last_visible = -1; void ui_unity_launcher_entry_update(struct psensor **sensors, - unsigned int show) + unsigned int show, + int use_celcius) { + double v; + + if (!initialized) { psensor_entry = unity_launcher_entry_get_for_desktop_file ("psensor.desktop"); @@ -46,10 +50,11 @@ void ui_unity_launcher_entry_update(struct psensor **sensors, } if (sensors && *sensors) { - double v; - v = psensor_get_max_current_value(sensors, SENSOR_TYPE_TEMP); + if (!use_celcius) + v = celcius_to_fahrenheit(v); + unity_launcher_entry_set_count(psensor_entry, v); } } diff --git a/src/ui_unity.h b/src/ui_unity.h index 9926c1d..ce42d87 100644 --- a/src/ui_unity.h +++ b/src/ui_unity.h @@ -22,6 +22,7 @@ #include "psensor.h" void ui_unity_launcher_entry_update(struct psensor **sensors, - unsigned int show); + unsigned int show, + int use_celcius); #endif -- 2.7.4