~ubuntu-branches/ubuntu/quantal/gconf/quantal

« back to all changes in this revision

Viewing changes to gconf/gconf-value.h

  • Committer: Bazaar Package Importer
  • Author(s): Josselin Mouette
  • Date: 2007-11-01 18:47:26 UTC
  • mto: (7.1.1 lenny) (1.2.1) (76.1.1 oneiric-proposed)
  • mto: This revision was merged to the branch mainline in revision 7.
  • Revision ID: james.westby@ubuntu.com-20071101184726-e3e4cxfcp41tz6ui
Tags: upstream-2.20.1
ImportĀ upstreamĀ versionĀ 2.20.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include <glib.h>
25
25
#include "gconf-error.h"
26
26
 
 
27
G_BEGIN_DECLS
 
28
 
27
29
/* 
28
30
 * A GConfValue is used to pass configuration values around
29
31
 */
55
57
 
56
58
struct _GConfValue {
57
59
  GConfValueType type;
58
 
  union {
59
 
    gchar* string_data;
60
 
    gint int_data;
61
 
    gboolean bool_data;
62
 
    gdouble float_data;
63
 
    GConfSchema* schema_data;
64
 
    struct {
65
 
      GConfValueType type;
66
 
      GSList* list;
67
 
    } list_data;
68
 
    struct {
69
 
      GConfValue* car;
70
 
      GConfValue* cdr;
71
 
    } pair_data;
72
 
  } d;
73
60
};
74
61
 
75
 
#define gconf_value_get_string(x)    ((const gchar*)((x)->d.string_data))
76
 
#define gconf_value_get_int(x)       ((x)->d.int_data)
77
 
#define gconf_value_get_float(x)     ((x)->d.float_data)
78
 
#define gconf_value_get_list_type(x) ((x)->d.list_data.type)
79
 
#define gconf_value_get_list(x)      ((x)->d.list_data.list)
80
 
#define gconf_value_get_car(x)       ((x)->d.pair_data.car)
81
 
#define gconf_value_get_cdr(x)       ((x)->d.pair_data.cdr)
82
 
#define gconf_value_get_bool(x)      ((x)->d.bool_data)
83
 
#define gconf_value_get_schema(x)    ((x)->d.schema_data)
 
62
const char*    gconf_value_get_string    (const GConfValue *value);
 
63
int            gconf_value_get_int       (const GConfValue *value);
 
64
double         gconf_value_get_float     (const GConfValue *value);
 
65
GConfValueType gconf_value_get_list_type (const GConfValue *value);
 
66
GSList*        gconf_value_get_list      (const GConfValue *value);
 
67
GConfValue*    gconf_value_get_car       (const GConfValue *value);
 
68
GConfValue*    gconf_value_get_cdr       (const GConfValue *value);
 
69
gboolean       gconf_value_get_bool      (const GConfValue *value);
 
70
GConfSchema*   gconf_value_get_schema    (const GConfValue *value);
84
71
 
85
72
GConfValue* gconf_value_new                  (GConfValueType type);
86
73
 
87
 
GConfValue* gconf_value_copy                 (GConfValue* src);
 
74
/* doesn't work on complicated types (only string, int, bool, float) */
 
75
GConfValue* gconf_value_new_from_string      (GConfValueType type,
 
76
                                              const gchar* str,
 
77
                                              GError** err);
 
78
 
 
79
GConfValue* gconf_value_copy                 (const GConfValue* src);
88
80
void        gconf_value_free                 (GConfValue* value);
89
81
 
90
82
void        gconf_value_set_int              (GConfValue* value,
96
88
void        gconf_value_set_bool             (GConfValue* value,
97
89
                                              gboolean the_bool);
98
90
void        gconf_value_set_schema           (GConfValue* value,
99
 
                                              GConfSchema* sc);
 
91
                                              const GConfSchema* sc);
100
92
void        gconf_value_set_schema_nocopy    (GConfValue* value,
101
93
                                              GConfSchema* sc);
102
94
void        gconf_value_set_car              (GConfValue* value,
103
 
                                              GConfValue* car);
 
95
                                              const GConfValue* car);
104
96
void        gconf_value_set_car_nocopy       (GConfValue* value,
105
97
                                              GConfValue* car);
106
98
void        gconf_value_set_cdr              (GConfValue* value,
107
 
                                              GConfValue* cdr);
 
99
                                              const GConfValue* cdr);
108
100
void        gconf_value_set_cdr_nocopy       (GConfValue* value,
109
101
                                              GConfValue* cdr);
110
102
/* Set a list of GConfValue, NOT lists or pairs */
115
107
void        gconf_value_set_list             (GConfValue* value,
116
108
                                              GSList* list);
117
109
 
118
 
gchar*      gconf_value_to_string            (GConfValue* value);
 
110
gchar*      gconf_value_to_string            (const GConfValue* value);
 
111
 
 
112
int         gconf_value_compare              (const GConfValue* value_a,
 
113
                                              const GConfValue* value_b);
119
114
 
120
115
/* Meta-information about a key. Not the same as a schema; this is
121
116
 * information stored on the key, the schema is a specification
122
117
 * that may apply to this key.
123
118
 */
124
119
 
 
120
/* FIXME GConfMetaInfo is basically deprecated in favor of stuffing this
 
121
 * info into GConfEntry, though the transition isn't complete.
 
122
 */
 
