summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUnknown <[email protected]>2017-10-19 11:00:04 +0200
committerraveit65 <[email protected]>2017-10-25 19:32:09 +0200
commitfc89b967f91eec5db4ddfe2187b60119e3e9bd28 (patch)
tree91c45b1922ddfa9ab632ac57379e7d1caf65c59c
parent697681a51f0e5b26d228ea019c4813878457ce3c (diff)
downloadmate-sensors-applet-fc89b967f91eec5db4ddfe2187b60119e3e9bd28.tar.bz2
mate-sensors-applet-fc89b967f91eec5db4ddfe2187b60119e3e9bd28.tar.xz
remove code duplication 01
-rw-r--r--lib/sensors-applet-plugin.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/lib/sensors-applet-plugin.c b/lib/sensors-applet-plugin.c
index 9a32b5e..db0cfdd 100644
--- a/lib/sensors-applet-plugin.c
+++ b/lib/sensors-applet-plugin.c
@@ -105,24 +105,23 @@ void sensors_applet_plugin_add_sensor(GList **sensors,
IconType icon,
const gchar *graph_color)
{
- SensorsAppletSensorInfo *info;
-
- info = g_malloc0(sizeof(*info));
-
- info->path = g_strdup(path);
- info->id = g_strdup(id);
- info->label = g_strdup(label);
- info->type = type;
- info->enable = enable;
+ gdouble low_value;
+ gdouble high_value;
sensors_applet_plugin_default_sensor_limits(type,
- &(info->low_value),
- &(info->high_value));
- info->multiplier = 1.0;
- info->offset = 0.0;
- info->icon = icon;
- info->graph_color = g_strdup(graph_color);
+ &low_value,
+ &high_value);
+
+ sensors_applet_plugin_add_sensor_with_limits(sensors,
+ path,
+ id,
+ label,
+ type,
+ enable,
+ low_value,
+ high_value,
+ icon,
+ graph_color);
- *sensors = g_list_append(*sensors, info);
}
void sensors_applet_plugin_add_sensor_with_limits(GList **sensors,