talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 0fec6a07b67735eedb29e20e987a7096e5d8f78d
parent 73ba30d10ad422feef0a8c3de5b178349ccb39f3
Author: Andrej Kacian <ticho@claws-mail.org>
Date:   Mon, 10 Oct 2016 20:08:49 +0200

Improve plural handling of a file insert string.

Fixes bug #3711.

Diffstat:
Msrc/compose.c | 16+++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/compose.c b/src/compose.c @@ -11347,6 +11347,8 @@ static void compose_insert_drag_received_cb (GtkWidget *widget, Compose *compose = (Compose *)user_data; GList *list, *tmp; GdkAtom type; + guint num_files; + gchar *msg; /* strangely, testing data->type == gdk_atom_intern("text/uri-list", TRUE) * does not work */ @@ -11356,6 +11358,7 @@ static void compose_insert_drag_received_cb (GtkWidget *widget, const gchar* ddata = (const gchar *)gtk_selection_data_get_data(data); list = uri_list_extract_filenames(ddata); + num_files = g_list_length(list); if (list == NULL && strstr(ddata, "://")) { /* Assume a list of no files, and data has ://, is a remote link */ gchar *tmpdata = g_strstrip(g_strdup(ddata)); @@ -11371,11 +11374,18 @@ static void compose_insert_drag_received_cb (GtkWidget *widget, } switch (prefs_common.compose_dnd_mode) { case COMPOSE_DND_ASK: - val = alertpanel_full(_("Insert or attach?"), - _("Do you want to insert the contents of the file(s) " - "into the message body, or attach it to the email?"), + msg = g_strdup_printf( + ngettext( + "Do you want to insert the contents of the file " + "into the message body, or attach it to the email?", + "Do you want to insert the contents of the %d files " + "into the message body, or attach them to the email?", + num_files), + num_files); + val = alertpanel_full(_("Insert or attach?"), msg, GTK_STOCK_CANCEL, g_strconcat("+", _("_Insert"), NULL), _("_Attach"), TRUE, NULL, ALERT_QUESTION, G_ALERTALTERNATE); + g_free(msg); break; case COMPOSE_DND_INSERT: val = G_ALERTALTERNATE;