1 /*
2  *  Copyright (C) 2021 Simon Steinbeiß <simon@xfce.org>
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
6  *  as published by the Free Software Foundation; either version 2
7  *  of the License, or (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU 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  02110-1301, USA.
17  */
18 
19 #ifndef __SYSTEMLOAD_CONFIG_H__
20 #define __SYSTEMLOAD_CONFIG_H__
21 
22 #include <glib.h>
23 
24 G_BEGIN_DECLS
25 
26 #define MIN_TIMEOUT 500
27 #define MAX_TIMEOUT 10000
28 
29 typedef enum {
30     CPU_MONITOR,
31     MEM_MONITOR,
32     NET_MONITOR,
33     SWAP_MONITOR,
34 } SystemloadMonitor;
35 
36 typedef struct _SystemloadConfigClass SystemloadConfigClass;
37 typedef struct _SystemloadConfig      SystemloadConfig;
38 
39 #define TYPE_SYSTEMLOAD_CONFIG             (systemload_config_get_type ())
40 #define SYSTEMLOAD_CONFIG(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SYSTEMLOAD_CONFIG, SystemloadConfig))
41 #define SYSTEMLOAD_CONFIG_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass),  TYPE_SYSTEMLOAD_CONFIG, SystemloadConfigClass))
42 #define IS_SYSTEMLOAD_CONFIG(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SYSTEMLOAD_CONFIG))
43 #define IS_SYSTEMLOAD_CONFIG_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass),  TYPE_SYSTEMLOAD_CONFIG))
44 #define SYSTEMLOAD_CONFIG_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj),  TYPE_SYSTEMLOAD_CONFIG, SystemloadConfigClass))
45 
46 GType              systemload_config_get_type                       (void) G_GNUC_CONST;
47 
48 SystemloadConfig  *systemload_config_new                            (const gchar          *property_base);
49 
50 void               systemload_config_on_change                      (SystemloadConfig     *config,
51                                                                      gboolean             (*callback)(gpointer user_data),
52                                                                      gpointer             user_data);
53 
54 guint              systemload_config_get_timeout                    (const SystemloadConfig *config);
55 guint              systemload_config_get_timeout_seconds            (const SystemloadConfig *config);
56 const gchar       *systemload_config_get_system_monitor_command     (const SystemloadConfig *config);
57 gboolean           systemload_config_get_uptime_enabled             (const SystemloadConfig *config);
58 
59 gboolean           systemload_config_get_enabled   (const SystemloadConfig *config, SystemloadMonitor monitor);
60 gboolean           systemload_config_get_use_label (const SystemloadConfig *config, SystemloadMonitor monitor);
61 const gchar       *systemload_config_get_label     (const SystemloadConfig *config, SystemloadMonitor monitor);
62 const GdkRGBA     *systemload_config_get_color     (const SystemloadConfig *config, SystemloadMonitor monitor);
63 
64 G_END_DECLS
65 
66 #endif /* !__SYSTEMLOAD_CONFIG_H__ */
67