summaryrefslogtreecommitdiff
path: root/sensors-applet/active-sensor.c
diff options
context:
space:
mode:
Diffstat (limited to 'sensors-applet/active-sensor.c')
-rw-r--r--sensors-applet/active-sensor.c64
1 files changed, 20 insertions, 44 deletions
diff --git a/sensors-applet/active-sensor.c b/sensors-applet/active-sensor.c
index f7cb83c..94cc707 100644
--- a/sensors-applet/active-sensor.c
+++ b/sensors-applet/active-sensor.c
@@ -24,12 +24,14 @@
#include <string.h>
#endif /* HAVE_STRING_H */
-#include <mateconf/mateconf-client.h>
-#include <mate.h>
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+#include <gio/gio.h>
#include "active-sensor.h"
#include "sensors-applet-plugins.h"
-#include "sensors-applet-mateconf.h"
+#include "sensors-applet-settings.h"
typedef enum {
VERY_LOW_SENSOR_VALUE = 0,
@@ -73,18 +75,21 @@ static SensorValueRange sensor_value_range(gdouble sensor_value,
static gboolean active_sensor_execute_alarm(ActiveSensor *active_sensor,
NotifType notif_type) {
- int pid;
+ gboolean ret;
+ GError *error = NULL;
sensors_applet_notify_active_sensor(active_sensor, notif_type);
g_debug("EXECUTING %s ALARM: %s",
(notif_type == LOW_ALARM ?
"LOW" : "HIGH"),
active_sensor->alarm_command[notif_type]);
- pid = mate_execute_shell(NULL,
- active_sensor->alarm_command[notif_type]);
- g_debug("Command executed in shell with pid %d", pid);
+ ret = g_spawn_command_line_async (active_sensor->alarm_command[notif_type], &error);
+ g_debug("Command executed in shell");
+
+ if (error)
+ g_error_free (error);
- return (pid != -1);
+ return ret;
}
static gboolean active_sensor_execute_low_alarm(ActiveSensor *active_sensor) {
@@ -460,8 +465,7 @@ ActiveSensor *active_sensor_new(SensorsApplet *sensors_applet,
/* need to set size according to orientation */
orient = mate_panel_applet_get_orient(active_sensor->sensors_applet->applet);
- graph_size = mate_panel_applet_mateconf_get_int(active_sensor->sensors_applet->applet,
- GRAPH_SIZE, NULL);
+ graph_size = g_settings_get_int(active_sensor->sensors_applet->settings, GRAPH_SIZE);
horizontal = ((orient == MATE_PANEL_APPLET_ORIENT_UP) ||
(orient == MATE_PANEL_APPLET_ORIENT_DOWN));
@@ -527,8 +531,7 @@ void active_sensor_update(ActiveSensor *active_sensor,
gchar *tooltip = NULL;
gchar *value_tooltip = NULL;
- /* hidden mateconf options */
- MateConfClient *client;
+ /* hidden gsettings options */
gint font_size = 0;
gboolean hide_units = FALSE;
@@ -584,29 +587,16 @@ void active_sensor_update(ActiveSensor *active_sensor,
* note this is not unique */
sensor_value = -1;
} else {
- /* use hidden mateconf key for hide_units */
-
- if ((client = mateconf_client_get_default()) != NULL) {
- hide_units = mateconf_client_get_bool(client,
- "/apps/sensors-applet/" HIDE_UNITS,
- &error);
- if (error) {
- g_debug("Could not get hide units from MateConf - assuming false");
- hide_units = FALSE;
- g_error_free(error);
- error = NULL;
- }
-
- g_object_unref(client);
- }
+ /* use hidden gsettings key for hide_units */
+ hide_units = g_settings_get_boolean(sensors_applet->settings, HIDE_UNITS);
/* scale value and set text using this
* value */
switch (sensor_type) {
case TEMP_SENSOR:
- scale = (TemperatureScale)mate_panel_applet_mateconf_get_int(sensors_applet->applet, TEMPERATURE_SCALE, NULL);
+ scale = (TemperatureScale) g_settings_get_int(sensors_applet->settings, TEMPERATURE_SCALE);
/* scale value */
sensor_value = sensors_applet_convert_temperature(sensor_value,
CELSIUS,
@@ -661,24 +651,10 @@ void active_sensor_update(ActiveSensor *active_sensor,
g_free(value_tooltip);
/* only do icons and labels / graphs if needed */
- display_mode = mate_panel_applet_mateconf_get_int(sensors_applet->applet,
- DISPLAY_MODE,
- NULL);
+ display_mode = g_settings_get_int (sensors_applet->settings, DISPLAY_MODE);
/* most users wont have a font size set */
- if ((client = mateconf_client_get_default()) != NULL) {
- font_size = mateconf_client_get_int(client,
- "/apps/sensors-applet/" FONT_SIZE,
- &error);
- if (error) {
- g_debug("Could not get font size from MateConf - assuming default size");
- font_size = 0;
- g_error_free(error);
- error = NULL;
- }
-
- g_object_unref(client);
- }
+ font_size = g_settings_get_int (sensors_applet->settings, FONT_SIZE);
/* do icon if needed */