X-Git-Url: https://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=src%2Fcfg.h;h=9a9fce13000f7ee7fd54369a73a0edf9a6cb3eb9;hb=f3b05dae619a7909bd7422b3a82422c9442aa114;hp=d88dc2964d9d55b3f2bedba3eb285892a27431f7;hpb=cde76fd1723bbdad164adac96d105111b831bf50;p=psensor.git diff --git a/src/cfg.h b/src/cfg.h index d88dc29..9a9fce1 100644 --- a/src/cfg.h +++ b/src/cfg.h @@ -1,31 +1,40 @@ /* - Copyright (C) 2010-2011 jeanfi@gmail.com - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA -*/ - + * Copyright (C) 2010-2014 jeanfi@gmail.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ #ifndef _PSENSOR_CONFIG_H_ #define _PSENSOR_CONFIG_H_ +#include + +#include "bool.h" #include "color.h" -#define SENSORLIST_POSITION_RIGHT 0 -#define SENSORLIST_POSITION_LEFT 1 -#define SENSORLIST_POSITION_TOP 2 -#define SENSORLIST_POSITION_BOTTOM 3 +enum temperature_unit { + CELCIUS, + FAHRENHEIT +}; + +enum sensorlist_position { + SENSORLIST_POSITION_RIGHT, + SENSORLIST_POSITION_LEFT, + SENSORLIST_POSITION_TOP, + SENSORLIST_POSITION_BOTTOM +}; struct config { struct color *graph_bgcolor; @@ -33,22 +42,41 @@ struct config { double graph_bg_alpha; - int alpha_channel_enabled; + bool alpha_channel_enabled; /* - Position of the sensors list table + * Position of the sensors list table */ - int sensorlist_position; - - int window_decoration_enabled; - - int window_keep_below_enabled; + enum sensorlist_position sensorlist_position; + + bool window_decoration_enabled; + bool window_keep_below_enabled; + bool window_restore_enabled; + /* Last saved position of the window. */ + int window_x; + int window_y; + /* Last saved size of the window. */ + int window_w; + int window_h; + /* Last saved position of the window divider. */ + int window_divider_pos; int graph_update_interval; int graph_monitoring_duration; int sensor_values_max_length; int sensor_update_interval; + + bool menu_bar_disabled; + + bool unity_launcher_count_disabled; + + int hide_on_startup; + + enum temperature_unit temperature_unit; + + bool slog_enabled; + int slog_interval; }; /* @@ -56,25 +84,39 @@ struct config { */ struct config *config_load(); -void config_save(struct config *); +void config_save(const struct config *); + +void config_cleanup(); + +struct color *config_get_sensor_color(const char *sid, const struct color *); +void config_set_sensor_color(const char *sid, const struct color *); + +int config_get_sensor_alarm_high_threshold(const char *); +void config_set_sensor_alarm_high_threshold(const char *, int); + +int config_get_sensor_alarm_low_threshold(const char *); +void config_set_sensor_alarm_low_threshold(const char *, int); -void config_init(); +bool config_get_sensor_alarm_enabled(const char *); +void config_set_sensor_alarm_enabled(const char *, bool); -struct color *config_get_sensor_color(char *sensor_name, - struct color *default_color); +bool config_is_sensor_enabled(const char *); +void config_set_sensor_enabled(const char *, bool); -void config_set_sensor_color(char *sensor_name, struct color *color); +char *config_get_sensor_name(const char *); +void config_set_sensor_name(const char *, const char *); -int config_get_sensor_alarm_limit(char *, int); -void config_set_sensor_alarm_limit(char *sensor_name, int alarm_limit); +bool config_is_appindicator_enabled(const char *); +void config_set_appindicator_enabled(const char *, bool); -int config_get_sensor_alarm_enabled(char *); -void config_set_sensor_alarm_enabled(char *, int); +void config_slog_enabled_notify_add(GConfClientNotifyFunc cbk, void *data); +bool is_slog_enabled(); -int config_is_sensor_enabled(char *); -void config_set_sensor_enabled(char *, int); +int config_get_slog_interval(); -char *config_get_sensor_name(char *); -void config_set_sensor_name(char *, const char *); +int config_get_sensor_position(const char *); +void config_set_sensor_position(const char *, int); +char *config_get_notif_script(); +void config_set_notif_script(const char *); #endif