1 /* vi: set et sw=4 ts=4 cino=t0,(0: */
2 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 /*
4  * This file is part of libaccounts-glib
5  *
6  * Copyright (C) 2009-2010 Nokia Corporation.
7  * Copyright (C) 2012-2016 Canonical Ltd.
8  * Copyright (C) 2012 Intel Corporation.
9  *
10  * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
11  * Contact: Jussi Laako <jussi.laako@linux.intel.com>
12  *
13  * This library is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU Lesser General Public License
15  * version 2.1 as published by the Free Software Foundation.
16  *
17  * This library is distributed in the hope that it will be useful, but
18  * WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  * Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with this library; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
25  * 02110-1301 USA
26  */
27 
28 #ifndef _AG_UTIL_H_
29 #define _AG_UTIL_H_
30 
31 #include <glib.h>
32 #include <glib-object.h>
33 #include <libxml/xmlreader.h>
34 #include <sqlite3.h>
35 
36 G_BEGIN_DECLS
37 
38 GString *_ag_string_append_printf (GString *string,
39                                    const gchar *format,
40                                    ...) G_GNUC_INTERNAL;
41 
42 G_GNUC_INTERNAL
43 GValue *_ag_value_slice_dup (const GValue *value);
44 
45 G_GNUC_INTERNAL
46 void _ag_value_slice_free (GValue *value);
47 
48 G_GNUC_INTERNAL
49 GVariant *_ag_value_to_variant (const GValue *value);
50 G_GNUC_INTERNAL
51 void _ag_value_from_variant (GValue *value, GVariant *variant);
52 
53 G_GNUC_INTERNAL
54 gchar *_ag_value_to_db (GVariant *value, gboolean type_annotate);
55 
56 G_GNUC_INTERNAL
57 GVariant *_ag_value_from_db (sqlite3_stmt *stmt, gint col_type, gint col_value);
58 
59 G_GNUC_INTERNAL
60 const GVariantType *_ag_type_from_g_type (GType type);
61 
62 G_GNUC_INTERNAL
63 gboolean _ag_xml_get_boolean (xmlTextReaderPtr reader, gboolean *dest_boolean);
64 
65 G_GNUC_INTERNAL
66 gboolean _ag_xml_get_element_data (xmlTextReaderPtr reader,
67                                    const gchar **dest_ptr);
68 
69 G_GNUC_INTERNAL
70 gboolean _ag_xml_dup_element_data (xmlTextReaderPtr reader, gchar **dest_ptr);
71 
72 G_GNUC_INTERNAL
73 gboolean _ag_xml_parse_settings (xmlTextReaderPtr reader, const gchar *group,
74                                  GHashTable *settings);
75 
76 G_GNUC_INTERNAL
77 gboolean _ag_xml_parse_element_list (xmlTextReaderPtr reader, const gchar *match,
78                                      GHashTable **list);
79 
80 G_GNUC_INTERNAL
81 gchar *_ag_dbus_escape_as_identifier (const gchar *name);
82 
83 G_GNUC_INTERNAL
84 gchar *_ag_find_libaccounts_file (const gchar *file_id,
85                                   const gchar *suffix,
86                                   const gchar *env_var,
87                                   const gchar *subdir);
88 
89 G_END_DECLS
90 
91 #endif /* _AG_UTIL_H_ */
92