Improving persistance.
This commit is contained in:
parent
1597d9ece5
commit
bf98d67b8f
@ -359,7 +359,7 @@ GrafoscopioGUI class >> startDockingBar [
|
||||
|
||||
launchMenu := MenuMorph new.
|
||||
launchMenu
|
||||
add: 'New notebook' target: (GrafoscopioNotebook new) selector: #open;
|
||||
add: 'New notebook' target: (GrafoscopioNotebook new) selector: #openDefault;
|
||||
add: 'Notebook from file...' target: (GrafoscopioNotebook new) selector: #openFromFileSelector;
|
||||
add: 'Notebook from Internet...' target: (self new) selector: #openFromUrlUI;
|
||||
add: 'Recent notebooks...' target: self selector: #openFromRecentlyUsed;
|
||||
|
@ -352,8 +352,11 @@ GrafoscopioNotebook >> saveToFile: aFileReference [
|
||||
|
||||
aFileReference ifNil: [ self inform: 'No file selected for saving. Save NOT done'. ^ self ].
|
||||
workingFile := aFileReference.
|
||||
[ self exportAsSton: self notebook on: (self workingFile writeStream) ]
|
||||
ensure: [(self workingFile writeStream) ifNotNil: #close].
|
||||
self workingFile exists ifTrue: [self workingFile delete].
|
||||
self workingFile ensureCreateFile.
|
||||
[ self exportAsSton: self notebook on: (self workingFile writeStream)]
|
||||
ensure: [ (self workingFile writeStream) ifNotNil: #close ].
|
||||
self inform: ('File saved at: ', String cr, self workingFile fullName).
|
||||
GrafoscopioGUI updateRecentNotebooksWith: aFileReference.
|
||||
|
||||
]
|
||||
@ -375,12 +378,10 @@ GrafoscopioNotebook >> saveToFileUI [
|
||||
{ #category : #persistence }
|
||||
GrafoscopioNotebook >> saveWorkingNotebook [
|
||||
"Saves the current tree to the user predefined file location used when he/she opened it."
|
||||
|
||||
self workingFile exists ifTrue: [self workingFile delete].
|
||||
self workingFile ensureCreateFile.
|
||||
[ self exportAsSton: self notebook on: (self workingFile writeStream)]
|
||||
ensure: [ (self workingFile writeStream) ifNotNil: #close ].
|
||||
self inform: ('File saved at: ', String cr, self workingFile fullName).
|
||||
self workingFile
|
||||
ifNil: [ self saveToFileUI ]
|
||||
ifNotNil: [ self saveToFile: workingFile ]
|
||||
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
|
Loading…
Reference in New Issue
Block a user