** psensor: added the degree sign before the temperature symbols.
** psensor: alarm limit edition using the temperature unit set in the
global pref.
-** psensor: improved notification (added psensor icon).
+** psensor: improved notification (added psensor icon and value of the
+ sensor).
* v0.6.2.17
return str;
}
+char *
+psensor_measure_to_str(const struct measure *m,
+ unsigned int type,
+ unsigned int use_celcius)
+{
+ return psensor_value_to_str(type, m->value, use_celcius);
+}
+
void psensor_set_current_value(struct psensor *sensor, double value)
{
struct timeval tv;
double value,
int use_celcius);
+char *psensor_measure_to_str(const struct measure *m,
+ unsigned int type,
+ unsigned int use_celcius);
+
struct psensor **get_all_sensors(int use_libatasmart, int values_max_length);
struct psensor **psensor_list_add(struct psensor **sensors,
#define NOTIFY_CHECK_VERSION(x, y, z) 0
#endif
+#include "cfg.h"
#include "ui.h"
#include "ui_notify.h"
void ui_notify(struct psensor *sensor, struct ui_psensor *ui)
{
struct timeval t;
- char *body;
+ char *body, *svalue;
+ const char *summary;
NotifyNotification *notif;
+ unsigned int use_celcius;
log_debug("last_notification %d", last_notification_tv.tv_sec);
notify_init("psensor");
if (notify_is_initted() == TRUE) {
- body = strdup(sensor->name);
+ if (ui->config->temperature_unit == CELCIUS)
+ use_celcius = 1;
+ else
+ use_celcius = 0;
+
+ svalue = psensor_measure_to_str
+ (psensor_get_current_measure(sensor),
+ sensor->type,
+ use_celcius);
+
+ body = malloc(strlen(sensor->name) + 3 + strlen(svalue) + 1);
+ sprintf(body, "%s : %s", sensor->name, svalue);
+ free(svalue);
+
+ if (is_temp_type(sensor->type))
+ summary = _("Temperature alert");
+ else
+ summary = _("N/A");
/*
* Since libnotify 0.7 notify_notification_new has
* only 3 parameters.
*/
#if NOTIFY_CHECK_VERSION(0, 7, 0)
- notif = notify_notification_new
- (_("Temperature alert"), body, PSENSOR_ICON);
+ notif = notify_notification_new(summary, body, PSENSOR_ICON);
#else
- notif = notify_notification_new(_("Temperature alert"),
+ notif = notify_notification_new(summary,
body,
PSENSOR_ICON,
GTK_WIDGET(ui->main_window));