Summary: | Toolbar action buttons wrongly refer to translated action names | ||
---|---|---|---|
Product: | Claws Mail (GTK 2) | Reporter: | Albert ARIBAUD <albert.aribaud> |
Component: | UI/Actions | Assignee: | users |
Status: | REOPENED --- | ||
Severity: | normal | ||
Priority: | P3 | ||
Version: | other | ||
Hardware: | PC | ||
OS: | Linux |
Description
Albert ARIBAUD
2014-10-25 18:34:04 UTC
Correction to step #2: ... Select a message and check that the buttons DO NOT work as expected. (buttons call their actions by their translated names, thus having no effect, not even an error message saying there is no action called "Légitime" or "Pourriel". I've followed your instructions as closely as I can, trying more than one variation, and it works fine for me. You seem to be confusing user defined Actions with the built-in 'Learn spam or ham'. Perhaps your instructions lack some vital information. For instance, in the Toolbars configuration you do not say which 'Item type' you are selecting, or the 'Event executed on click' option, not the 'Toolbar text' you have used. @Paul (comment 2): Did you run the CM in French when you tried to reproduce the issue? I made sure the bug reproduction instructions worked, by trying them step by step as I was writing them. I can do a video capture of the screen and attach it to the bug report if that can help. Indeed, I did discover the bug with spam filtering actions; but I did reproduce it with simple coloring actions, and I kept the names Ham and Spam because I knew these names would be translated and would thus trigger the bug. As far as details are concerned: for both buttons item types was "Action" -- that is in fact the only item type you can select if you want to map a button to a user-defined action; and the item selected was the corresponding user defined action of course -- actually, I did not describt this phase as there can only be one way to create a (sorry for the mistyping) ... to create a button mapped to a user-defined action Further analysis shows that: - in toolbar_main.xml, the added "Spam" button is represented as follows: <item file="mail_receive_all" text="Spam" action="A_CLAWS_ACTION"/> This XML fragment is read in src/toolbar.c, whose line 370 copies the 'text' attribute into a ToolbarItem's text field: item->text = g_strdup (*value ? gettext(value):""); After this line, item->text equals "Pourriel" -- and the "Red" is lost. Later on, when creating the ToolbarClawsActions struct, the action name is copied from the (translated) item's text field. Later yet, prefs_actions_find_by_name() is called with the action's (translated) name -- and since no action "Pourriel" exists, none is taken. A solution would be to store the untranslated action name in the gchar* 'text' field to the ToolbarItem and to only translate it when building the actual toolbar button. I did try the following diff, which made the button work as expected. @@ -367,7 +367,7 @@ static void toolbar_parse_item(XMLFile *file, ToolbarType source) if (g_utf8_collate(name, TOOLBAR_ICON_FILE) == 0) item->file = g_strdup (value); else if (g_utf8_collate(name, TOOLBAR_ICON_TEXT) == 0) - item->text = g_strdup (*value ? gettext(value):""); + item->text = g_strdup (value); else if (g_utf8_collate(name, TOOLBAR_ICON_ACTION) == 0) item->index = toolbar_ret_val_from_text(value); if (item->index == -1 && !strcmp(value, "A_DELETE")) { @@ -2150,7 +2150,7 @@ Toolbar *toolbar_create(ToolbarType type, #endif case A_CLAWS_ACTIONS: - TOOLBAR_ITEM(item,icon_wid,toolbar_item->text,toolbar_item->text); + TOOLBAR_ITEM(item,icon_wid,gettext(toolbar_item->text),toolbar_item->text); action_item = g_new0(ToolbarClawsActions, 1); action_item->widget = item; action_item->name = g_strdup(toolbar_item->text); Of course, this is not a viable patch, only a proof of analysis. |