ChangesBrowser.st
changeset 133 fa9a37e36a07
parent 132 9bf0c15113f2
child 163 3aa2b2e7db65
--- a/ChangesBrowser.st	Thu Sep 07 14:53:52 1995 +0200
+++ b/ChangesBrowser.st	Sat Sep 09 04:33:11 1995 +0200
@@ -15,7 +15,9 @@
 StandardSystemView subclass:#ChangesBrowser
 	 instanceVariableNames:'changeListView codeView changeFileName changeChunks
 		changePositions changeClassNames changeHeaderLines anyChanges
-		changeNrShown changeNrProcessed skipSignal compareChanges compareCheckBox'
+		changeNrShown changeNrProcessed skipSignal 
+		compareChanges compareCheckBox
+		changeFileSize changeFileTimestamp checkBlock'
 	 classVariableNames:'CompressSnapshotInfo'
 	 poolDictionaries:''
 	 category:'Interface-Browsers'
@@ -25,7 +27,7 @@
 COPYRIGHT (c) 1990 by Claus Gittinger
 	    All Rights Reserved
 
-$Header: /cvs/stx/stx/libtool/ChangesBrowser.st,v 1.44 1995-09-07 12:53:07 claus Exp $
+$Header: /cvs/stx/stx/libtool/ChangesBrowser.st,v 1.45 1995-09-09 02:32:58 claus Exp $
 '!
 
 !ChangesBrowser class methodsFor:'documentation'!
@@ -46,7 +48,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libtool/ChangesBrowser.st,v 1.44 1995-09-07 12:53:07 claus Exp $
+$Header: /cvs/stx/stx/libtool/ChangesBrowser.st,v 1.45 1995-09-09 02:32:58 claus Exp $
 "
 !
 
@@ -193,6 +195,41 @@
 
 !ChangesBrowser methodsFor:'private'!
 
+newLabel:how
+    |l|
+
+    (changeFileName ~= 'changes') ifTrue:[
+	l := 'Changes Browser: ', changeFileName
+    ] ifFalse:[
+	l := 'Changes Browser'
+    ].
+    l := l , ' ' , how.
+    self label:l
+
+    "Created: 8.9.1995 / 19:32:04 / claus"
+    "Modified: 8.9.1995 / 19:39:29 / claus"
+!
+
+checkIfFileHasChanged
+    |f info |
+
+    Processor removeTimedBlock:checkBlock.
+    f := changeFileName asFilename.
+    (info := f info) isNil ifTrue:[
+	self newLabel:'(unaccessable)'
+    ] ifFalse:[
+	(info at:#modified) > changeFileTimestamp ifTrue:[
+	    self newLabel:'(outdated)'
+	] ifFalse:[
+	    self newLabel:''
+	]
+    ].
+    Processor addTimedBlock:checkBlock afterSeconds:5.
+
+    "Created: 8.9.1995 / 19:30:19 / claus"
+    "Modified: 8.9.1995 / 19:38:18 / claus"
+!
+
 readChangesFileInBackground:inBackground
     "read the changes file, create a list of header-lines (changeChunks)
      and a list of chunk-positions (changePositions).
@@ -213,13 +250,17 @@
      default and can be enabled via a toggle.
      "
 
-    |aStream maxLen|
+    |aStream maxLen f|
 
     maxLen := 60.
 
-    aStream := FileStream readonlyFileNamed:changeFileName.
+    f := changeFileName asFilename.
+    aStream :=  f readStream.
     aStream isNil ifTrue:[^ nil].
 
+    changeFileSize := f info at:#size.
+    changeFileTimestamp := f info at:#modified.
+
     self withCursor:(Cursor read) do:[
 	|tabSpec myProcess myPriority|
 
@@ -487,7 +528,9 @@
 	] valueNowOrOnUnwindDo:[
 	    inBackground ifTrue:[myProcess priority:myPriority].
 	].
-    ]
+    ].
+
+    self checkIfFileHasChanged
 
     "Modified: 27.8.1995 / 23:06:55 / claus"
 !
@@ -1465,6 +1508,7 @@
 
     changeFileName := 'changes'.
     compareChanges := false.
+    checkBlock := [self checkIfFileHasChanged].
 
     panel := VariableVerticalPanel origin:(0.0 @ 0.0)
 				   corner:(1.0 @ 1.0)
@@ -1506,7 +1550,7 @@
     self readChangesFileInBackground:true.
     self setChangeList.
     changeListView action:[:lineNr | self changeSelection:lineNr].
-
+    Processor addTimedBlock:checkBlock afterSeconds:5.
 !
 
 update:what
@@ -1666,6 +1710,7 @@
 destroy
     "destroy the receiver; make certain, that boxes are destroyed too"
 
+    Processor removeTimedBlock:checkBlock.
     ObjectMemory removeDependent:self.
     super destroy
 !