1
/* c-basic-offset: 2; tab-width: 2; indent-tabs-mode: nil
2
* vi: set shiftwidth=2 tabstop=2 expandtab:
3
* :indentSize=2:tabSize=2:noTabs=true:
6
#ifndef __H_GPUMP_SETTINGS_DATA__
7
#define __H_GPUMP_SETTINGS_DATA__
10
* If this is set, it will use GSettings, otherwise it will use GKeyFile
11
* and store store the data in a .ini format conf file in the configuration
14
#define GPUMP_USE_GSETTINGS 0
18
#include <rest/oauth2-proxy.h>
19
#include <rest/rest-proxy-call.h>
22
#include <glib/gi18n.h>
24
#define GPUMP_TYPE_SETTINGS_DATA (gpump_settings_data_get_type ())
25
#define GPUMP_SETTINGS_DATA(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GPUMP_TYPE_SETTINGS_DATA, GPumpSettingsData))
26
#define GPUMP_SETTINGS_DATA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GPUMP_TYPE_SETTINGS_DATA, GPumpSettingsDataClass))
27
#define GPUMP_IS_SETTINGS_DATA(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GPUMP_TYPE_SETTINGS_DATA))
28
#define GPUMP_IS_SETTINGS_DATA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GPUMP_TYPE_SETTINGS_DATA))
29
#define GPUMP_SETTINGS_DATA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GPUMP_TYPE_SETTINGS_DATA, GPumpSettingsDataClass))
31
typedef struct GPumpSettingsData GPumpSettingsData;
32
typedef struct GPumpSettingsDataClass GPumpSettingsDataClass;
33
typedef struct GPumpSettingsDataPrivate GPumpSettingsDataPrivate;
38
* CLASS NAMESPACE: gpump_settings_data_*
42
* A class that holds the settings data.
44
* the reason for this is to split data and wiev, simplefying the data modle
47
* This is a singletonian class, to get the instance use the provided
48
* gpump_settings_data_get_default () function.
50
* Pleace note that this is not thread safe, and should be used with care.
52
struct GPumpSettingsData {
55
/* Private data is defined in the C file. */
56
GPumpSettingsDataPrivate * priv;
59
struct GPumpSettingsDataClass {
65
* Create a GPumpSettingsData instance if it does not already exist,
66
* if it exists return a pointer to the object.
68
* The object's reference count is increased every time this is called, so
69
* you need to unref it whet you are done with it.
71
GPumpSettingsData * gpump_settings_data_get_default ();
74
* Sets a value in the.
83
* if the app is compiled in non-gsettings mode, you will have to use
84
* gpump_settings_data_commit () whet to commit the changes.
86
* @param self the object to perform the operation on.
87
* @param name the name of the setting to change.
88
* @param data the a GVariant that contains the data that should be set.
90
* If the data type in the data does not match the expected value type, the
91
* value will not be set.
93
void gpump_settings_data_set (GPumpSettingsData * self,
99
* Gets the data given a name, see gpump_settings_data_set's documentation
100
* for more information.
102
* @param self the object to get the data from.
103
* @param name the name of the value to be returned
105
* @returns a GValiant containing the value of that was requested.
107
GVariant * gpump_settings_data_get (GPumpSettingsData * self,
111
* Commit the the changes to file, only usefile when using compiled in
112
* non-GSettings mode. In GSettings mode this will do nothing.
114
* @param self the object to perform the operation on
115
* @param err returns on error if an error happens, should be NULL.
117
* @returns TRUE if no error occurred, FALSE otherwise
119
* @warning This operation may be relatively I/O intensive, because the file
122
gboolean gpump_settings_data_commit (GPumpSettingsData * self,
125
#endif /* #ifndef __H_GPUMP_SETTINGS_DATA__*/