aboutsummaryrefslogtreecommitdiff
path: root/src/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c476
1 files changed, 238 insertions, 238 deletions
diff --git a/src/config.c b/src/config.c
index 11ac92d..60b5792 100644
--- a/src/config.c
+++ b/src/config.c
@@ -127,18 +127,18 @@ int
127string_to (const char *what, const char *str, 127string_to (const char *what, const char *str,
128 const char **args, int *vals, 128 const char **args, int *vals,
129 int *pret, 129 int *pret,
130 gconf_locus_t *locus) 130 grecs_locus_t *locus)
131{ 131{
132 ptrdiff_t x = ARGMATCH (str, args, vals); 132 ptrdiff_t x = ARGMATCH (str, args, vals);
133 133
134 if (x == (ptrdiff_t)-1) 134 if (x == (ptrdiff_t)-1)
135 { 135 {
136 gconf_error (locus, 0, _("unknown %s: %s"), what, str); 136 grecs_error (locus, 0, _("unknown %s: %s"), what, str);
137 return 1; 137 return 1;
138 } 138 }
139 else if (x == (ptrdiff_t)-2) 139 else if (x == (ptrdiff_t)-2)
140 { 140 {
141 gconf_error (locus, 0, _("ambiguous %s: %s"), what, str); 141 grecs_error (locus, 0, _("ambiguous %s: %s"), what, str);
142 return 1; 142 return 1;
143 } 143 }
144 *pret = vals[x]; 144 *pret = vals[x];
@@ -169,7 +169,7 @@ notification_event_str (enum notification_event evt)
169} 169}
170 170
171int 171int
172string_to_notification_event (gconf_locus_t *locus, const char *val, 172string_to_notification_event (grecs_locus_t *locus, const char *val,
173 enum notification_event *pret) 173 enum notification_event *pret)
174{ 174{
175 int rc, res; 175 int rc, res;
@@ -203,7 +203,7 @@ notification_target_str (enum notification_target tgt)
203} 203}
204 204
205int 205int
206string_to_notification_target (gconf_locus_t *locus, const char *val, 206string_to_notification_target (grecs_locus_t *locus, const char *val,
207 enum notification_target *pret) 207 enum notification_target *pret)
208{ 208{
209 int rc, res; 209 int rc, res;
@@ -217,35 +217,35 @@ string_to_notification_target (gconf_locus_t *locus, const char *val,
217 217
218 218
219int 219int
220assert_string_arg (gconf_locus_t *locus, 220assert_string_arg (grecs_locus_t *locus,
221 enum gconf_callback_command cmd, 221 enum grecs_callback_command cmd,
222 const gconf_value_t *value) 222 const grecs_value_t *value)
223{ 223{
224 if (cmd != gconf_callback_set_value) 224 if (cmd != grecs_callback_set_value)
225 { 225 {
226 gconf_error (locus, 0, _("Unexpected block statement")); 226 grecs_error (locus, 0, _("Unexpected block statement"));
227 return 1; 227 return 1;
228 } 228 }
229 if (!value || value->type != GCONF_TYPE_STRING) 229 if (!value || value->type != GCONF_TYPE_STRING)
230 { 230 {
231 gconf_error (locus, 0, _("expected scalar value as a tag")); 231 grecs_error (locus, 0, _("expected scalar value as a tag"));
232 return 1; 232 return 1;
233 } 233 }
234 return 0; 234 return 0;
235} 235}
236 236
237gconf_value_t * 237grecs_value_t *
238get_arg (gconf_locus_t *locus, gconf_value_t *value, unsigned n, int type) 238get_arg (grecs_locus_t *locus, grecs_value_t *value, unsigned n, int type)
239{ 239{
240 if (n >= value->v.arg.c) 240 if (n >= value->v.arg.c)
241 { 241 {
242 gconf_error (locus, 0, _("not enough arguments")); 242 grecs_error (locus, 0, _("not enough arguments"));
243 return NULL; 243 return NULL;
244 } 244 }
245 value = value->v.arg.v + n; 245 value = value->v.arg.v + n;
246 if (value->type != type) 246 if (value->type != type)
247 { 247 {
248 gconf_error (locus, 0, _("argument %d has wrong type"), n); 248 grecs_error (locus, 0, _("argument %d has wrong type"), n);
249 return NULL; 249 return NULL;
250 } 250 }
251 return value; 251 return value;
@@ -253,10 +253,10 @@ get_arg (gconf_locus_t *locus, gconf_value_t *value, unsigned n, int type)
253 253
254 254
255static int 255static int
256cb_mailer (enum gconf_callback_command cmd, 256cb_mailer (enum grecs_callback_command cmd,
257 gconf_locus_t *locus, 257 grecs_locus_t *locus,
258 void *varptr, 258 void *varptr,
259 gconf_value_t *value, 259 grecs_value_t *value,
260 void *cb_data) 260 void *cb_data)
261{ 261{
262 int rc; 262 int rc;
@@ -265,16 +265,16 @@ cb_mailer (enum gconf_callback_command cmd,
265 return 1; 265 return 1;
266 rc = mu_mailer_create (&mailer, value->v.string); 266 rc = mu_mailer_create (&mailer, value->v.string);
267 if (rc) 267 if (rc)
268 gconf_error (locus, 0, _("cannot create mailer `%s': %s"), 268 grecs_error (locus, 0, _("cannot create mailer `%s': %s"),
269 value->v.string, mu_strerror (rc)); 269 value->v.string, mu_strerror (rc));
270 return rc; 270 return rc;
271} 271}
272 272
273static int 273static int
274cb_email_address (enum gconf_callback_command cmd, 274cb_email_address (enum grecs_callback_command cmd,
275 gconf_locus_t *locus, 275 grecs_locus_t *locus,
276 void *varptr, 276 void *varptr,
277 gconf_value_t *value, 277 grecs_value_t *value,
278 void *cb_data) 278 void *cb_data)
279{ 279{
280 int rc; 280 int rc;
@@ -286,7 +286,7 @@ cb_email_address (enum gconf_callback_command cmd,
286 rc = mu_address_create (&addr, value->v.string); 286 rc = mu_address_create (&addr, value->v.string);
287 if (rc) 287 if (rc)
288 { 288 {
289 gconf_error (locus, 0, _("%s: invalid email address: %s"), 289 grecs_error (locus, 0, _("%s: invalid email address: %s"),
290 value->v.string, mu_strerror (rc)); 290 value->v.string, mu_strerror (rc));
291 return rc; 291 return rc;
292 } 292 }
@@ -299,7 +299,7 @@ cb_email_address (enum gconf_callback_command cmd,
299 299
300 while (gl_list_iterator_next (&itr, &p, NULL)) 300 while (gl_list_iterator_next (&itr, &p, NULL))
301 { 301 {
302 const gconf_value_t *vp = p; 302 const grecs_value_t *vp = p;
303 mu_address_t a; 303 mu_address_t a;
304 if (assert_string_arg (locus, cmd, vp)) 304 if (assert_string_arg (locus, cmd, vp))
305 return 1; 305 return 1;
@@ -309,7 +309,7 @@ cb_email_address (enum gconf_callback_command cmd,
309 rc = mu_address_union (&addr, a); 309 rc = mu_address_union (&addr, a);
310 else 310 else
311 { 311 {
312 gconf_error (locus, 0, _("%s: invalid email address: %s"), 312 grecs_error (locus, 0, _("%s: invalid email address: %s"),
313 vp->v.string, mu_strerror (rc)); 313 vp->v.string, mu_strerror (rc));
314 } 314 }
315 mu_address_destroy (&a); 315 mu_address_destroy (&a);
@@ -320,7 +320,7 @@ cb_email_address (enum gconf_callback_command cmd,
320 break; 320 break;
321 321
322 case GCONF_TYPE_ARRAY: 322 case GCONF_TYPE_ARRAY:
323 gconf_error (locus, 0, _("too many arguments")); 323 grecs_error (locus, 0, _("too many arguments"));
324 return 1; 324 return 1;
325 } 325 }
326 326
@@ -329,10 +329,10 @@ cb_email_address (enum gconf_callback_command cmd,
329} 329}
330 330
331static int 331static int
332cb_interval (enum gconf_callback_command cmd, 332cb_interval (enum grecs_callback_command cmd,
333 gconf_locus_t *locus, 333 grecs_locus_t *locus,
334 void *varptr, 334 void *varptr,
335 gconf_value_t *value, 335 grecs_value_t *value,
336 void *cb_data) 336 void *cb_data)
337{ 337{
338 int rc; 338 int rc;
@@ -346,7 +346,7 @@ cb_interval (enum gconf_callback_command cmd,
346 /* FIXME 2: Support ISO intervals? */ 346 /* FIXME 2: Support ISO intervals? */
347 rc = parse_time_interval (value->v.string, &interval, &endp); 347 rc = parse_time_interval (value->v.string, &interval, &endp);
348 if (rc) 348 if (rc)
349 gconf_error (locus, 0, _("unrecognized interval format (near `%s')"), 349 grecs_error (locus, 0, _("unrecognized interval format (near `%s')"),
350 endp); 350 endp);
351 else 351 else
352 *(time_t*) varptr = interval; 352 *(time_t*) varptr = interval;
@@ -354,10 +354,10 @@ cb_interval (enum gconf_callback_command cmd,
354} 354}
355 355
356static int 356static int
357cb_absolute_name (enum gconf_callback_command cmd, 357cb_absolute_name (enum grecs_callback_command cmd,
358 gconf_locus_t *locus, 358 grecs_locus_t *locus,
359 void *varptr, 359 void *varptr,
360 gconf_value_t *value, 360 grecs_value_t *value,
361 void *cb_data) 361 void *cb_data)
362{ 362{
363 char *word; 363 char *word;
@@ -368,17 +368,17 @@ cb_absolute_name (enum gconf_callback_command cmd,
368 368
369 word = safe_file_name ((char*)value->v.string); 369 word = safe_file_name ((char*)value->v.string);
370 if (!word || word[0] != '/') 370 if (!word || word[0] != '/')
371 gconf_error (locus, 0, _("must be an absolute file name")); 371 grecs_error (locus, 0, _("must be an absolute file name"));
372 else