From: Jean-Philippe Orsini Date: Tue, 9 Sep 2014 06:33:32 +0000 (+0200) Subject: fixed nvidia fan values display. X-Git-Tag: v1.1.2~121 X-Git-Url: https://git.wpitchoune.net/gitweb/?p=psensor.git;a=commitdiff_plain;h=5f275b753e5b28de21690bd9bacb53262e59c58a fixed nvidia fan values display. added support of alarm for sensors expressed as percent. --- diff --git a/NEWS b/NEWS index 2bf623e..faba488 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,7 @@ v1.1.2 * Added 'Hide' menu item in the contextual menu of the list of sensors. * Added free memory support. +* Added alarm support of sensors expressed as percent. v1.1.1 ------ diff --git a/NEWS.html b/NEWS.html index 6c70496..7996419 100644 --- a/NEWS.html +++ b/NEWS.html @@ -437,6 +437,11 @@ Added Hide menu item in the contextual menu of the list of Added free memory support.

+
  • +

    +Added alarm support of sensors expressed as percent. +

    +
  • @@ -2789,7 +2794,7 @@ Fixed BR1: crash when no temperature sensor is available

    diff --git a/src/graph.c b/src/graph.c index dd367f6..578ad73 100644 --- a/src/graph.c +++ b/src/graph.c @@ -361,7 +361,7 @@ graph_update(struct psensor **sensors, struct psensor *s = *sensor_cur; no_graphs = 0; - if (is_fan_type(s->type)) { + if (s->type & SENSOR_TYPE_RPM) { min = min_rpm; max = max_rpm; } else if (s->type & SENSOR_TYPE_PERCENT) { @@ -391,7 +391,6 @@ graph_update(struct psensor **sensors, cr_pixmap = gdk_cairo_create(gtk_widget_get_window(w_graph)); if (cr_pixmap) { - if (config->alpha_channel_enabled) cairo_set_operator(cr_pixmap, CAIRO_OPERATOR_SOURCE); diff --git a/src/lib/psensor.c b/src/lib/psensor.c index badd6d6..c37dc58 100644 --- a/src/lib/psensor.c +++ b/src/lib/psensor.c @@ -224,11 +224,6 @@ int is_temp_type(unsigned int type) return type & SENSOR_TYPE_TEMP; } -int is_fan_type(unsigned int type) -{ - return type & SENSOR_TYPE_FAN; -} - char * psensor_value_to_str(unsigned int type, double value, int use_celsius) { @@ -507,9 +502,9 @@ const char *psensor_type_to_unit_str(unsigned int type, int use_celsius) return "\302\260C"; else return "\302\260F"; - } else if (is_fan_type(type)) { + } else if (type & SENSOR_TYPE_RPM) { return _("RPM"); - } else if (type & SENSOR_TYPE_CPU_USAGE) { + } else if (type & SENSOR_TYPE_PERCENT) { return _("%"); } else { return _("N/A"); diff --git a/src/lib/psensor.h b/src/lib/psensor.h index 3d1013b..99e4c91 100644 --- a/src/lib/psensor.h +++ b/src/lib/psensor.h @@ -153,7 +153,6 @@ struct psensor *psensor_list_get_by_id(struct psensor **sensors, int psensor_list_contains_type(struct psensor **sensors, unsigned int type); int is_temp_type(unsigned int type); -int is_fan_type(unsigned int type); double get_min_temp(struct psensor **sensors); double get_max_temp(struct psensor **sensors); diff --git a/src/main.c b/src/main.c index e9b10b2..98fc729 100644 --- a/src/main.c +++ b/src/main.c @@ -294,13 +294,8 @@ associate_cb_alarm_raised(struct psensor **sensors, struct ui_psensor *ui) s->alarm_low_threshold = config_get_sensor_alarm_low_threshold(s->id); - if (is_temp_type(s->type) || is_fan_type(s->type)) { - s->alarm_enabled + s->alarm_enabled = config_get_sensor_alarm_enabled(s->id); - } else { - s->alarm_high_threshold = 0; - s->alarm_enabled = 0; - } sensor_cur++; } diff --git a/src/ui_appindicator.c b/src/ui_appindicator.c index c8887c2..84483cd 100644 --- a/src/ui_appindicator.c +++ b/src/ui_appindicator.c @@ -199,9 +199,9 @@ static void update_label(struct ui_psensor *ui) if (is_temp_type((*p)->type)) str = "999UUU"; - else if (is_fan_type((*p)->type)) + else if ((*p)->type & SENSOR_TYPE_RPM) str = "999UUU"; - else /* cpu load */ + else /* percent */ str = "999%"; if (guide == NULL) { diff --git a/src/ui_notify.c b/src/ui_notify.c index 6361f06..e829ed4 100644 --- a/src/ui_notify.c +++ b/src/ui_notify.c @@ -75,8 +75,8 @@ void ui_notify(struct psensor *sensor, struct ui_psensor *ui) if (is_temp_type(sensor->type)) summary = _("Temperature alert"); - else if (is_fan_type(sensor->type)) - summary = _("Fan alert"); + else if (sensor->type & SENSOR_TYPE_RPM) + summary = _("Fan speed alert"); else summary = _("N/A"); diff --git a/src/ui_sensorpref.c b/src/ui_sensorpref.c index 126f33c..d9a909c 100644 --- a/src/ui_sensorpref.c +++ b/src/ui_sensorpref.c @@ -290,23 +290,12 @@ update_pref(struct sensor_pref *p, struct config *cfg, GtkBuilder *builder) w_appindicator_label_enabled = GTK_TOGGLE_BUTTON (gtk_builder_get_object(builder, "indicator_label_checkbox")); - if (is_temp_type(s->type) || is_fan_type(s->type)) { - gtk_toggle_button_set_active(w_alarm, p->alarm_enabled); - gtk_spin_button_set_value(w_high_threshold, - p->alarm_high_threshold); - gtk_spin_button_set_value(w_low_threshold, - p->alarm_low_threshold); - gtk_widget_set_sensitive(GTK_WIDGET(w_alarm), TRUE); - gtk_widget_set_sensitive(GTK_WIDGET(w_high_threshold), TRUE); - gtk_widget_set_sensitive(GTK_WIDGET(w_low_threshold), TRUE); - } else { - gtk_toggle_button_set_active(w_alarm, 0); - gtk_spin_button_set_value(w_high_threshold, 0); - gtk_spin_button_set_value(w_low_threshold, 0); - gtk_widget_set_sensitive(GTK_WIDGET(w_alarm), FALSE); - gtk_widget_set_sensitive(GTK_WIDGET(w_high_threshold), FALSE); - gtk_widget_set_sensitive(GTK_WIDGET(w_low_threshold), FALSE); - } + gtk_toggle_button_set_active(w_alarm, p->alarm_enabled); + gtk_spin_button_set_value(w_high_threshold, p->alarm_high_threshold); + gtk_spin_button_set_value(w_low_threshold, p->alarm_low_threshold); + gtk_widget_set_sensitive(GTK_WIDGET(w_alarm), TRUE); + gtk_widget_set_sensitive(GTK_WIDGET(w_high_threshold), TRUE); + gtk_widget_set_sensitive(GTK_WIDGET(w_low_threshold), TRUE); gtk_toggle_button_set_active(w_appindicator_enabled, p->appindicator_enabled);