/gpump/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/gpump/trunk

« back to all changes in this revision

Viewing changes to src/GPumpSettingsData.h

  • Committer: Gustav Hatvigsson
  • Date: 2014-04-14 07:33:32 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20140414073332-eagun3d8y56k3dtd
* Switched to GKeyFile instead of GSettings, for the time being.

** This is untested code **

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
#ifndef __H_GPUMP_SETTINGS_DATA__
7
7
#define __H_GPUMP_SETTINGS_DATA__
8
8
 
 
9
/**
 
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
 
12
 * directory.
 
13
 */
 
14
#define GPUMP_USE_GSETTINGS 0
 
15
 
9
16
#include <gtk/gtk.h>
10
17
#include <gio/gio.h>
11
18
#include <rest/oauth2-proxy.h>
45
52
struct GPumpSettingsData {
46
53
  GObject parent;
47
54
  
48
 
  /* org.gego.gpump.ui */
49
 
  GSettings * ui_settings;
50
 
  /* org.gego.gpump */
51
 
  GSettings * gpump_settings;
 
55
  /* Private data is defined in the C file. */
 
56
  GPumpSettingsDataPrivate * priv;
52
57
};
53
58
 
54
59
struct GPumpSettingsDataClass {
60
65
 * Create a GPumpSettingsData instance if it does not already exist,
61
66
 * if it exists return a pointer to the object.
62
67
 *
63
 
 * The object's reference count is incleased every time this is called, so
 
68
 * The object's reference count is increased every time this is called, so
64
69
 * you need to unref it whet you are done with it.
65
70
 */
66
71
GPumpSettingsData * gpump_settings_data_get_default ();
67
72
 
 
73
/**
 
74
 * Sets a value in the.
 
75
 *
 
76
 * valid names are:
 
77
 * - ui-x
 
78
 * - ui-y
 
79
 * - ui-h
 
80
 * - ui-w
 
81
 * - main-use-dark
 
82
 * 
 
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.
 
85
 *
 
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.
 
89
 *
 
90
 * If the data type in the data does not match the expected value type, the
 
91
 * value will not be set.
 
92
 */
 
93
void gpump_settings_data_set (GPumpSettingsData * self,
 
94
                              gchar * name,
 
95
                              GVariant * data);
 
96
 
 
97
 
 
98
/**
 
99
 * Gets the data given a name, see gpump_settings_data_set's documentation
 
100
 * for more information.
 
101
 *
 
102
 * @param self the object to get the data from.
 
103
 * @param name the name of the value to be returned
 
104
 *
 
105
 * @returns a GValiant containing the value of that was requested.
 
106
 */
 
107
GVariant * gpump_settings_data_get (GPumpSettingsData * self,
 
108
                                    gchar * name);
 
109
 
 
110
/**
 
111
 * Commit the the changes to file, only usefile when using compiled in
 
112
 * non-GSettings mode. In GSettings mode this will do nothing.
 
113
 *
 
114
 * @param self the object to perform the operation on
 
115
 * @param err returns on error if an error happens, should be NULL.
 
116
 *
 
117
 * @returns TRUE if no error occurred, FALSE otherwise
 
118
 *
 
119
 * @warning This operation may be relatively I/O intensive, because the file
 
120
 * is rewritten.
 
121
 */
 
122
gboolean gpump_settings_data_commit (GPumpSettingsData * self,
 
123
                                     GError * err);
68
124
 
69
125
#endif /* #ifndef __H_GPUMP_SETTINGS_DATA__*/