1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
#include <glib.h>
#ifndef DESKTOP_FILE_H
#define DESKTOP_FILE_H
typedef struct _GnomeDesktopFile GnomeDesktopFile;
typedef enum _GnomeDesktopFileEncoding GnomeDesktopFileEncoding;
typedef void (* GnomeDesktopFileSectionFunc) (GnomeDesktopFile *df,
const char *name,
gpointer data);
typedef void (* GnomeDesktopFileLineFunc) (GnomeDesktopFile *df,
const char *key, /* If NULL, value is comment line */
const char *locale,
const char *value, /* This is raw unescaped data */
gpointer data);
enum _GnomeDesktopFileEncoding {
GNOME_DESKTOP_FILE_ENCODING_UTF8,
GNOME_DESKTOP_FILE_ENCODING_LEGACY,
GNOME_DESKTOP_FILE_ENCODING_UNKNOWN
};
typedef enum
{
GNOME_DESKTOP_PARSE_ERROR_INVALID_SYNTAX,
GNOME_DESKTOP_PARSE_ERROR_INVALID_ESCAPES,
GNOME_DESKTOP_PARSE_ERROR_INVALID_CHARS
} GnomeDesktopParseError;
#define GNOME_DESKTOP_PARSE_ERROR gnome_desktop_parse_error_quark()
GQuark gnome_desktop_parse_error_quark (void);
GnomeDesktopFile *gnome_desktop_file_new (GnomeDesktopFileEncoding encoding);
GnomeDesktopFile *gnome_desktop_file_new_from_string (char *data,
GError **error);
GnomeDesktopFile *gnome_desktop_file_load (const char *filename,
GError **error);
gboolean gnome_desktop_file_save (GnomeDesktopFile *df,
const char *path,
int mode,
GError **error);
char * gnome_desktop_file_to_string (GnomeDesktopFile *df);
void gnome_desktop_file_free (GnomeDesktopFile *df);
void gnome_desktop_file_launch (GnomeDesktopFile *df,
char **argv,
int argc,
GError **error);
GnomeDesktopFileEncoding gnome_desktop_file_get_encoding (GnomeDesktopFile *df);
void gnome_desktop_file_foreach_section (GnomeDesktopFile *df,
GnomeDesktopFileSectionFunc func,
gpointer user_data);
void gnome_desktop_file_foreach_key (GnomeDesktopFile *df,
const char *section,
gboolean include_localized,
GnomeDesktopFileLineFunc func,
gpointer user_data);
gboolean gnome_desktop_file_add_section (GnomeDesktopFile *df,
const char *name);
gboolean gnome_desktop_file_remove_section (GnomeDesktopFile *df,
const char *name);
void gnome_desktop_file_rename_section (GnomeDesktopFile *df,
const char *old_name,
const char *new_name);
gboolean gnome_desktop_file_has_section (GnomeDesktopFile *df,
const char *name);
/* Gets the raw text of the key, unescaped */
gboolean gnome_desktop_file_get_raw (GnomeDesktopFile *df,
const char *section,
const char *keyname,
const char *locale,
const char **val);
gboolean gnome_desktop_file_get_boolean (GnomeDesktopFile *df,
const char *section,
const char *keyname,
gboolean *val);
gboolean gnome_desktop_file_get_number (GnomeDesktopFile *df,
const char *section,
const char *keyname,
double *val);
gboolean gnome_desktop_file_get_string (GnomeDesktopFile *df,
const char *section,
const char *keyname,
char **val);
gboolean gnome_desktop_file_get_locale_string (GnomeDesktopFile *df,
const char *section,
const char *keyname,
char **val);
gboolean gnome_desktop_file_get_regexp (GnomeDesktopFile *df,
const char *section,
const char *keyname,
char **val);
gboolean gnome_desktop_file_get_booleans (GnomeDesktopFile *df,
const char *section,
const char *keyname,
gboolean **vals,
int *len);
gboolean gnome_desktop_file_get_numbers (GnomeDesktopFile *df,
const char *section,
const char *keyname,
double **vals,
int *len);
gboolean gnome_desktop_file_get_strings (GnomeDesktopFile *df,
const char *section,
const char *keyname,
const char *locale,
char ***vals,
int *len);
gboolean gnome_desktop_file_get_regexps (GnomeDesktopFile *df,
const char *section,
const char *keyname,
char ***vals,
int *len);
void gnome_desktop_file_set_raw (GnomeDesktopFile *df,
const char *section,
const char *keyname,
const char *locale,
const char *value);
gboolean gnome_desktop_file_set_string (GnomeDesktopFile *df,
const char *section,
const char *keyname,
const char *value);
void gnome_desktop_file_set_strings (GnomeDesktopFile *df,
const char *section,
const char *keyname,
const char *locale,
const char **value);
void gnome_desktop_file_merge_string_into_list (GnomeDesktopFile *df,
const char *section,
const char *keyname,
const char *locale,
const char *value);
void gnome_desktop_file_remove_string_from_list (GnomeDesktopFile *df,
const char *section,
const char *keyname,
const char *locale,
const char *value);
const char* desktop_file_get_encoding_for_locale (const char *locale);
void gnome_desktop_file_unset (GnomeDesktopFile *df,
const char *section,
const char *keyname);
void gnome_desktop_file_unset_for_locale (GnomeDesktopFile *df,
const char *section,
const char *keyname,
const char *locale);
void gnome_desktop_file_copy_key (GnomeDesktopFile *df,
const char *section,
const char *source_key,
const char *dest_key);
/* ... More setters ... */
#endif
|