made menu enabled setting dynamic
[psensor.git] / src / cfg.h
1 /*
2  * Copyright (C) 2010-2014 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 <gdk/gdk.h>
23
24 #include <bool.h>
25 #include <color.h>
26
27 enum temperature_unit {
28         CELSIUS,
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         /* Position of the sensors list table */
48         enum sensorlist_position sensorlist_position;
49
50         bool window_restore_enabled;
51         /* Last saved position of the window. */
52         int window_x;
53         int window_y;
54         /* Last saved size of the window. */
55         int window_w;
56         int window_h;
57         /* Last saved position of the window divider. */
58         int window_divider_pos;
59
60         int graph_update_interval;
61         int graph_monitoring_duration;
62
63         int sensor_values_max_length;
64         int sensor_update_interval;
65
66         bool unity_launcher_count_disabled;
67
68         int hide_on_startup;
69
70         bool slog_enabled;
71         int slog_interval;
72 };
73
74 /* Loads psensor configuration */
75 struct config *config_load(void);
76
77 void config_save(const struct config *);
78
79 void config_cleanup(void);
80
81 GdkRGBA *config_get_sensor_color(const char *);
82 void config_set_sensor_color(const char *, const GdkRGBA *);
83
84 bool config_get_sensor_alarm_high_threshold(const char *, double *);
85 void config_set_sensor_alarm_high_threshold(const char *, int);
86
87 bool config_get_sensor_alarm_low_threshold(const char *, double *);
88 void config_set_sensor_alarm_low_threshold(const char *, int);
89
90 bool config_get_sensor_alarm_enabled(const char *);
91 void config_set_sensor_alarm_enabled(const char *, bool);
92
93 bool config_is_sensor_graph_enabled(const char *);
94 void config_set_sensor_graph_enabled(const char *, bool);
95
96 char *config_get_sensor_name(const char *);
97 void config_set_sensor_name(const char *, const char *);
98
99 bool config_is_appindicator_enabled(const char *);
100 void config_set_appindicator_enabled(const char *, bool);
101
102 bool config_is_appindicator_label_enabled(const char *);
103 void config_set_appindicator_label_enabled(const char *, bool);
104
105 bool is_slog_enabled(void);
106 void config_set_slog_enabled_changed_cbk(void (*)(void *), void *);
107
108 int config_get_slog_interval(void);
109
110 bool config_is_smooth_curves_enabled(void);
111 void config_set_smooth_curves_enabled(bool);
112
113 int config_get_sensor_position(const char *);
114 void config_set_sensor_position(const char *, int);
115
116 char *config_get_notif_script(void);
117 void config_set_notif_script(const char *);
118
119 bool config_is_sensor_enabled(const char *sid);
120 void config_set_sensor_enabled(const char *sid, bool enabled);
121
122 bool config_is_lmsensor_enabled(void);
123 void config_set_lmsensor_enable(bool);
124
125 bool config_is_gtop2_enabled(void);
126 void config_set_gtop2_enable(bool);
127
128 bool config_is_udisks2_enabled(void);
129 void config_set_udisks2_enable(bool);
130
131 bool config_is_hddtemp_enabled(void);
132 void config_set_hddtemp_enable(bool);
133
134 bool config_is_libatasmart_enabled(void);
135 void config_set_libatasmart_enable(bool);
136
137 bool config_is_nvctrl_enabled(void);
138 void config_set_nvctrl_enable(bool);
139
140 bool config_is_atiadlsdk_enabled(void);
141 void config_set_atiadlsdk_enable(bool);
142
143 enum temperature_unit config_get_temperature_unit(void);
144 void config_set_temperature_unit(enum temperature_unit);
145
146 double config_get_default_high_threshold_temperature(void);
147
148 bool config_is_window_decoration_enabled(void);
149 void config_set_window_decoration_enabled(bool);
150
151 bool config_is_window_keep_below_enabled(void);
152 void config_set_window_keep_below_enabled(bool);
153
154 bool config_is_menu_bar_enabled(void);
155 void config_set_menu_bar_enabled(bool);
156
157 /*
158  * Returns the user directory containing psensor data (configuration
159  * and log).
160  * Corresponds to $HOME/.psensor/
161  * Creates the directory if it does not exist;
162  * Returns NULL if it cannot be determined.
163  */
164 const char *get_psensor_user_dir(void);
165
166 void config_sync(void);
167
168 GSettings *config_get_GSettings(void);
169
170 #endif