[epiphany/wip/ephy-sync: 80/86] sync-service: Add is_signed_in function



commit 21d99d60133f13551755b916fb6b6f01f011f081
Author: Gabriel Ivascu <ivascu gabriel59 gmail com>
Date:   Sat Jul 30 17:17:30 2016 +0300

    sync-service: Add is_signed_in function

 src/ephy-sync-service.c |    6 ++++++
 src/ephy-sync-service.h |    2 ++
 src/prefs-dialog.c      |    7 +++----
 3 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/ephy-sync-service.c b/src/ephy-sync-service.c
index 0e9fbf6..90dc848 100644
--- a/src/ephy-sync-service.c
+++ b/src/ephy-sync-service.c
@@ -703,6 +703,12 @@ ephy_sync_service_token_name_from_type (EphySyncServiceTokenType token_type)
   }
 }
 
+gboolean
+ephy_sync_service_is_signed_in (EphySyncService *self)
+{
+  return self->user_email != NULL;
+}
+
 gchar *
 ephy_sync_service_get_user_email (EphySyncService *self)
 {
diff --git a/src/ephy-sync-service.h b/src/ephy-sync-service.h
index 5d6027d..d41ec2a 100644
--- a/src/ephy-sync-service.h
+++ b/src/ephy-sync-service.h
@@ -41,6 +41,8 @@ EphySyncService *ephy_sync_service_new                  (void);
 
 const gchar     *ephy_sync_service_token_name_from_type (EphySyncServiceTokenType token_type);
 
+gboolean         ephy_sync_service_is_signed_in         (EphySyncService *self);
+
 gchar           *ephy_sync_service_get_user_email       (EphySyncService *self);
 
 void             ephy_sync_service_set_user_email       (EphySyncService *self,
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index acf748d..65fb9c7 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -1491,12 +1491,10 @@ static void
 setup_sync_page (PrefsDialog *dialog)
 {
   EphySyncService *service;
-  gchar *email = NULL;
 
   service = ephy_shell_get_global_sync_service (ephy_shell_get_default ());
-  email = ephy_sync_service_get_user_email (service);
 
-  if (email == NULL) {
+  if (ephy_sync_service_is_signed_in (service) == FALSE) {
     setup_fxa_sign_in_view (dialog);
     gtk_container_remove (GTK_CONTAINER (dialog->sync_authenticate_box),
                           dialog->sync_sign_out_box);
@@ -1505,7 +1503,8 @@ setup_sync_page (PrefsDialog *dialog)
                           dialog->sync_sign_in_box);
     /* Translators: the %s refers to the email of the currently logged in user. */
     gtk_label_set_markup (GTK_LABEL (dialog->sync_sign_out_details),
-                          g_strdup_printf (_("Currently logged in as <b>%s</b>"), email));
+                          g_strdup_printf (_("Currently logged in as <b>%s</b>"),
+                                           ephy_sync_service_get_user_email (service)));
   }
 }
 


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