adding network sample
[libicd-wpa] / gconf.c
1 /**
2   @file gconf.c
3
4   Copyright (C) 2009 Javier S. Pedro
5
6   @author Javier S. Pedro <javispedro@javispedro.com>
7
8   This file is part of libicd-network-wpa.
9
10   This program is free software; you can redistribute it and/or modify it
11   under the terms of the GNU General Public License as published by the
12   Free Software Foundation; either version 2 of the License, or (at your
13   option) any later version.
14
15   This program is distributed in the hope that it will be useful, but
16   WITHOUT ANY WARRANTY; without even the implied warranty of
17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18   General Public License for more details.
19
20   You should have received a copy of the GNU General Public License along
21   with this program; if not, write to the Free Software Foundation, Inc.,
22   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23
24 */
25
26 #include <string.h>
27
28 #include <glib.h>
29 #include <gconf/gconf-client.h>
30
31 #include "log.h"
32
33 gchar * gconf_get_string(GConfClient *client, gchar * path)
34 {
35         GError *error = NULL;
36         gchar *value = gconf_client_get_string(client, path, &error);
37         
38         if (error) {
39                 DLOG_ERR("Could not get setting:%s, error:%s", path, 
40                          error->message);
41                          
42                 g_clear_error(&error);
43                 value = NULL;
44         } else if (!value) {
45                 DLOG_ERR("Could not get setting:%s", path);
46         }
47         
48         g_free(path);
49         
50         return value;
51 }