Imported Debian patch 0.8.0.4-1.1
[psensor-pkg-debian.git] / src / cfg.h
1 /*
2  * Copyright (C) 2010-2013 jeanfi@gmail.com
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of the
7  * License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  * 02110-1301 USA
18  */
19 #ifndef _PSENSOR_CONFIG_H_
20 #define _PSENSOR_CONFIG_H_
21
22 #include <gconf/gconf-client.h>
23
24 #include "bool.h"
25 #include "color.h"
26
27 enum temperature_unit {
28         CELCIUS,
29         FAHRENHEIT
30 };
31
32 enum sensorlist_position {
33         SENSORLIST_POSITION_RIGHT,
34         SENSORLIST_POSITION_LEFT,
35         SENSORLIST_POSITION_TOP,
36         SENSORLIST_POSITION_BOTTOM
37 };
38
39 struct config {
40         struct color *graph_bgcolor;
41         struct color *graph_fgcolor;
42
43         double graph_bg_alpha;
44
45         bool alpha_channel_enabled;
46
47         /*
48          * Position of the sensors list table
49          */
50         enum sensorlist_position sensorlist_position;
51
52         bool window_decoration_enabled;
53         bool window_keep_below_enabled;
54         bool window_restore_enabled;
55         /* Last saved position of the window. */
56         int window_x;
57         int window_y;
58         /* Last saved size of the window. */
59         int window_w;
60         int window_h;
61         /* Last saved position of the window divider. */
62         int window_divider_pos;
63
64         int graph_update_interval;
65         int graph_monitoring_duration;
66
67         int sensor_values_max_length;
68         int sensor_update_interval;
69
70         bool menu_bar_disabled;
71
72         bool unity_launcher_count_disabled;
73
74         int hide_on_startup;
75
76         enum temperature_unit temperature_unit;
77
78         bool slog_enabled;
79         int slog_interval;
80 };
81
82 /*
83   Loads config from GConf
84 */
85 struct config *config_load();
86
87 void config_save(const struct config *);
88
89 void config_cleanup();
90
91 struct color *config_get_sensor_color(const char *sid, const struct color *);
92 void config_set_sensor_color(const char *sid, const struct color *);
93
94 int config_get_sensor_alarm_high_threshold(const char *);
95 void config_set_sensor_alarm_high_threshold(const char *, int);
96
97 int config_get_sensor_alarm_low_threshold(const char *);
98 void config_set_sensor_alarm_low_threshold(const char *, int);
99
100 bool config_get_sensor_alarm_enabled(const char *);
101 void config_set_sensor_alarm_enabled(const char *, bool);
102
103 bool config_is_sensor_enabled(const char *);
104 void config_set_sensor_enabled(const char *, bool);
105
106 char *config_get_sensor_name(const char *);
107 void config_set_sensor_name(const char *, const char *);
108
109 bool config_is_appindicator_enabled(const char *);
110 void config_set_appindicator_enabled(const char *, bool);
111
112 void config_slog_enabled_notify_add(GConfClientNotifyFunc cbk, void *data);
113 bool is_slog_enabled();
114
115 int config_get_slog_interval();
116
117 int config_get_sensor_position(const char *);
118 void config_set_sensor_position(const char *, int);
119
120 char *config_get_notif_script();
121 void config_set_notif_script(const char *);
122 #endif