fahrenheit support for unity launcher
authorJean-Philippe Orsini <jeanfi@gmail.com>
Mon, 9 Apr 2012 11:00:47 +0000 (11:00 +0000)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Mon, 9 Apr 2012 11:00:47 +0000 (11:00 +0000)
src/main.c
src/ui_appindicator.c
src/ui_unity.c
src/ui_unity.h

index 8425c34..45e8140 100644 (file)
@@ -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) {
index 77a2991..0a7c346 100644 (file)
@@ -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",
index 9e74002..6040fac 100644 (file)
@@ -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);
        }
 }
index 9926c1d..ce42d87 100644 (file)
@@ -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