1 /* GConf
2  * Copyright (C) 2002 Red Hat Inc.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef MARKUP_TREE_H
21 #define MARKUP_TREE_H
22 
23 #include <glib.h>
24 #include "gconf/gconf-value.h"
25 
26 typedef struct _MarkupTree  MarkupTree;
27 typedef struct _MarkupDir   MarkupDir;
28 typedef struct _MarkupEntry MarkupEntry;
29 
30 /* Tree */
31 
32 MarkupTree* markup_tree_get        (const char *root_dir,
33                                     guint       dir_mode,
34                                     guint       file_mode,
35                                     gboolean    merged);
36 void        markup_tree_unref      (MarkupTree *tree);
37 void        markup_tree_rebuild    (MarkupTree *tree);
38 MarkupDir*  markup_tree_lookup_dir (MarkupTree *tree,
39                                     const char *full_key,
40                                     GError    **err);
41 MarkupDir*  markup_tree_ensure_dir (MarkupTree *tree,
42                                     const char *full_key,
43                                     GError    **err);
44 
45 gboolean    markup_tree_sync       (MarkupTree *tree,
46                                     GError    **err);
47 
48 /* Directories in the tree */
49 
50 MarkupEntry* markup_dir_lookup_entry  (MarkupDir   *dir,
51                                        const char  *relative_key,
52                                        GError     **err);
53 MarkupEntry* markup_dir_ensure_entry  (MarkupDir   *dir,
54                                        const char  *relative_key,
55                                        GError     **err);
56 MarkupDir*   markup_dir_lookup_subdir (MarkupDir   *dir,
57                                        const char  *relative_key,
58                                        GError     **err);
59 MarkupDir*   markup_dir_ensure_subdir (MarkupDir   *dir,
60                                        const char  *relative_key,
61                                        GError     **err);
62 GSList*      markup_dir_list_entries  (MarkupDir   *dir,
63                                        GError     **err);
64 GSList*      markup_dir_list_subdirs  (MarkupDir   *dir,
65                                        GError     **err);
66 const char*  markup_dir_get_name      (MarkupDir   *dir);
67 
68 /* Value entries in the directory */
69 /* get_value returns a newly-generated GConfValue, caller owns it */
70 GConfValue* markup_entry_get_value       (MarkupEntry       *entry,
71                                           const char       **locales);
72 void        markup_entry_set_value       (MarkupEntry       *entry,
73                                           const GConfValue  *value);
74 void        markup_entry_unset_value     (MarkupEntry       *entry,
75                                           const char        *locale);
76 void        markup_entry_set_schema_name (MarkupEntry       *entry,
77                                           const char        *schema_name);
78 const char* markup_entry_get_name        (MarkupEntry       *entry);
79 const char* markup_entry_get_schema_name (MarkupEntry       *entry);
80 const char* markup_entry_get_mod_user    (MarkupEntry       *entry);
81 GTime       markup_entry_get_mod_time    (MarkupEntry       *entry);
82 
83 #endif
84