Commit d9ee1353 authored by Stavros Sachtouris's avatar Stavros Sachtouris Committed by Giorgos Korfiatis

Change "sync_on_start" to "ask_to_sync"

The effects of "sync_on_start" have been nullified. The new flag
is not currently used, but it will be reactivated in a follow up
commit.
parent eb435dea
...@@ -230,7 +230,7 @@ class WebSocketProtocol(WebSocket): ...@@ -230,7 +230,7 @@ class WebSocketProtocol(WebSocket):
"directory": <local directory>, "directory": <local directory>,
"exclude": <file path>, "exclude": <file path>,
"language": <en|el>, "language": <en|el>,
"sync_on_start": <true|false> "ask_to_sync": <true|false>
} or {<ERROR>: <ERROR CODE>} } or {<ERROR>: <ERROR CODE>}
-- PUT SETTINGS -- -- PUT SETTINGS --
...@@ -242,7 +242,7 @@ class WebSocketProtocol(WebSocket): ...@@ -242,7 +242,7 @@ class WebSocketProtocol(WebSocket):
"directory": <local directory>, "directory": <local directory>,
"exclude": <file path>, "exclude": <file path>,
"language": <en|el>, "language": <en|el>,
"sync_on_start": <true|false> "ask_to_sync": <true|false>
} }
HELPER: {"CREATED": 201, "action": "put settings",} or HELPER: {"CREATED": 201, "action": "put settings",} or
{<ERROR>: <ERROR CODE>, "action": "get settings",} {<ERROR>: <ERROR CODE>, "action": "get settings",}
...@@ -264,7 +264,7 @@ class WebSocketProtocol(WebSocket): ...@@ -264,7 +264,7 @@ class WebSocketProtocol(WebSocket):
settings = dict( settings = dict(
token=None, url=None, token=None, url=None,
container=None, directory=None, container=None, directory=None,
exclude=None, sync_on_start=True, language="en") exclude=None, ask_to_sync=True, language="en")
cnf = AgkyraConfig() cnf = AgkyraConfig()
essentials = ('url', 'token', 'container', 'directory') essentials = ('url', 'token', 'container', 'directory')
...@@ -356,8 +356,8 @@ class WebSocketProtocol(WebSocket): ...@@ -356,8 +356,8 @@ class WebSocketProtocol(WebSocket):
self.settings[option] = None self.settings[option] = None
self.set_status(code=STATUS['SETTINGS MISSING']) self.set_status(code=STATUS['SETTINGS MISSING'])
self.settings['sync_on_start'] = ( self.settings['ask_to_sync'] = (
self.cnf.get('global', 'sync_on_start') == 'on') self.cnf.get('global', 'ask_to_sync') == 'on')
self.settings['language'] = self.cnf.get('global', 'language') self.settings['language'] = self.cnf.get('global', 'language')
# for option in ('container', 'directory', 'exclude'): # for option in ('container', 'directory', 'exclude'):
...@@ -409,9 +409,8 @@ class WebSocketProtocol(WebSocket): ...@@ -409,9 +409,8 @@ class WebSocketProtocol(WebSocket):
changes = True changes = True
self.cnf.set('global', 'language', self.settings.get('language', 'en')) self.cnf.set('global', 'language', self.settings.get('language', 'en'))
sync_on_start = self.settings.get('sync_on_start', False) ask_to_sync = self.settings.get('ask_to_sync', False)
self.cnf.set( self.cnf.set('global', 'ask_to_sync', 'on' if ask_to_sync else 'off')
'global', 'sync_on_start', 'on' if sync_on_start else 'off')
if changes: if changes:
self.cnf.write() self.cnf.write()
...@@ -574,8 +573,7 @@ class WebSocketProtocol(WebSocket): ...@@ -574,8 +573,7 @@ class WebSocketProtocol(WebSocket):
self._load_settings() self._load_settings()
can_sync = must_reset_syncing and self.can_sync() can_sync = must_reset_syncing and self.can_sync()
if can_sync: if can_sync:
leave_paused = old_status in ok_not_syncing or \ leave_paused = old_status in ok_not_syncing
not self.settings.get('sync_on_start', False)
LOGGER.debug('Restart backend') LOGGER.debug('Restart backend')
self.init_sync(leave_paused=leave_paused) self.init_sync(leave_paused=leave_paused)
......
DEFAULT_GLOBAL = { DEFAULT_GLOBAL = {
"sync_on_start": "on", "ask_to_sync": "on",
"language": "en" "language": "en"
} }
......
...@@ -40,7 +40,7 @@ var globals = { ...@@ -40,7 +40,7 @@ var globals = {
directory: null, directory: null,
exclude: null, exclude: null,
language: 'en', language: 'en',
sync_on_start: true ask_to_sync: true
}, },
status: {synced: 0, unsynced: 0, failed: 0, code: STATUS['UNINITIALIZED']}, status: {synced: 0, unsynced: 0, failed: 0, code: STATUS['UNINITIALIZED']},
authenticated: false, authenticated: false,
......
...@@ -62,7 +62,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. ...@@ -62,7 +62,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
fs.readFileSync(exclude, encoding='utf-8')); fs.readFileSync(exclude, encoding='utf-8'));
} catch (err) {console.log(err);} } catch (err) {console.log(err);}
if (!get_setting('language')) set_setting('language', cur_lang); if (!get_setting('language')) set_setting('language', cur_lang);
if (get_setting('sync_on_start')) $('#start_sync_box').click(); if (get_setting('ask_to_sync')) $('#ask_to_sync_box').click();
}); });
cur_lang = get_setting('language'); cur_lang = get_setting('language');
...@@ -211,7 +211,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. ...@@ -211,7 +211,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
} }
function check_start_sync() { function check_start_sync() {
settings['sync_on_start'] = $('#start_sync_box').is(':checked'); settings['ask_to_sync'] = $('#ask_to_sync_box').is(':checked');
} }
function localize() { function localize() {
...@@ -232,7 +232,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. ...@@ -232,7 +232,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
document.getElementById('title').innerHTML = SETTINGS.TITLE || "Settings"; document.getElementById('title').innerHTML = SETTINGS.TITLE || "Settings";
document.getElementById('appearance_label').innerHTML = SETTINGS.GENERAL || "General"; document.getElementById('appearance_label').innerHTML = SETTINGS.GENERAL || "General";
document.getElementById('language_label').innerHTML = SETTINGS.LANGUAGE || "Language"; document.getElementById('language_label').innerHTML = SETTINGS.LANGUAGE || "Language";
document.getElementById('start_sync_label').innerHTML = SETTINGS.SYNCONSTART || "Sync on Start"; document.getElementById('start_sync_label').innerHTML = SETTINGS["ASK TO SYNC"] || "Ask to sync";
document.getElementById('cloud_label').innerHTML = SETTINGS.CLOUD || "Cloud"; document.getElementById('cloud_label').innerHTML = SETTINGS.CLOUD || "Cloud";
document.getElementById('url_label').innerHTML = SETTINGS.URL || "URL"; document.getElementById('url_label').innerHTML = SETTINGS.URL || "URL";
document.getElementById('token_label').innerHTML = SETTINGS.TOKEN || "Token"; document.getElementById('token_label').innerHTML = SETTINGS.TOKEN || "Token";
...@@ -299,7 +299,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. ...@@ -299,7 +299,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<label id="start_sync_label" for="start_sync" class="right inline">Sync on start up</label> <label id="start_sync_label" for="start_sync" class="right inline">Sync on start up</label>
</div> </div>
<div class="small-9 columns" id="start_sync"> <div class="small-9 columns" id="start_sync">
<input type="checkbox" name="start_sync_box" id="start_sync_box" onchange="check_start_sync();"/> <input type="checkbox" name="ask_to_sync_box" id="ask_to_sync_box" onchange="check_start_sync();"/>
</div> </div>
</div> </div>
</fieldset> </fieldset>
......
...@@ -61,7 +61,6 @@ ...@@ -61,7 +61,6 @@
"TITLE": "Ρυθμίσεις", "TITLE": "Ρυθμίσεις",
"GENERAL": "Γενικές ρυθμίσεις", "GENERAL": "Γενικές ρυθμίσεις",
"LANGUAGE": "Γλώσσα", "LANGUAGE": "Γλώσσα",
"SYNCONSTART": "Έναρξη συγχρονισμού στην εκκίνηση",
"CLOUD": "Απομακρυσμένο σύστημα (νέφος)", "CLOUD": "Απομακρυσμένο σύστημα (νέφος)",
"URL": "Διεύθυνση (URL) νέφους", "URL": "Διεύθυνση (URL) νέφους",
"TOKEN": "Κλειδί token", "TOKEN": "Κλειδί token",
......
...@@ -61,7 +61,6 @@ ...@@ -61,7 +61,6 @@
"TITLE": "Settings", "TITLE": "Settings",
"GENERAL": "General Settings", "GENERAL": "General Settings",
"LANGUAGE": "Language", "LANGUAGE": "Language",
"SYNCONSTART": "Sync on start up",
"CLOUD": "Cloud", "CLOUD": "Cloud",
"URL": "Cloud URL", "URL": "Cloud URL",
"TOKEN": "User Token", "TOKEN": "User Token",
......
...@@ -47,7 +47,7 @@ Commands and examples ...@@ -47,7 +47,7 @@ Commands and examples
agkyra_dir: /home/user/.agkyra agkyra_dir: /home/user/.agkyra
default_sync: default default_sync: default
language: en language: en
sync_on_start: on ask_to_sync: on
cloud default cloud default
url: http://www.example.org/identity/v2.0 url: http://www.example.org/identity/v2.0
token: us3r-t0k3n token: us3r-t0k3n
......
...@@ -26,7 +26,8 @@ Currently, the global settings are the following: ...@@ -26,7 +26,8 @@ Currently, the global settings are the following:
:dfn:`language` The language of the GUI menu, windows and notifications. There are currently two supported languages, Greek (**el**) and English (**en**). The CLI is always in english. :dfn:`language` The language of the GUI menu, windows and notifications. There are currently two supported languages, Greek (**el**) and English (**en**). The CLI is always in english.
default: ``en`` default: ``en``
:dfn:`sync_on_start` A flag indicating whether the syncing should start on start-up. If it is ``off``, the client will start in "paused" mode. :dfn:`ask_to_sync` GUI only flag. Switch on a dialogue box asking user whether syncing should
start (e.g., on startup or when the user modifies settings).
default: ``on`` default: ``on``
Cloud Cloud
......
...@@ -93,7 +93,7 @@ Here is a typical configuration: ...@@ -93,7 +93,7 @@ Here is a typical configuration:
[global] [global]
default_sync = CLD default_sync = CLD
language = en language = en
sync_on_start = on ask_to_sync = on
[cloud "CLD"] [cloud "CLD"]
url = http://www.example.org/identity/v2.0 url = http://www.example.org/identity/v2.0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment