fixes, cleanup and minor refactoring...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2018-03-21 17:34:26 +03:00
parent acaf471f49
commit 7bdfa7fe62
6 changed files with 43 additions and 17 deletions

View File

@ -182,6 +182,7 @@ var ElectronHostActions = actions.Actions({
minimize: ['Window/Minimize', minimize: ['Window/Minimize',
function(){ function(){
electron.remote.getCurrentWindow().minimize() }], electron.remote.getCurrentWindow().minimize() }],
// XXX need to detect initial fullscreen state...
// XXX this is almost generic, but it is not usable unless within // XXX this is almost generic, but it is not usable unless within
// a user event handler... // a user event handler...
// ...can we use this on electron??? // ...can we use this on electron???
@ -559,7 +560,7 @@ var AppButtonsActions = actions.Actions({
{ {
'_': ['minimize', '_': ['minimize',
'minimize -- Minimize'], 'minimize -- Minimize'],
'&#8601;': ['fullscreen allways-shown', '&#8601;': ['fullscreen always-shown',
'toggleFullScreen -- Toggle fullscreen'], 'toggleFullScreen -- Toggle fullscreen'],
'&times;': ['close', '&times;': ['close',
'close -- Quit'], 'close -- Quit'],
@ -601,10 +602,10 @@ module.AppButtons = core.ImageGridFeatures.Feature({
// XXX should this be done by css??? // XXX should this be done by css???
if(fullscreen == 'on'){ if(fullscreen == 'on'){
buttons.find('.button:not(.allways-shown)').show() buttons.find('.button:not(.always-shown)').show()
} else { } else {
buttons.find('.button:not(.allways-shown)').hide() buttons.find('.button:not(.always-shown)').hide()
} }
//this.toggleFullScreenControls(fullScreen) //this.toggleFullScreenControls(fullScreen)

View File

@ -1618,7 +1618,8 @@ module.makeWorkspaceConfigLoader = function(keys, callback){
} }
}) })
callback && callback.call(this, workspace) callback
&& callback.call(this, workspace)
} }
} }
@ -1738,7 +1739,8 @@ module.Workspace = ImageGridFeatures.Feature({
['start', ['start',
function(){ function(){
this.loadWorkspace(this.config['load-workspace'] || 'default') }], this.loadWorkspace(this.config['load-workspace'] || 'default') }],
['stop', // NOTE: this needs to be done before the .config is saved...
['stop.pre',
function(){ function(){
this.saveWorkspace() }], this.saveWorkspace() }],
], ],

View File

@ -245,6 +245,7 @@ var SingleImageActions = actions.Actions({
if(state == 'on'){ if(state == 'on'){
this.pushWorkspace() this.pushWorkspace()
// base the single image defaults of ui-chrome-hidden...
if(this.workspaces['single-image'] == null){ if(this.workspaces['single-image'] == null){
this.loadWorkspace('ui-chrome-hidden') this.loadWorkspace('ui-chrome-hidden')
this.mergeConfig('single-image-config-defaults') this.mergeConfig('single-image-config-defaults')
@ -548,7 +549,7 @@ module.SingleImageCursor = core.ImageGridFeatures.Feature({
handlers: [ handlers: [
// setup... // setup...
['load', ['start',
function(){ function(){
var mode = this.toggleSingleImage('?') == 'on' ? var mode = this.toggleSingleImage('?') == 'on' ?
'cursor-autohide-on-timeout-single-image-view' 'cursor-autohide-on-timeout-single-image-view'

View File

@ -72,9 +72,6 @@ var StatusBarActions = actions.Actions({
'bookmark', 'bookmark',
], ],
}, },
'status-bar-blink': [
'hidden',
],
'status-bar-index': { 'status-bar-index': {
'mode': 'normal', 'mode': 'normal',
@ -93,6 +90,16 @@ var StatusBarActions = actions.Actions({
'status-bar-changes-text': '*', 'status-bar-changes-text': '*',
'status-bar-edit-mode-indicator-update-interval': 1000, 'status-bar-edit-mode-indicator-update-interval': 1000,
// workspace stuff...
'status-bar-workspace-attrs': [
'status-bar',
],
'status-bar-workspace-defaults': {
'default': 'full',
'single-image': 'minimal',
'slideshow': 'hidden',
},
}, },
__statusbar_elements__: { __statusbar_elements__: {
@ -773,21 +780,34 @@ module.StatusBar = core.ImageGridFeatures.Feature({
this.toggleStatusBar('?') == 'hidden' this.toggleStatusBar('?') == 'hidden'
&& this.statusItemBlink('bookmark') }], && this.statusItemBlink('bookmark') }],
// Workspace... // Workspaces...
['saveWorkspace', ['saveWorkspace',
core.makeWorkspaceConfigWriter( core.makeWorkspaceConfigWriter(
function(){ return Object.keys(StatusBar.config) })], function(){ return Object.keys(StatusBar.config) })],
// workspace defaults...
[[
'loadWorkspace.pre',
'saveWorkspace.pre',
],
function(workspace){
if(!workspace || workspace in this.workspaces){
return
}
this.config['status-bar'] =
(this.config['status-bar-workspace-defaults'][workspace]
|| this.config['status-bar'])
}],
['loadWorkspace', ['loadWorkspace',
core.makeWorkspaceConfigLoader( core.makeWorkspaceConfigLoader(
function(){ function(){
return Object.keys(StatusBar.config) }, return this.config['status-bar-workspace-attrs'] },
function(workspace){ function(workspace){
// XXX not sure about this protocol yet...
if(this.workspace == 'ui-chrome-hidden'){ if(this.workspace == 'ui-chrome-hidden'){
this.toggleStatusBar('none') this.toggleStatusBar('hidden')
} else { } else {
'status-bar-mode' in workspace ? 'status-bar' in workspace ?
this.toggleStatusBar(workspace['status-bar']) this.toggleStatusBar(workspace['status-bar'])
: this.toggleStatusBar(this.config['status-bar']) : this.toggleStatusBar(this.config['status-bar'])
} }

View File

@ -2038,7 +2038,7 @@ var ButtonsActions = actions.Actions({
}, },
'app-buttons': { 'app-buttons': {
[SETTINGS_ICON]: ['ui-settings allways-shown', [ [SETTINGS_ICON]: ['ui-settings always-shown', [
'browseActions: "Interface/" -- Interface settings...', 'browseActions: "Interface/" -- Interface settings...',
'toggleSideButtons -- Toggle touch controls', 'toggleSideButtons -- Toggle touch controls',
]], ]],

View File

@ -1104,11 +1104,13 @@ module.Cursor = core.ImageGridFeatures.Feature({
toggleAutoHideCursorTimeout: ['Interface/Hide cursor on timeout', toggleAutoHideCursorTimeout: ['Interface/Hide cursor on timeout',
core.makeConfigToggler('cursor-autohide-on-timeout', core.makeConfigToggler('cursor-autohide-on-timeout',
['on', 'off'], ['on', 'off'],
function(){ this.toggleAutoHideCursor('!') })], function(){
this.toggleAutoHideCursor('!') })],
toggleAutoHideCursorKeyboard: ['Interface/Hide cursor on keyboard', toggleAutoHideCursorKeyboard: ['Interface/Hide cursor on keyboard',
core.makeConfigToggler('cursor-autohide-on-keyboard', core.makeConfigToggler('cursor-autohide-on-keyboard',
['on', 'off'], ['on', 'off'],
function(){ this.toggleAutoHideCursor('!') })], function(){
this.toggleAutoHideCursor('!') })],
}), }),
handlers: [ handlers: [