1 /* $Id$ */
2 /*-
3  * Copyright (c) 2003-2007 Benedikt Meurer <benny@xfce.org>
4  * All rights reserved.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library 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 GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free
18  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301 USA
20  */
21 
22 #if !defined(LIBXFCE4UTIL_INSIDE_LIBXFCE4UTIL_H) && !defined(LIBXFCE4UTIL_COMPILATION)
23 #error "Only <libxfce4util/libxfce4util.h> can be included directly, this file may disappear or change contents"
24 #endif
25 
26 #ifndef __XFCE_RC_H__
27 #define __XFCE_RC_H__
28 
29 #include <glib-object.h>
30 #include <libxfce4util/xfce-resource.h>
31 
32 G_BEGIN_DECLS
33 
34 typedef struct _XfceRc XfceRc;
35 
36 #define XFCE_TYPE_RC       (xfce_rc_get_type ())
37 #define XFCE_RC(obj)       ((XfceRc *) (obj))
38 #define XFCE_RC_CONST(obj) ((const XfceRc *) (obj))
39 
40 GType        xfce_rc_get_type                (void);
41 
42 XfceRc*      xfce_rc_simple_open             (const gchar     *filename,
43                                               gboolean         readonly) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
44 
45 XfceRc*      xfce_rc_config_open             (XfceResourceType type,
46                                               const gchar     *resource,
47                                               gboolean         readonly) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
48 
49 void         xfce_rc_close                   (XfceRc *rc);
50 void         xfce_rc_flush                   (XfceRc *rc);
51 void         xfce_rc_rollback                (XfceRc *rc);
52 
53 gboolean     xfce_rc_is_dirty                (const XfceRc *rc) G_GNUC_WARN_UNUSED_RESULT;
54 gboolean     xfce_rc_is_readonly             (const XfceRc *rc) G_GNUC_WARN_UNUSED_RESULT;
55 
56 const gchar* xfce_rc_get_locale              (const XfceRc *rc) G_GNUC_WARN_UNUSED_RESULT;
57 
58 gchar**      xfce_rc_get_groups              (const XfceRc *rc) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
59 gchar**      xfce_rc_get_entries             (const XfceRc *rc,
60                                               const gchar  *group) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
61 
62 void         xfce_rc_delete_group            (XfceRc       *rc,
63                                               const gchar  *group,
64                                               gboolean      global);
65 const gchar* xfce_rc_get_group               (const XfceRc *rc) G_GNUC_WARN_UNUSED_RESULT;
66 gboolean     xfce_rc_has_group               (const XfceRc *rc,
67                                               const gchar  *group) G_GNUC_WARN_UNUSED_RESULT;
68 void         xfce_rc_set_group               (XfceRc       *rc,
69                                               const gchar  *group);
70 
71 void         xfce_rc_delete_entry            (XfceRc       *rc,
72                                               const gchar  *key,
73                                               gboolean      global);
74 gboolean     xfce_rc_has_entry               (const XfceRc *rc,
75                                               const gchar  *key) G_GNUC_WARN_UNUSED_RESULT;
76 
77 const gchar* xfce_rc_read_entry              (const XfceRc *rc,
78                                               const gchar  *key,
79                                               const gchar  *fallback) G_GNUC_WARN_UNUSED_RESULT;
80 const gchar* xfce_rc_read_entry_untranslated (const XfceRc *rc,
81                                               const gchar  *key,
82                                               const gchar  *fallback) G_GNUC_WARN_UNUSED_RESULT;
83 gboolean     xfce_rc_read_bool_entry         (const XfceRc *rc,
84                                               const gchar  *key,
85                                               gboolean      fallback) G_GNUC_WARN_UNUSED_RESULT;
86 gint         xfce_rc_read_int_entry          (const XfceRc *rc,
87                                               const gchar  *key,
88                                               gint          fallback) G_GNUC_WARN_UNUSED_RESULT;
89 gchar**      xfce_rc_read_list_entry         (const XfceRc *rc,
90                                               const gchar  *key,
91                                               const gchar  *delimiter) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
92 void         xfce_rc_write_entry             (XfceRc       *rc,
93                                               const gchar  *key,
94                                               const gchar  *value);
95 void         xfce_rc_write_bool_entry        (XfceRc       *rc,
96                                               const gchar  *key,
97                                               gboolean      value);
98 void         xfce_rc_write_int_entry         (XfceRc       *rc,
99                                               const gchar  *key,
100                                               gint          value);
101 void         xfce_rc_write_list_entry        (XfceRc       *rc,
102                                               const gchar  *key,
103                                               gchar       **value,
104                                               const gchar  *separator);
105 
106 G_END_DECLS
107 
108 #endif /* !__XFCE_RC_H__ */
109 
110