]> granicus.if.org Git - mutt/commitdiff
Minor fixes to the x-label patch from David.
authorKevin McCarthy <kevin@8t8.us>
Sun, 29 Jan 2017 02:47:26 +0000 (18:47 -0800)
committerKevin McCarthy <kevin@8t8.us>
Sun, 29 Jan 2017 02:47:26 +0000 (18:47 -0800)
Add L10N comment to sort menu.  Mark a couple strings for localization.

Use ascii_strncasecmp() for the X-Label header comparison.

Simplify label_message() using mutt library routines.

Bind label editing to "Y" instead of "y".  "y" is already used in the
default sample muttrc to display mailboxes.

commands.c
copy.c
curs_main.c
functions.h
headers.c
pager.c

index e734bbfed7db16712fb6ab2523cec0ae798600ea..8b0162b3fd7065cb013fd158bd6ee606389c63d1 100644 (file)
@@ -533,6 +533,10 @@ int mutt_select_sort (int reverse)
   int method = Sort; /* save the current method in case of abort */
 
   switch (mutt_multi_choice (reverse ?
+       /* L10N: The following three are the sort/reverse sort prompts.
+        * Capital letters must match the order of the characters in the third
+        * string.
+        */
                             _("Rev-Sort Date/Frm/Recv/Subj/tO/Thread/Unsort/siZe/sCore/sPam/Label?: ") :
                             _("Sort Date/Frm/Recv/Subj/tO/Thread/Unsort/siZe/sCore/sPam/Label?: "),
                             _("dfrsotuzcpl")))
diff --git a/copy.c b/copy.c
index 3ba0bad02376e695667d86e8c69dfab0dfe60943..f4dbba3e42e3f8c03b9aa0968806dc0022759fbb 100644 (file)
--- a/copy.c
+++ b/copy.c
@@ -112,7 +112,7 @@ mutt_copy_hdr (FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end, int flags,
       }
 
       if (flags & CH_UPDATE_LABEL &&
-         mutt_strncasecmp ("X-Label:", buf, 8) == 0)
+         ascii_strncasecmp ("X-Label:", buf, 8) == 0)
        continue;
 
       if (!ignore && fputs (buf, out) == EOF)
@@ -418,7 +418,7 @@ mutt_copy_header (FILE *in, HEADER *h, FILE *out, int flags, const char *prefix)
       fprintf (out, "Lines: %d\n", h->lines);
   }
 
-  if (flags & CH_UPDATE_LABEL && h->xlabel_changed)
+  if (flags & CH_UPDATE_LABEL)
   {
     h->xlabel_changed = 0;
     if (h->env->x_label != NULL)
index 6362073baa7db60fc7c8a13eae9d3cdc954af553..43417188e50655b944a9d2e8fe33117fb214d934 100644 (file)
@@ -2101,9 +2101,14 @@ int mutt_index_menu (void)
        if (rc > 0) {
          Context->changed = 1;
          menu->redraw = REDRAW_FULL;
-         mutt_message ("%d label%s changed.", rc, rc == 1 ? "" : "s");
+          /* L10N: This is displayed when the x-label on one or more
+           * messages is edited. */
+         mutt_message (_("%d labels changed."), rc);
        }
        else {
+          /* L10N: This is displayed when editing an x-label, but no messages
+           * were updated.  Possibly due to canceling at the prompt or if the new
+           * label is the same as the old label. */
          mutt_message _("No labels changed.");
        }
        break;
index 25a1306ffab08ee4b1101f4dc05b3dae70cb011b..1f7ca59266af8bd66d8b98a0a347c509adff0847 100644 (file)
@@ -99,7 +99,7 @@ const struct binding_t OpMain[] = { /* map: index */
   { "delete-thread",           OP_DELETE_THREAD,               "\004" },
   { "delete-subthread",                OP_DELETE_SUBTHREAD,            "\033d" },
   { "edit",                    OP_EDIT_MESSAGE,                "e" },
-  { "edit-label",              OP_EDIT_LABEL,                  "y" },
+  { "edit-label",              OP_EDIT_LABEL,                  "Y" },
   { "edit-type",               OP_EDIT_TYPE,                   "\005" },
   { "forward-message",         OP_FORWARD_MESSAGE,             "f" },
   { "flag-message",            OP_FLAG_MESSAGE,                "F" },
@@ -201,7 +201,7 @@ const struct binding_t OpPager[] = { /* map: pager */
   { "set-flag",        OP_MAIN_SET_FLAG,               "w" },
   { "clear-flag",       OP_MAIN_CLEAR_FLAG,            "W" },
   { "edit",            OP_EDIT_MESSAGE,                "e" },
-  { "edit-label",      OP_EDIT_LABEL,                  "y" },
+  { "edit-label",      OP_EDIT_LABEL,                  "Y" },
   { "edit-type",       OP_EDIT_TYPE,                   "\005" },
   { "forward-message", OP_FORWARD_MESSAGE,             "f" },
   { "flag-message",    OP_FLAG_MESSAGE,                "F" },
index 48195bd469e6b5cd52af3199b26eddca58f2ceb0..ada4aad49c04f41d23bd3695ced59359faf8cbec 100644 (file)
--- a/headers.c
+++ b/headers.c
@@ -219,17 +219,9 @@ static int label_message(HEADER *hdr, char *new)
 {
   if (hdr == NULL)
     return 0;
-  if (hdr->env->x_label == NULL && new == NULL)
+  if (mutt_strcmp (hdr->env->x_label, new) == 0)
     return 0;
-  if (hdr->env->x_label != NULL && new != NULL &&
-      strcmp(hdr->env->x_label, new) == 0)
-    return 0;
-  if (hdr->env->x_label != NULL)
-    FREE(&hdr->env->x_label);
-  if (new == NULL)
-    hdr->env->x_label = NULL;
-  else
-    hdr->env->x_label = safe_strdup(new);
+  mutt_str_replace (&hdr->env->x_label, new);
   return hdr->changed = hdr->xlabel_changed = 1;
 }
 
diff --git a/pager.c b/pager.c
index 96f0d2c695ba9a6c6d244993e1f29d92a9cb0b6d..8a0e36d65ae65e0989155b93d028a0832f162a28 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -2820,7 +2820,7 @@ search_next:
         if (rc > 0) {
           Context->changed = 1;
           redraw = REDRAW_FULL;
-          mutt_message ("%d label%s changed.", rc, rc == 1 ? "" : "s");
+          mutt_message (_("%d labels changed."), rc);
         }
         else {
           mutt_message _("No labels changed.");