2
* Copyright (C) 2003 Sun Microsystems, Inc.
3
* Copyright (C) 2006 Jonh Wendell <wendell@bani.com.br>
4
* Copyright © 2010 Codethink Limited
5
* Copyright (C) 2013 Intel, Inc
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License as
9
* published by the Free Software Foundation; either version 2 of the
10
* License, or (at your option) any later version.
12
* This program is distributed in the hope that it will be useful, but
13
* WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, see <http://www.gnu.org/licenses/>.
21
* Mark McLoughlin <mark@skynet.ie>
22
* Jonh Wendell <wendell@bani.com.br>
23
* Ryan Lortie <desrt@desrt.ca>
26
#include "vino-preferences.h"
29
#include <glib/gi18n.h>
32
vino_get_authtype (GValue *value,
39
g_variant_iter_init (&iter, variant);
40
g_value_set_boolean (value, TRUE);
42
while (g_variant_iter_next (&iter, "s", &type))
43
if (strcmp (type, "none") == 0)
44
g_value_set_boolean (value, FALSE);
50
vino_set_authtype (const GValue *value,
51
const GVariantType *type,
54
const gchar *authtype;
56
if (g_value_get_boolean (value))
61
return g_variant_new_strv (&authtype, 1);
65
vino_get_password (GValue *value,
71
setting = g_variant_get_string (variant, NULL);
73
if (strcmp (setting, "keyring") == 0)
75
/* "keyring" is the default value, even though vino doesn't support it at
78
g_value_set_static_string (value, "");
87
decoded = (gchar *) g_base64_decode (setting, &length);
89
if ((ok = g_utf8_validate (decoded, length, NULL)))
90
g_value_take_string (value, g_strndup (decoded, length));
97
vino_set_password (const GValue *value,
98
const GVariantType *type,
104
string = g_value_get_string (value);
106
base64 = g_base64_encode ((guchar *) string, strlen (string));
107
return g_variant_new_from_data (G_VARIANT_TYPE_STRING,
108
base64, strlen (base64) + 1,
109
TRUE, g_free, base64);