1
/* NetworkManager -- Network link manager
3
* Dan Williams <dcbw@redhat.com>
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
* (C) Copyright 2005 Red Hat, Inc.
22
#include <gconf/gconf.h>
23
#include <gconf/gconf-client.h>
26
#include "gconf-helpers.h"
30
nm_gconf_get_int_helper (GConfClient *client,
37
GConfValue * gc_value;
38
gboolean success = FALSE;
40
g_return_val_if_fail (key != NULL, FALSE);
41
g_return_val_if_fail (network != NULL, FALSE);
42
g_return_val_if_fail (value != NULL, FALSE);
44
gc_key = g_strdup_printf ("%s/%s/%s", path, network, key);
45
if ((gc_value = gconf_client_get (client, gc_key, NULL)))
47
if (gc_value->type == GCONF_VALUE_INT)
49
*value = gconf_value_get_int (gc_value);
52
gconf_value_free (gc_value);
61
nm_gconf_get_string_helper (GConfClient *client,
68
GConfValue * gc_value;
69
gboolean success = FALSE;
71
g_return_val_if_fail (key != NULL, FALSE);
72
g_return_val_if_fail (network != NULL, FALSE);
73
g_return_val_if_fail (value != NULL, FALSE);
74
g_return_val_if_fail (*value == NULL, FALSE);
76
gc_key = g_strdup_printf ("%s/%s/%s", path, network, key);
77
if ((gc_value = gconf_client_get (client, gc_key, NULL)))
79
if (gc_value->type == GCONF_VALUE_STRING)
81
*value = g_strdup (gconf_value_get_string (gc_value));
84
gconf_value_free (gc_value);
93
nm_gconf_get_bool_helper (GConfClient *client,
100
GConfValue * gc_value;
101
gboolean success = FALSE;
103
g_return_val_if_fail (key != NULL, FALSE);
104
g_return_val_if_fail (network != NULL, FALSE);
105
g_return_val_if_fail (value != NULL, FALSE);
107
gc_key = g_strdup_printf ("%s/%s/%s", path, network, key);
108
if ((gc_value = gconf_client_get (client, gc_key, NULL)))
110
if (gc_value->type == GCONF_VALUE_BOOL)
112
*value = gconf_value_get_bool (gc_value);
115
gconf_value_free (gc_value);