diff options
author | Stef Walter <stefw@gnome.org> | 2012-07-16 09:01:24 -0400 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-09-30 08:54:01 -0400 |
commit | af70f1bec73b2c2ff72300cce93ffbd9c4b9d6ad (patch) | |
tree | df2a6792dfc3b6d424f9a935a67e209b6a42c0ff /services | |
parent | 19da4b91667003095871d771667fbcee0faa9959 (diff) | |
download | evolution-data-server-af70f1bec73b2c2ff72300cce93ffbd9c4b9d6ad.tar.gz |
Bug 679914 - Replace libgnomekeyring with libsecret
Diffstat (limited to 'services')
4 files changed, 50 insertions, 34 deletions
diff --git a/services/evolution-addressbook-factory/Makefile.am b/services/evolution-addressbook-factory/Makefile.am index dbd9f812b..6a8525a14 100644 --- a/services/evolution-addressbook-factory/Makefile.am +++ b/services/evolution-addressbook-factory/Makefile.am @@ -19,7 +19,7 @@ evolution_addressbook_factory_CPPFLAGS = \ -I$(top_builddir) \ -I$(top_builddir)/addressbook \ $(EVOLUTION_ADDRESSBOOK_CFLAGS) \ - $(GNOME_KEYRING_CFLAGS) \ + $(LIBSECRET_CFLAGS) \ $(FACTORY_GTK_CFLAGS) \ $(CAMEL_CFLAGS) \ $(SOUP_CFLAGS) \ @@ -37,7 +37,7 @@ evolution_addressbook_factory_LDADD = \ $(top_builddir)/libebackend/libebackend-1.2.la \ $(top_builddir)/libedataserver/libedataserver-1.2.la \ $(EVOLUTION_ADDRESSBOOK_LIBS) \ - $(GNOME_KEYRING_LIBS) \ + $(LIBSECRET_LIBS) \ $(FACTORY_GTK_LIBS) \ $(CAMEL_LIBS) \ $(SOUP_LIBS) \ diff --git a/services/evolution-calendar-factory/Makefile.am b/services/evolution-calendar-factory/Makefile.am index 2840057fc..2bdb1a401 100644 --- a/services/evolution-calendar-factory/Makefile.am +++ b/services/evolution-calendar-factory/Makefile.am @@ -19,7 +19,7 @@ evolution_calendar_factory_CPPFLAGS = \ -I$(top_builddir) \ -I$(top_builddir)/calendar \ $(EVOLUTION_CALENDAR_CFLAGS) \ - $(GNOME_KEYRING_CFLAGS) \ + $(LIBSECRET_CFLAGS) \ $(FACTORY_GTK_CFLAGS) \ $(CAMEL_CFLAGS) \ $(SOUP_CFLAGS) \ @@ -36,7 +36,7 @@ evolution_calendar_factory_LDADD = \ $(top_builddir)/libebackend/libebackend-1.2.la \ $(top_builddir)/libedataserver/libedataserver-1.2.la \ $(EVOLUTION_CALENDAR_LIBS) \ - $(GNOME_KEYRING_LIBS) \ + $(LIBSECRET_LIBS) \ $(FACTORY_GTK_LIBS) \ $(CAMEL_CFLAGS) \ $(SOUP_LIBS) \ diff --git a/services/evolution-source-registry/Makefile.am b/services/evolution-source-registry/Makefile.am index 72b8a4780..86a533979 100644 --- a/services/evolution-source-registry/Makefile.am +++ b/services/evolution-source-registry/Makefile.am @@ -17,8 +17,8 @@ evolution_source_registry_CPPFLAGS = \ -DG_LOG_DOMAIN=\"evolution-source-registry\" \ -DLOCALEDIR=\"$(localedir)\" \ $(E_DATA_SERVER_CFLAGS) \ - $(GNOME_KEYRING_CFLAGS) \ $(FACTORY_GTK_CFLAGS) \ + $(LIBSECRET_CFLAGS) \ $(CAMEL_CFLAGS) \ $(SOUP_CFLAGS) \ $(NULL) @@ -34,8 +34,8 @@ evolution_source_registry_LDADD = \ $(top_builddir)/libedataserver/libedataserver-1.2.la \ $(top_builddir)/camel/libcamel-1.2.la \ $(E_DATA_SERVER_LIBS) \ - $(GNOME_KEYRING_LIBS) \ $(FACTORY_GTK_LIBS) \ + $(LIBSECRET_LIBS) \ $(CAMEL_LIBS) \ $(SOUP_LIBS) \ $(NULL) diff --git a/services/evolution-source-registry/evolution-source-registry-migrate-sources.c b/services/evolution-source-registry/evolution-source-registry-migrate-sources.c index d590467d2..e6866ec5c 100644 --- a/services/evolution-source-registry/evolution-source-registry-migrate-sources.c +++ b/services/evolution-source-registry/evolution-source-registry-migrate-sources.c @@ -21,7 +21,7 @@ #include <glib/gstdio.h> #include <camel/camel.h> #include <libsoup/soup.h> -#include <gnome-keyring.h> +#include <libsecret/secret.h> #include <libebackend/libebackend.h> @@ -137,15 +137,29 @@ struct _ParseData { PropertyFunc property_func; }; -static GnomeKeyringPasswordSchema schema = { - GNOME_KEYRING_ITEM_GENERIC_SECRET, +/* XXX Probably want to share this with module-online-accounts.c */ +static const SecretSchema schema = { + "org.gnome.Evolution.DataSource", + SECRET_SCHEMA_DONT_MATCH_NAME, { { KEYRING_ITEM_ATTRIBUTE_NAME, - GNOME_KEYRING_ATTRIBUTE_TYPE_STRING }, + SECRET_SCHEMA_ATTRIBUTE_STRING }, { NULL, 0 } } }; +/* XXX Probably want to share this with e-passwords.c */ +static const SecretSchema e_passwords_schema = { + "org.gnome.Evolution.Password", + SECRET_SCHEMA_DONT_MATCH_NAME, + { + { "application", SECRET_SCHEMA_ATTRIBUTE_STRING, }, + { "user", SECRET_SCHEMA_ATTRIBUTE_STRING, }, + { "server", SECRET_SCHEMA_ATTRIBUTE_STRING, }, + { "protocol", SECRET_SCHEMA_ATTRIBUTE_STRING, }, + } +}; + /* Forward Declarations */ void evolution_source_registry_migrate_sources (void); @@ -252,7 +266,7 @@ migrate_keyring_entry (const gchar *uid, const gchar *server, const gchar *protocol) { - GnomeKeyringAttributeList *attributes; + GHashTable *attributes; GList *found_list = NULL; gchar *display_name; @@ -262,37 +276,39 @@ migrate_keyring_entry (const gchar *uid, display_name = g_strdup_printf (KEYRING_ITEM_DISPLAY_FORMAT, uid); - attributes = gnome_keyring_attribute_list_new (); - - gnome_keyring_attribute_list_append_string ( - attributes, "application", "Evolution"); - if (user != NULL) - gnome_keyring_attribute_list_append_string ( - attributes, "user", user); - if (server != NULL) - gnome_keyring_attribute_list_append_string ( - attributes, "server", server); - if (protocol != NULL) - gnome_keyring_attribute_list_append_string ( - attributes, "protocol", protocol); - - gnome_keyring_find_items_sync ( - GNOME_KEYRING_ITEM_NETWORK_PASSWORD, attributes, &found_list); + attributes = secret_attributes_build ( + &e_passwords_schema, + "application", "Evolution", + "user", user, + "server", server, + "protocol", protocol, + NULL); + + found_list = secret_service_search_sync ( + NULL, &e_passwords_schema, attributes, + SECRET_SEARCH_ALL | + SECRET_SEARCH_UNLOCK | + SECRET_SEARCH_LOAD_SECRETS, + NULL, NULL); /* Pick the first match we find. */ if (found_list != NULL) { - GnomeKeyringFound *found = found_list->data; + SecretItem *item = found_list->data; + SecretValue *secret = secret_item_get_secret (item); /* Sanity check. */ - g_return_if_fail (found->secret != NULL); + g_return_if_fail (secret != NULL); + + secret_password_store_sync ( + &schema, SECRET_COLLECTION_DEFAULT, display_name, + secret_value_get (secret, NULL), NULL, NULL, + KEYRING_ITEM_ATTRIBUTE_NAME, uid, NULL); - gnome_keyring_store_password_sync ( - &schema, GNOME_KEYRING_DEFAULT, display_name, - found->secret, KEYRING_ITEM_ATTRIBUTE_NAME, uid, NULL); + secret_value_unref (secret); } - gnome_keyring_attribute_list_free (attributes); - gnome_keyring_found_list_free (found_list); + g_list_free_full (found_list, g_object_unref); + g_hash_table_unref (attributes); g_free (display_name); } |