123
 
125
124
typedef struct _GConfMetaInfo GConfMetaInfo;
126
125
 
127
126
struct _GConfMetaInfo {
130
129
  GTime  mod_time; /* time of the modification */
131
130
};
132
131
 
133
 
#define gconf_meta_info_get_schema(x)    ((const gchar*)(x)->schema)
134
 
#define gconf_meta_info_get_mod_user(x)  ((x)->mod_user)
135
 
#define gconf_meta_info_mod_time(x)  ((x)->mod_time)
136
 
 
137
 
GConfMetaInfo* gconf_meta_info_new         (void);
138
 
void           gconf_meta_info_free     (GConfMetaInfo* gcmi);
139
 
void           gconf_meta_info_set_schema  (GConfMetaInfo* gcmi,
140
 
                                            const gchar* schema_name);
141
 
void           gconf_meta_info_set_mod_user(GConfMetaInfo* gcmi,
142
 
                                            const gchar* mod_user);
143
 
void           gconf_meta_info_set_mod_time(GConfMetaInfo* gcmi,
144
 
                                            GTime mod_time);
 
132
const char* gconf_meta_info_get_schema   (GConfMetaInfo *gcmi);
 
133
const char* gconf_meta_info_get_mod_user (GConfMetaInfo *gcmi);
 
134
GTime       gconf_meta_info_mod_time     (GConfMetaInfo *gcmi);
 
135
 
 
136
GConfMetaInfo* gconf_meta_info_new          (void);
 
137
void           gconf_meta_info_free         (GConfMetaInfo *gcmi);
 
138
void           gconf_meta_info_set_schema   (GConfMetaInfo *gcmi,
 
139
                                             const gchar   *schema_name);
 
140
void           gconf_meta_info_set_mod_user (GConfMetaInfo *gcmi,
 
141
                                             const gchar   *mod_user);
 
142
void           gconf_meta_info_set_mod_time (GConfMetaInfo *gcmi,
 
143
                                             GTime          mod_time);
 
144
 
145
145
 
146
146
 
147
147
/* Key-value pairs; used to list the contents of
148
148
 *  a directory
149
149
 */  
150
150
 
 
151
typedef enum
 
152
{
 
153
  GCONF_UNSET_INCLUDING_SCHEMA_NAMES = 1 << 0
 
154
} GConfUnsetFlags;
 
155
 
151
156
typedef struct _GConfEntry GConfEntry;
152
157
 
153
158
struct _GConfEntry {
154
 
  gchar* key;
155
 
  GConfValue* value;
156
 
  gchar* schema_name;
157
 
  guint is_default : 1;
158
 
  guint is_writable : 1;
 
159
  char *key;
 
160
  GConfValue *value;
159
161
};
160
162
 
161
 
#define     gconf_entry_get_key(x)         ((const gchar*)(x)->key)
162
 
#define     gconf_entry_get_value(x)       ((x)->value)
163
 
#define     gconf_entry_get_schema_name(x) ((const gchar*)(x)->schema_name)
164
 
#define     gconf_entry_get_is_default(x)  ((x)->is_default)
165
 
#define     gconf_entry_get_is_writable(x) ((x)->is_writable)
 
163
const char* gconf_entry_get_key         (const GConfEntry *entry);
 
164
GConfValue* gconf_entry_get_value       (const GConfEntry *entry);
 
165
const char* gconf_entry_get_schema_name (const GConfEntry *entry);
 
166
gboolean    gconf_entry_get_is_default  (const GConfEntry *entry);
 
167
gboolean    gconf_entry_get_is_writable (const GConfEntry *entry);
166
168
 
167
169
GConfEntry* gconf_entry_new              (const gchar *key,
168
 
                                          GConfValue  *val);
 
170
                                          const GConfValue  *val);
169
171
GConfEntry* gconf_entry_new_nocopy       (gchar       *key,
170
172
                                          GConfValue  *val);
 
173
 
 
174
GConfEntry* gconf_entry_copy             (const GConfEntry *src);
 
175
#ifndef GCONF_DISABLE_DEPRECATED
171
176
void        gconf_entry_free             (GConfEntry  *entry);
 
177
#endif
 
178
void        gconf_entry_ref   (GConfEntry *entry);
 
179
void        gconf_entry_unref (GConfEntry *entry);
172
180
 
173
181
/* Transfer ownership of value to the caller. */
174
182
GConfValue* gconf_entry_steal_value      (GConfEntry  *entry);
175
183
void        gconf_entry_set_value        (GConfEntry  *entry,
176
 
                                          GConfValue  *val);
 
184
                                          const GConfValue  *val);
177
185
void        gconf_entry_set_value_nocopy (GConfEntry  *entry,
178
186
                                          GConfValue  *val);
179
187
void        gconf_entry_set_schema_name  (GConfEntry  *entry,
183
191
void        gconf_entry_set_is_writable  (GConfEntry  *entry,
184
192
                                          gboolean     is_writable);
185
193
 
 
194
gboolean    gconf_entry_equal            (const GConfEntry *a,
 
195
                                          const GConfEntry *b);
 
196
 
 
197
G_END_DECLS
 
198
 
186
199
#endif
187
200
 
188
201