Added a simple singleton object for user preference storage.
[pspp-builds.git] / src / ui / gui / psppire-conf.h
1 /* PSPPIRE - a graphical user interface for PSPP.
2    Copyright (C) 2009  Free Software Foundation
3
4    This program is free software: you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation, either version 3 of the License, or
7    (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, see <http://www.gnu.org/licenses/>. */
16
17
18 #include <glib-object.h>
19 #include <glib.h>
20
21 #ifndef __PSPPIRE_CONF_H__
22 #define __PSPPIRE_CONF_H__
23
24 G_BEGIN_DECLS
25
26
27 #define PSPPIRE_TYPE_CONF (psppire_conf_get_type ())
28
29 #define PSPPIRE_CONF(obj)       \
30                      (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
31                     PSPPIRE_TYPE_CONF, PsppireConf))
32
33 #define PSPPIRE_CONF_CLASS(klass) \
34                      (G_TYPE_CHECK_CLASS_CAST ((klass), \
35                                  PSPPIRE_TYPE_CONF, \
36                                  PsppireConfClass))
37
38
39 #define PSPPIRE_IS_CONF(obj) \
40                      (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPPIRE_TYPE_CONF))
41
42 #define PSPPIRE_IS_CONF_CLASS(klass) \
43                      (G_TYPE_CHECK_CLASS_TYPE ((klass), PSPPIRE_TYPE_CONF))
44
45
46 #define PSPPIRE_CONF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
47                                    PSPPIRE_TYPE_CONF, \
48                                    PsppireConfClass))
49
50 typedef struct _PsppireConf       PsppireConf;
51 typedef struct _PsppireConfClass  PsppireConfClass;
52
53
54 struct _PsppireConf
55 {
56   GObject parent;
57
58   /*< private >*/
59   gboolean dispose_has_run ;
60
61   GKeyFile *keyfile;
62   gchar *filename;
63 };
64
65
66 struct _PsppireConfClass
67 {
68   GObjectClass parent_class;
69 };
70
71
72 GType psppire_conf_get_type (void) G_GNUC_CONST;
73
74 PsppireConf * psppire_conf_new (void);
75
76 gboolean psppire_conf_get_int (PsppireConf *,
77                                const gchar *, const gchar *, int *);
78
79 void psppire_conf_set_int (PsppireConf *conf,
80                            const gchar *base, const gchar *name,
81                            gint value);
82
83
84 G_END_DECLS
85
86 #endif /* __PSPPIRE_CONF_H__ */