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

[GUI] Open settings window if they must be fixed

parent f2eeddd9
......@@ -288,7 +288,8 @@ window.setInterval(function() {
default: notify('warning'); break;
}
if (globals.open_settings) {
if (globals.open_settings && !globals.settings_are_open) {
log_debug('OPEN SETTINGS IS ' + globals.open_settings);
new_progress = COMMON.MENU.SETTINGSOPEN;
globals.open_settings = false;
settings_menu.click();
......
......@@ -16,7 +16,7 @@
var gui = require('nw.gui');
function is_up(code) { return (code / 100 >> 0) === 1; }
function has_settings_error(code) { return (code / 200 >> 0) === 2; }
function has_settings_error(code) {return (code / 200 >> 0) === 2;}
function remaining(status) {
return status.unsynced - (status.synced + status.failed);
}
......
......@@ -104,14 +104,16 @@ socket.onopen = function() {
log_debug('Send GUI ID to helper');
post_ui_id(this);
}
socket.onmessage = function(e) {
var r = JSON.parse(e.data)
log_debug('RECV: ' + r['action'])
if (globals.authenticated && r['UNAUTHORIZED'] === 401) {
log_debug('Authentication error (wrong token?)');
log_debug('RECV: ' + r['action']);
if (globals.authenticated && r.code >= 200
&& (r.code !== (globals.previous_status || 0))
&& (!globals.settings_are_open)) {
globals.open_settings = true;
return
}
} else globals.open_settings = false;
switch(r['action']) {
case 'post ui_id':
......@@ -147,8 +149,7 @@ socket.onmessage = function(e) {
break;
case 'get status':
globals['status'] = r;
if (!globals.open_settings)
globals.open_settings = has_settings_error(r.code);
globals.previous_status = r.code;
break;
default:
console.log('Incomprehensible response ' + JSON.stringify(r));
......
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