From b2f9d4f8cd4641dc82a59b43f81674b3474198d0 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Orsini Date: Sun, 31 Mar 2013 16:56:39 +0000 Subject: [PATCH] added support of sensor position --- src/cfg.c | 22 ++++++++++++++++++++++ src/cfg.h | 3 +++ 2 files changed, 25 insertions(+) diff --git a/src/cfg.c b/src/cfg.c index 6fd812a..9a903ec 100644 --- a/src/cfg.c +++ b/src/cfg.c @@ -33,6 +33,7 @@ static const char *ATT_SENSOR_COLOR = "color"; static const char *ATT_SENSOR_ENABLED = "enabled"; static const char *ATT_SENSOR_NAME = "name"; static const char *ATT_SENSOR_APPINDICATOR_DISABLED = "appindicator/disabled"; +static const char *ATT_SENSOR_POSITION = "position"; static const char *KEY_SENSOR_UPDATE_INTERVAL = "/apps/psensor/sensor/update_interval"; @@ -366,6 +367,27 @@ void config_set_sensor_name(const char *sid, const char *name) free(key); } +int config_get_sensor_position(const char *sid) +{ + char *key; + int pos; + + key = get_sensor_att_key(sid, ATT_SENSOR_POSITION); + pos = gconf_client_get_int(client, key, NULL); + free(key); + + return pos; +} + +void config_set_sensor_position(const char *sid, int pos) +{ + char *key; + + key = get_sensor_att_key(sid, ATT_SENSOR_POSITION); + gconf_client_set_int(client, key, pos, NULL); + free(key); +} + bool config_is_appindicator_enabled(const char *sid) { char *key; diff --git a/src/cfg.h b/src/cfg.h index f3d8f10..f314424 100644 --- a/src/cfg.h +++ b/src/cfg.h @@ -114,4 +114,7 @@ bool is_slog_enabled(); int config_get_slog_interval(); +int config_get_sensor_position(const char *); +void config_set_sensor_position(const char *, int); + #endif -- 2.7.4