[epiphany/wip/ephy-sync: 124/126] sync-service: Keep sync time as a GSetting
- From: Gabriel - Cristian Ivascu <gabrielivascu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/wip/ephy-sync: 124/126] sync-service: Keep sync time as a GSetting
- Date: Fri, 19 Aug 2016 17:41:59 +0000 (UTC)
commit 479df4549f68b948d79789209cbcb97d99638e8c
Author: Gabriel Ivascu <ivascu gabriel59 gmail com>
Date: Tue Aug 16 11:50:23 2016 +0300
sync-service: Keep sync time as a GSetting
data/org.gnome.epiphany.gschema.xml | 5 +++++
lib/ephy-prefs.h | 1 +
src/ephy-sync-service.c | 24 ++++++++++++++++++++++++
src/ephy-sync-service.h | 3 +++
4 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/data/org.gnome.epiphany.gschema.xml b/data/org.gnome.epiphany.gschema.xml
index 80bee0a..b8f28e5 100644
--- a/data/org.gnome.epiphany.gschema.xml
+++ b/data/org.gnome.epiphany.gschema.xml
@@ -82,6 +82,11 @@
<summary>The sync user currently logged in</summary>
<description>The email linked to the Firefox Account used to sync data with Mozilla's
servers.</description>
</key>
+ <key type="d" name="sync-time">
+ <default>0</default>
+ <summary>Sync timestamp</summary>
+ <description>The timestamp at which last we had the last sync</description>
+ </key>
</schema>
<schema path="/org/gnome/epiphany/ui/" id="org.gnome.Epiphany.ui">
<key type="b" name="always-show-tabs-bar">
diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h
index 2911b11..caaeea4 100644
--- a/lib/ephy-prefs.h
+++ b/lib/ephy-prefs.h
@@ -112,6 +112,7 @@ typedef enum
#define EPHY_PREFS_PROCESS_MODEL "process-model"
#define EPHY_PREFS_MAX_PROCESSES "max-processes"
#define EPHY_PREFS_SYNC_USER "sync-user"
+#define EPHY_PREFS_SYNC_TIME "sync-time"
#define EPHY_PREFS_LOCKDOWN_SCHEMA "org.gnome.Epiphany.lockdown"
#define EPHY_PREFS_LOCKDOWN_FULLSCREEN "disable-fullscreen"
diff --git a/src/ephy-sync-service.c b/src/ephy-sync-service.c
index b865751..962a5ac 100644
--- a/src/ephy-sync-service.c
+++ b/src/ephy-sync-service.c
@@ -51,6 +51,7 @@ struct _EphySyncService {
gchar *kB;
gchar *user_email;
+ double sync_time;
gint64 auth_at;
gboolean is_locked;
@@ -640,6 +641,29 @@ ephy_sync_service_set_user_email (EphySyncService *self,
self->user_email = g_strdup (email);
}
+double
+ephy_sync_service_get_sync_time (EphySyncService *self)
+{
+ g_return_val_if_fail (EPHY_IS_SYNC_SERVICE (self), 0);
+
+ if (self->sync_time != 0)
+ return self->sync_time;
+
+ self->sync_time = g_settings_get_double (EPHY_SETTINGS_MAIN, EPHY_PREFS_SYNC_TIME);
+ return self->sync_time;
+}
+
+
+void
+ephy_sync_service_set_sync_time (EphySyncService *self,
+ double time)
+{
+ g_return_if_fail (EPHY_IS_SYNC_SERVICE (self));
+
+ self->sync_time = time;
+ g_settings_set_double (EPHY_SETTINGS_MAIN, EPHY_PREFS_SYNC_TIME, time);
+}
+
gchar *
ephy_sync_service_get_token (EphySyncService *self,
EphySyncTokenType type)
diff --git a/src/ephy-sync-service.h b/src/ephy-sync-service.h
index 3246f70..7d794e7 100644
--- a/src/ephy-sync-service.h
+++ b/src/ephy-sync-service.h
@@ -36,6 +36,9 @@ gboolean ephy_sync_service_is_signed_in (EphySync
gchar *ephy_sync_service_get_user_email (EphySyncService *self);
void ephy_sync_service_set_user_email (EphySyncService *self,
const gchar *email);
+double ephy_sync_service_get_sync_time (EphySyncService *self);
+void ephy_sync_service_set_sync_time (EphySyncService *self,
+ double time);
gchar *ephy_sync_service_get_token (EphySyncService *self,
EphySyncTokenType type);
void ephy_sync_service_set_token (EphySyncService *self,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]