do even less work before queueing the callback in hopes it is guaranteed to get queued
closes PR 15317
This commit is contained in:
parent
af33c70558
commit
0b2be755e4
|
@ -173,10 +173,23 @@
|
|||
|
||||
;; install-recent-items : (is-a?/c menu%) -> void?
|
||||
(define (install-recent-items menu)
|
||||
;; sometimes, we get here via an on-demand callback
|
||||
;; and we run out of time during the callback and
|
||||
;; things go awry with the menu. So, to hack around
|
||||
;; that problem, lets try to do it twice; once here
|
||||
;; when we notice that things are wrong, and then once
|
||||
;; in a later event callback, when we know we won't run
|
||||
;; afoul of any time limits.
|
||||
(do-install-recent-items menu)
|
||||
(queue-callback (λ () (do-install-recent-items menu)) #f)
|
||||
(void))
|
||||
|
||||
(define (do-install-recent-items menu)
|
||||
(define recently-opened-files
|
||||
(preferences:get
|
||||
'framework:recently-opened-files/pos))
|
||||
(define (update-menu-with-new-stuff)
|
||||
|
||||
(unless (menu-items-still-same? recently-opened-files menu)
|
||||
(for ([item (send menu get-items)]) (send item delete))
|
||||
|
||||
(for ([recent-list-item recently-opened-files])
|
||||
|
@ -188,20 +201,7 @@
|
|||
(new menu-item%
|
||||
[parent menu]
|
||||
[label (string-constant show-recent-items-window-menu-item)]
|
||||
[callback (λ (x y) (show-recent-items-window))]))
|
||||
(unless (menu-items-still-same? recently-opened-files menu)
|
||||
|
||||
;; sometimes, we get here via an on-demand callback
|
||||
;; and we run out of time during the callback and
|
||||
;; things go awry with the menu. So, to hack around
|
||||
;; that problem, lets try to do it twice; once here
|
||||
;; when we notice that things are wrong, and then once
|
||||
;; later, when we know we won't run afoul of any time
|
||||
;; limits.
|
||||
|
||||
(queue-callback (λ () (update-menu-with-new-stuff)) #f)
|
||||
(update-menu-with-new-stuff))
|
||||
(void))
|
||||
[callback (λ (x y) (show-recent-items-window))])))
|
||||
|
||||
(define (recent-list-item->menu-label recent-list-item)
|
||||
(let ([filename (car recent-list-item)])
|
||||
|
|
Loading…
Reference in New Issue
Block a user