[Users] [Bug 3310] Toolbar action buttons wrongly refer to translated action names

noreply at thewildbeast.co.uk noreply at thewildbeast.co.uk
Fri Nov 7 21:01:18 CET 2014


http://www.thewildbeast.co.uk/claws-mail/bugzilla/show_bug.cgi?id=3310

--- Comment #5 from Albert ARIBAUD <albert.aribaud at free.fr> ---
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.

-- 
You are receiving this mail because:
You are the assignee for the bug.



More information about the Users mailing list