From: NeilBrown Date: Thu, 14 Sep 2023 04:01:31 +0000 (+1000) Subject: notmuch: refresh query on "doc:closed" rather than "Close" on view. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=edf6f852558bba07c87d221a10006ce148774666;p=edlib.git notmuch: refresh query on "doc:closed" rather than "Close" on view. When a view is closed, doc:closed is sent to the document. This seems like a slightly better way to trigger the "no-one is watching so refresh", rather than on "Close" from the view - though both work. Signed-off-by: NeilBrown --- diff --git a/python/module-notmuch.py b/python/module-notmuch.py index a24115f2..0f7cc11f 100644 --- a/python/module-notmuch.py +++ b/python/module-notmuch.py @@ -1791,6 +1791,18 @@ class notmuch_query(edlib.Doc): self.maindoc.call(key, str, str2) return 1 + def handle_doc_closed(self, key, **a): + "handle:doc:closed" + # A view on this query has been closed, so now is a good + # time to update the list (prune all archived threads) and + # the counts. + if self.notify("doc:notify-viewers") == 0: + self.load_full() + self.maindoc.call("doc:notmuch:update-one", self['qname']) + + # contine to default handling. + return edlib.Efallthrough + class tag_popup(edlib.Pane): def __init__(self, focus): edlib.Pane.__init__(self, focus) @@ -2689,14 +2701,6 @@ class notmuch_query_view(edlib.Pane): self.clone_children(focus.focus) return 1 - def handle_close(self, key, focus, **a): - "handle:Close" - - # Reload the query so archived messages disappear - self.call("doc:notmuch:query:reload") - self.call("doc:notmuch:update-one", self['qname']) - return 1 - def handle_matched_mids(self, key, focus, str, str2, comm2, **a): "handle-prefix:doc:notmuch-query:matched-" # if whole_thread, everything should be considered matched.