From e73466490fd145b8eb072deca40861d148f2cca1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Dias?= Date: Thu, 4 Feb 2021 15:10:00 -0300 Subject: [PATCH] Add default value for settings --- Iceberg/IceTipCommitSettings.class.st | 31 ++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/Iceberg/IceTipCommitSettings.class.st b/Iceberg/IceTipCommitSettings.class.st index 662467556b..b7a0fcb50b 100644 --- a/Iceberg/IceTipCommitSettings.class.st +++ b/Iceberg/IceTipCommitSettings.class.st @@ -13,7 +13,9 @@ Class { { #category : #accessing } IceTipCommitSettings class >> pushOnCommit [ - ^ pushOnCommit ifNil: [ pushOnCommit := false ] + + ^ pushOnCommit ifNil: [ + pushOnCommit := self pushOnCommitDefaultValue ] ] { #category : #accessing } @@ -21,9 +23,17 @@ IceTipCommitSettings class >> pushOnCommit: aBoolean [ pushOnCommit := aBoolean ] +{ #category : #accessing } +IceTipCommitSettings class >> pushOnCommitDefaultValue [ + + ^ false +] + { #category : #accessing } IceTipCommitSettings class >> saveImageOnCommit [ - ^ saveImageOnCommit ifNil: [ saveImageOnCommit := true ] + + ^ saveImageOnCommit ifNil: [ + saveImageOnCommit := self saveImageOnCommitDefaultValue ] ] { #category : #accessing } @@ -31,8 +41,15 @@ IceTipCommitSettings class >> saveImageOnCommit: aBoolean [ saveImageOnCommit := aBoolean ] +{ #category : #accessing } +IceTipCommitSettings class >> saveImageOnCommitDefaultValue [ + + ^ true +] + { #category : #settings } IceTipCommitSettings class >> settingsOn: aBuilder [ + (aBuilder group: #commitPreferences) parent: #Iceberg; @@ -40,15 +57,19 @@ IceTipCommitSettings class >> settingsOn: aBuilder [ target: self; label: 'Commit action settings'; description: 'Chose the behavior when you commit something'; - with: [ (aBuilder setting: #saveImageOnCommit) + with: [ + (aBuilder setting: #saveImageOnCommit) noOrdering; target: self; + default: self saveImageOnCommitDefaultValue; label: 'Save the image when commiting'; - description: 'Check if you want to save the image each time you commit something'. + description: + 'Check if you want to save the image each time you commit something'. (aBuilder setting: #pushOnCommit) noOrdering; target: self; + default: self pushOnCommitDefaultValue; label: 'Push when commiting'; description: - 'Check if you want to push your changes each time you commit something'. ] + 'Check if you want to push your changes each time you commit something' ] ]