[epiphany/wip/sync: 82/86] bookmark: Implement _to_bso() interface method
- From: Gabriel Ivașcu <gabrielivascu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/wip/sync: 82/86] bookmark: Implement _to_bso() interface method
- Date: Wed, 22 Mar 2017 15:36:49 +0000 (UTC)
commit bca2e04705ca780bb7fea1946ae294d6624cd9ee
Author: Gabriel Ivascu <ivascu gabriel59 gmail com>
Date: Tue Mar 21 17:33:55 2017 +0200
bookmark: Implement _to_bso() interface method
src/bookmarks/ephy-bookmark.c | 28 +++++++++++++++++++++++++++-
1 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/src/bookmarks/ephy-bookmark.c b/src/bookmarks/ephy-bookmark.c
index 51ecf12..da4ad74 100644
--- a/src/bookmarks/ephy-bookmark.c
+++ b/src/bookmarks/ephy-bookmark.c
@@ -348,7 +348,33 @@ ephy_bookmark_synchronizable_set_is_uploaded (EphySynchronizable *synchronizable
static char *
ephy_bookmark_synchronizable_to_bso (EphySynchronizable *synchronizable)
{
- return NULL;
+ EphyBookmark *bookmark = EPHY_BOOKMARK (synchronizable);
+ EphySyncService *service;
+ SyncCryptoKeyBundle *bundle;
+ char *bso = NULL;
+ char *serialized;
+ char *payload;
+
+ service = ephy_shell_get_sync_service (ephy_shell_get_default ());
+ bundle = ephy_sync_service_get_key_bundle (service, "bookmarks");
+ serialized = json_gobject_to_data (G_OBJECT (bookmark), NULL);
+
+ payload = ephy_sync_crypto_encrypt_record (serialized, bundle);
+ if (!payload) {
+ g_warning ("Failed to encrypt bookmark");
+ goto free_serialized;
+ }
+
+ bso = ephy_sync_utils_build_json_string (FALSE,
+ "id", bookmark->id,
+ "payload", payload,
+ NULL);
+
+ g_free (payload);
+free_serialized:
+ g_free (serialized);
+
+ return bso;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]