diff options
author | Jaap Versteegh <[email protected]> | 2012-07-26 22:30:05 +0200 |
---|---|---|
committer | Jaap Versteegh <[email protected]> | 2012-07-26 22:30:05 +0200 |
commit | d3263c4135e55df4ceba1d609045ff680016054b (patch) | |
tree | 87164d22b3db1ff3168a8266f1dceccc773fafdb /plugins/udisks | |
parent | 58aeb9344c1794551d159d6a7dafed74ac0e08e0 (diff) | |
download | mate-sensors-applet-d3263c4135e55df4ceba1d609045ff680016054b.tar.bz2 mate-sensors-applet-d3263c4135e55df4ceba1d609045ff680016054b.tar.xz |
Also use id in hash table of sensors
Diffstat (limited to 'plugins/udisks')
-rw-r--r-- | plugins/udisks/udisks-plugin.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/plugins/udisks/udisks-plugin.c b/plugins/udisks/udisks-plugin.c index 9763015..a2d56ea 100644 --- a/plugins/udisks/udisks-plugin.c +++ b/plugins/udisks/udisks-plugin.c @@ -40,6 +40,7 @@ */ typedef struct _DevInfo{ gchar *path; + gchar *id; gboolean changed; gdouble temp; DBusGProxy *sensor_proxy; @@ -181,30 +182,32 @@ static void udisks_plugin_get_sensors(GList **sensors) { G_CALLBACK(udisks_changed_signal_cb), path, NULL); + + gchar *model = g_value_get_string(&model_v); + gchar *dev = g_value_get_string(&dev_v); + GStrv ids = g_value_get_boxed(&ids_v); + + gchar *id = ids != NULL && ids[0] != NULL ? ids[0] : dev; + info = g_malloc(sizeof(DevInfo)); if (devices == NULL) { devices = g_hash_table_new(g_str_hash, g_str_equal); } + info->id = g_strdup(id); info->path = g_strdup(path); info->sensor_proxy = sensor_proxy; /* Set the device status changed as TRUE because we need * to get the initial temperature reading */ info->changed = TRUE; - g_hash_table_insert(devices, info->path, info); - - gchar *model = g_value_get_string(&model_v); - gchar *dev = g_value_get_string(&dev_v); - GStrv ids = g_value_get_boxed(&ids_v); - - gchar *id = ids != NULL && ids[0] != NULL ? ids[0] : dev; + g_hash_table_insert(devices, info->id, info); /* Write the sensor data */ sensors_applet_plugin_add_sensor(sensors, - path, id, + "Disk Temperature", model, TEMP_SENSOR, FALSE, @@ -260,7 +263,7 @@ static gdouble udisks_plugin_get_sensor_value(const gchar *path, GValue smart_time = { 0, }; sensor_proxy = dbus_g_proxy_new_for_name(connection, UDISKS_BUS_NAME, - path, + info->path, UDISKS_PROPERTIES_INTERFACE); if (!dbus_g_proxy_call(sensor_proxy, "Get", error, G_TYPE_STRING, UDISKS_BUS_NAME, |