[epiphany/wip/sync] bookmark: Implment _to_bso() interface method
- From: Gabriel Ivașcu <gabrielivascu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/wip/sync] bookmark: Implment _to_bso() interface method
- Date: Tue, 21 Mar 2017 17:47:20 +0000 (UTC)
commit 8a4cb61c05d67f77fd13734c0857b9625f0c7fe3
Author: Gabriel Ivascu <ivascu gabriel59 gmail com>
Date: Tue Mar 21 17:33:55 2017 +0200
bookmark: Implment _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]