[epiphany/wip/sync: 80/86] sync: Use a different schema GSettings schema



commit 6593fd3e4eb306a419abdeab3e195ed221a39131
Author: Gabriel Ivascu <ivascu gabriel59 gmail com>
Date:   Wed Mar 22 22:01:17 2017 +0200

    sync: Use a different schema GSettings schema

 data/org.gnome.epiphany.gschema.xml |   23 +++++++++++++----------
 lib/ephy-prefs.h                    |    6 ++++--
 lib/ephy-settings.h                 |    1 +
 src/prefs-dialog.c                  |    2 +-
 src/sync/ephy-sync-service.c        |    8 ++++----
 5 files changed, 23 insertions(+), 17 deletions(-)
---
diff --git a/data/org.gnome.epiphany.gschema.xml b/data/org.gnome.epiphany.gschema.xml
index 6540572..26c4418 100644
--- a/data/org.gnome.epiphany.gschema.xml
+++ b/data/org.gnome.epiphany.gschema.xml
@@ -6,6 +6,7 @@
                <child schema="org.gnome.Epiphany.state" name="state"/>
                <child schema="org.gnome.Epiphany.lockdown" name="lockdown"/>
                <child schema="org.gnome.Epiphany.permissions" name="permissions"/>
+               <child schema="org.gnome.Epiphany.sync" name="sync"/>
                <key type="b" name="enable-caret-browsing">
                        <default>false</default>
                        <summary>Browse with caret</summary>
@@ -99,16 +100,6 @@
                         <description>This option sets a limit to the number of web processes that will be 
used at the same time for the “one-secondary-process-per-web-view” model. The default value is “0” and means 
no limit.</description>
 
                 </key>
-               <key type="s" name="sync-user">
-                       <default>''</default>
-                       <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>
                 <key type="as" name="adblock-filters">
                         <default>['https://easylist.to/easylist/easylist.txt', 
'https://easylist.to/easylist/easyprivacy.txt']</default>
                         <summary>List of adblock filters</summary>
@@ -275,6 +266,18 @@
                        <default>false</default>
                </key>
        </schema>
+       <schema path="/org/gnome/Epiphany/sync/" id="org.gnome.Epiphany.sync">
+               <key type="s" name="sync-user">
+                       <default>''</default>
+                       <summary>Currently signed in sync user</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 sync was made.</description>
+               </key>
+       </schema>
        <enum id="org.gnome.Epiphany.Permission">
                <value nick="undecided" value="-1"/>
                <value nick="deny" value="0"/>
diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h
index 919037e..71b8eb4 100644
--- a/lib/ephy-prefs.h
+++ b/lib/ephy-prefs.h
@@ -136,8 +136,6 @@ static const char * const ephy_prefs_web_schema[] = {
 #define EPHY_PREFS_RESTORE_SESSION_DELAYING_LOADS     "restore-session-delaying-loads"
 #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_ADBLOCK_FILTERS                    "adblock-filters"
 #define EPHY_PREFS_SEARCH_ENGINES                     "search-engines"
 #define EPHY_PREFS_DEFAULT_SEARCH_ENGINE              "default-search-engine"
@@ -151,6 +149,10 @@ static const char * const ephy_prefs_web_schema[] = {
 #define EPHY_PREFS_LOCKDOWN_PRINTING          "disable-printing"
 #define EPHY_PREFS_LOCKDOWN_QUIT              "disable-quit"
 
+#define EPHY_PREFS_SYNC_SCHEMA "org.gnome.Epiphany.sync"
+#define EPHY_PREFS_SYNC_USER   "sync-user"
+#define EPHY_PREFS_SYNC_TIME   "sync-time"
+
 static struct {
   const char *schema;
   const char *path;
diff --git a/lib/ephy-settings.h b/lib/ephy-settings.h
index 23d80d3..ee186c4 100644
--- a/lib/ephy-settings.h
+++ b/lib/ephy-settings.h
@@ -32,6 +32,7 @@ G_BEGIN_DECLS
 #define EPHY_SETTINGS_WEB       ephy_settings_get (EPHY_PREFS_WEB_SCHEMA)
 #define EPHY_SETTINGS_LOCKDOWN  ephy_settings_get (EPHY_PREFS_LOCKDOWN_SCHEMA)
 #define EPHY_SETTINGS_STATE     ephy_settings_get (EPHY_PREFS_STATE_SCHEMA)
+#define EPHY_SETTINGS_SYNC      ephy_settings_get (EPHY_PREFS_SYNC_SCHEMA)
 
 GSettings *ephy_settings_get (const char *schema);
 
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index 2490209..ea883eb 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -230,7 +230,7 @@ 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,
+    g_settings_set_string (EPHY_SETTINGS_SYNC,
                            EPHY_PREFS_SYNC_USER,
                            ephy_sync_service_get_user_email (service));
 
diff --git a/src/sync/ephy-sync-service.c b/src/sync/ephy-sync-service.c
index 0f52daa..57c79dd 100644
--- a/src/sync/ephy-sync-service.c
+++ b/src/sync/ephy-sync-service.c
@@ -683,7 +683,7 @@ ephy_sync_service_init (EphySyncService *self)
   user_agent = webkit_settings_get_user_agent (settings);
   g_object_set (self->session, "user-agent", user_agent, NULL);
 
-  email = g_settings_get_string (EPHY_SETTINGS_MAIN, EPHY_PREFS_SYNC_USER);
+  email = g_settings_get_string (EPHY_SETTINGS_SYNC, EPHY_PREFS_SYNC_USER);
 
   if (g_strcmp0 (email, "")) {
     ephy_sync_service_set_user_email (self, email);
@@ -733,7 +733,7 @@ ephy_sync_service_get_sync_time (EphySyncService *self)
   if (self->sync_time != 0)
     return self->sync_time;
 
-  self->sync_time = g_settings_get_double (EPHY_SETTINGS_MAIN, EPHY_PREFS_SYNC_TIME);
+  self->sync_time = g_settings_get_double (EPHY_SETTINGS_SYNC, EPHY_PREFS_SYNC_TIME);
   return self->sync_time;
 }
 
@@ -745,7 +745,7 @@ ephy_sync_service_set_sync_time (EphySyncService *self,
   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);
+  g_settings_set_double (EPHY_SETTINGS_SYNC, EPHY_PREFS_SYNC_TIME, time);
 }
 
 const char *
@@ -1189,7 +1189,7 @@ ephy_sync_service_do_sign_out (EphySyncService *self)
   ephy_sync_service_set_user_email (self, NULL);
   ephy_sync_service_set_sync_time (self, 0);
 
-  g_settings_set_string (EPHY_SETTINGS_MAIN, EPHY_PREFS_SYNC_USER, "");
+  g_settings_set_string (EPHY_SETTINGS_SYNC, EPHY_PREFS_SYNC_USER, "");
 }
 
 static void


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