]> granicus.if.org Git - neomutt/commitdiff
print vfolder description on status bar
authorKarel Zak <kzak@redhat.com>
Thu, 15 Dec 2011 21:58:35 +0000 (22:58 +0100)
committerRichard Russon <rich@flatcap.org>
Mon, 4 Apr 2016 15:30:04 +0000 (16:30 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
mutt_notmuch.c
mutt_notmuch.h
status.c

index 43fa12f17270336608a4124e0cd767539a995972..a736383ce27b251ee44530118bc7120b60cb374a 100644 (file)
@@ -701,3 +701,14 @@ done:
        url_free_tags(query_items);
        return rc;
 }
+
+char *nm_get_description(CONTEXT *ctx)
+{
+       BUFFY *p;
+
+       for (p = VirtIncoming; p; p = p->next)
+               if (p->path && p->desc && strcmp(p->path, ctx->path) == 0)
+                       return p->desc;
+
+       return NULL;
+}
index b2ec6f63f0c91e76b401308a1b2b1406ebc75f06..1a1bc36394f189eb2518023e390055e0d3376d49 100644 (file)
@@ -19,4 +19,6 @@ int nm_modify_message_tags(CONTEXT *ctx, HEADER *hdr, char *tags);
 void nm_longrun_init(CONTEXT *cxt, int writable);
 void nm_longrun_done(CONTEXT *cxt);
 
+char *nm_get_description(CONTEXT *ctx);
+
 #endif /* _MUTT_NOTMUCH_H_ */
index 6051e3af6b9bb18fc140fc49c63fca2d6dc89110..c458516e68132ac479b8baaccb68b3f7ed2e2f13 100644 (file)
--- a/status.c
+++ b/status.c
 #include "mapping.h"
 #include "mx.h"
 
+#ifdef USE_NOTMUCH
+#include "mutt_notmuch.h"
+#endif
+
 #include <string.h>
 #include <ctype.h>
 #include <unistd.h>
@@ -95,7 +99,14 @@ status_format_str (char *buf, size_t buflen, size_t col, char op, const char *sr
       break;
 
     case 'f':
-      snprintf (fmt, sizeof(fmt), "%%%ss", prefix);
+    {
+#ifdef USE_NOTMUCH
+      char *p;
+      if (Context && Context->magic == M_NOTMUCH &&
+                   (p = nm_get_description(Context)))
+         strfcpy(tmp, p, sizeof (tmp));
+      else
+#endif
       if (Context && Context->path)
       {
        strfcpy (tmp, Context->path, sizeof (tmp));
@@ -103,9 +114,11 @@ status_format_str (char *buf, size_t buflen, size_t col, char op, const char *sr
       }
       else
        strfcpy (tmp, _("(no mailbox)"), sizeof (tmp));
+
+      snprintf (fmt, sizeof(fmt), "%%%ss", prefix);
       snprintf (buf, buflen, fmt, tmp);
       break;
-
+    }
     case 'F':
       if (!optional)
       {