From fc89b967f91eec5db4ddfe2187b60119e3e9bd28 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 19 Oct 2017 11:00:04 +0200 Subject: remove code duplication 01 --- lib/sensors-applet-plugin.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'lib/sensors-applet-plugin.c') 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, -- cgit v1.2.1