[epiphany/wip/sync: 69/86] sync: Set the sync user only when the sync tokens were successfully stored



commit 258e9810162c126efe77bcbb32c73e0263d6f736
Author: Gabriel Ivascu <ivascu gabriel59 gmail com>
Date:   Sat Mar 11 14:08:50 2017 +0200

    sync: Set the sync user only when the sync tokens were successfully stored

 src/prefs-dialog.c           |    5 ++++-
 src/sync/ephy-sync-service.c |    2 --
 2 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index 46e9fa5..2490209 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -230,6 +230,10 @@ sync_tokens_store_finished_cb (EphySyncService *service,
     /* Show the 'Signed in' panel. */
     sync_hide_fxa_iframe (dialog, ephy_sync_service_get_user_email (service));
 
+    g_settings_set_string (EPHY_SETTINGS_MAIN,
+                           EPHY_PREFS_SYNC_USER,
+                           ephy_sync_service_get_user_email (service));
+
     /* Do a first time sync and set a periodical sync to be executed. */
     ephy_sync_service_sync_bookmarks (service, TRUE);
     ephy_sync_service_start_periodical_sync (service, FALSE);
@@ -238,7 +242,6 @@ sync_tokens_store_finished_cb (EphySyncService *service,
     ephy_sync_service_destroy_session (service, NULL);
 
     /* Unset the email and tokens. */
-    g_settings_set_string (EPHY_SETTINGS_MAIN, EPHY_PREFS_SYNC_USER, "");
     ephy_sync_service_set_user_email (service, NULL);
     ephy_sync_service_clear_tokens (service);
 
diff --git a/src/sync/ephy-sync-service.c b/src/sync/ephy-sync-service.c
index cc03407..d7ed443 100644
--- a/src/sync/ephy-sync-service.c
+++ b/src/sync/ephy-sync-service.c
@@ -891,7 +891,6 @@ ephy_sync_service_report_sign_in_error (EphySyncService *self,
   if (clear_tokens) {
     ephy_sync_service_set_user_email (self, NULL);
     ephy_sync_service_clear_tokens (self);
-    g_settings_set_string (EPHY_SETTINGS_MAIN, EPHY_PREFS_SYNC_USER, "");
   }
 }
 
@@ -1079,7 +1078,6 @@ ephy_sync_service_conclude_sign_in (EphySyncService *self,
   kB_hex = ephy_sync_crypto_encode_hex (kB, 0);
 
   /* Save the email and the tokens. */
-  g_settings_set_string (EPHY_SETTINGS_MAIN, EPHY_PREFS_SYNC_USER, data->email);
   ephy_sync_service_set_user_email (self, data->email);
   ephy_sync_service_set_token (self, data->uid, TOKEN_UID);
   ephy_sync_service_set_token (self, data->sessionToken, TOKEN_SESSIONTOKEN);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]