d33fe72a48e38efd051e28eac62dc06eb6d0d23f
[mikachu/openbox.git] / obt / ddparse.h
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3    obt/ddparse.h for the Openbox window manager
4    Copyright (c) 2009        Dana Jansens
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    See the COPYING file for a copy of the GNU General Public License.
17 */
18
19 #include <glib.h>
20
21 typedef struct _ObtDDParseGroup ObtDDParseGroup;
22
23 typedef enum {
24     OBT_DDPARSE_STRING,
25     OBT_DDPARSE_LOCALESTRING,
26     OBT_DDPARSE_STRINGS,
27     OBT_DDPARSE_LOCALESTRINGS,
28     OBT_DDPARSE_BOOLEAN,
29     OBT_DDPARSE_NUMERIC,
30     OBT_DDPARSE_ENUM_APPLICATION,
31     OBT_DDPARSE_ENVIRONMENTS,
32     OBT_DDPARSE_NUM_VALUE_TYPES
33 } ObtDDParseValueType;
34
35 typedef struct _ObtDDParseValue {
36     ObtDDParseValueType type;
37     union _ObtDDParseValueValue {
38         gchar *string;
39         struct _ObtDDParseValueStrings {
40             gchar *s;
41             gulong n;
42         } strings;
43         gboolean boolean;
44         gfloat numeric;
45         guint enumerable;
46         guint environments; /*!< A mask of flags from ObtLinkEnvMask */
47     } value;
48 } ObtDDParseValue;
49
50 /* Returns a hash table where the keys are groups, and the values are
51    ObtDDParseGroups */
52 GHashTable* obt_ddparse_file(const gchar *name, GSList *paths);
53
54 /* Returns a hash table where the keys are "keys" in the .desktop file,
55    and the values are "values" in the .desktop file, for the group @g. */
56 GHashTable* obt_ddparse_group_keys(ObtDDParseGroup *g);