~ubuntu-branches/ubuntu/trusty/vino/trusty-proposed

« back to all changes in this revision

Viewing changes to common/vino-keyring.c

  • Committer: Package Import Robot
  • Author(s): Robert Ancell
  • Date: 2012-08-21 17:07:41 UTC
  • mfrom: (1.1.63)
  • Revision ID: package-import@ubuntu.com-20120821170741-zj374mk9p2ij8jvr
Tags: 3.5.90-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
 
33
33
/* TODO: canhas async? */
34
34
 
35
 
#include <gnome-keyring.h>
 
35
#include <secret/secret.h>
36
36
 
37
37
char *
38
38
vino_keyring_get_password (void)
39
39
{
40
 
  GnomeKeyringNetworkPasswordData *found_item;
41
 
  GnomeKeyringResult               result;
42
 
  GList                           *matches;
43
 
  char                            *password;
44
 
 
45
 
  matches = NULL;
46
 
 
47
 
  result = gnome_keyring_find_network_password_sync (
48
 
                NULL,           /* user     */
49
 
                NULL,           /* domain   */
50
 
                "vino.local",   /* server   */
51
 
                NULL,           /* object   */
52
 
                "rfb",          /* protocol */
53
 
                "vnc-password", /* authtype */
54
 
                5900,           /* port     */
55
 
                &matches);
56
 
 
57
 
  if (result != GNOME_KEYRING_RESULT_OK || matches == NULL || matches->data == NULL)
58
 
    return NULL;
59
 
 
60
 
  found_item = (GnomeKeyringNetworkPasswordData *) matches->data;
61
 
 
62
 
  password = g_strdup (found_item->password);
63
 
 
64
 
  gnome_keyring_network_password_list_free (matches);
65
 
 
66
 
  return password;
 
40
  return secret_password_lookup (SECRET_SCHEMA_COMPAT_NETWORK,
 
41
                                 NULL, NULL,
 
42
                                 "server", "vino.local",
 
43
                                 "protocol", "rfb",
 
44
                                 "authtype", "vnc-password",
 
45
                                 "port", 5900,
 
46
                                 NULL);
67
47
}
68
48
 
69
49
gboolean
70
50
vino_keyring_set_password (const char *password)
71
51
{
72
 
  GnomeKeyringResult result;
73
 
  guint32            item_id;
74
 
 
75
 
  result = gnome_keyring_set_network_password_sync (
76
 
                NULL,           /* default keyring */
77
 
                NULL,           /* user            */
78
 
                NULL,           /* domain          */
79
 
                "vino.local",   /* server          */
80
 
                NULL,           /* object          */
81
 
                "rfb",          /* protocol        */
82
 
                "vnc-password", /* authtype        */
83
 
                5900,           /* port            */
84
 
                password,       /* password        */
85
 
                &item_id);
86
 
 
87
 
  return result == GNOME_KEYRING_RESULT_OK;
 
52
  return secret_password_store_sync (SECRET_SCHEMA_COMPAT_NETWORK,
 
53
                                     SECRET_COLLECTION_DEFAULT,
 
54
                                     _("Remote desktop sharing password"),
 
55
                                     password, NULL, NULL,
 
56
                                     "server", "vino.local",
 
57
                                     "protocol", "rfb",
 
58
                                     "authtype", "vnc-password",
 
59
                                     "port", 5900,
 
60
                                     NULL);
88
61
}
89
62
 
90
63
#else