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',
function(){
electron.remote.getCurrentWindow().minimize() }],
// XXX need to detect initial fullscreen state...
// XXX this is almost generic, but it is not usable unless within
// a user event handler...
// ...can we use this on electron???
@ -559,7 +560,7 @@ var AppButtonsActions = actions.Actions({
{
'_': ['minimize',
'minimize -- Minimize'],
'&#8601;': ['fullscreen allways-shown',
'&#8601;': ['fullscreen always-shown',
'toggleFullScreen -- Toggle fullscreen'],
'&times;': ['close',
'close -- Quit'],
@ -601,10 +602,10 @@ module.AppButtons = core.ImageGridFeatures.Feature({
// XXX should this be done by css???
if(fullscreen == 'on'){
buttons.find('.button:not(.allways-shown)').show()
buttons.find('.button:not(.always-shown)').show()
} else {
buttons.find('.button:not(.allways-shown)').hide()
buttons.find('.button:not(.always-shown)').hide()
}
//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',
function(){
this.loadWorkspace(this.config['load-workspace'] || 'default') }],
['stop',
// NOTE: this needs to be done before the .config is saved...
['stop.pre',
function(){
this.saveWorkspace() }],
],

View File

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

View File

@ -72,9 +72,6 @@ var StatusBarActions = actions.Actions({
'bookmark',
],
},
'status-bar-blink': [
'hidden',
],
'status-bar-index': {
'mode': 'normal',
@ -93,6 +90,16 @@ var StatusBarActions = actions.Actions({
'status-bar-changes-text': '*',
'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__: {
@ -773,21 +780,34 @@ module.StatusBar = core.ImageGridFeatures.Feature({
this.toggleStatusBar('?') == 'hidden'
&& this.statusItemBlink('bookmark') }],
// Workspace...
// Workspaces...
['saveWorkspace',
core.makeWorkspaceConfigWriter(
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',
core.makeWorkspaceConfigLoader(
function(){
return Object.keys(StatusBar.config) },
return this.config['status-bar-workspace-attrs'] },
function(workspace){
// XXX not sure about this protocol yet...
if(this.workspace == 'ui-chrome-hidden'){
this.toggleStatusBar('none')
this.toggleStatusBar('hidden')
} else {
'status-bar-mode' in workspace ?
'status-bar' in workspace ?
this.toggleStatusBar(workspace['status-bar'])
: this.toggleStatusBar(this.config['status-bar'])
}

View File

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

View File

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