Closes #7395 Added labels to unlabeled items in conversation list context menu

This commit is contained in:
Eric Gregory 2013-08-30 15:23:59 -07:00
parent 9ac7349f59
commit 9c458e34fc
3 changed files with 12 additions and 8 deletions

View file

@ -307,18 +307,18 @@ public class GearyController : Geary.BaseObject {
entries += new_message;
add_accelerator("N", ACTION_NEW_MESSAGE);
Gtk.ActionEntry reply_to_message = { ACTION_REPLY_TO_MESSAGE, null, null, "<Ctrl>R",
Gtk.ActionEntry reply_to_message = { ACTION_REPLY_TO_MESSAGE, null, _("_Reply"), "<Ctrl>R",
_("Reply (Ctrl+R, R)"), on_reply_to_message_action };
entries += reply_to_message;
add_accelerator("R", ACTION_REPLY_TO_MESSAGE);
Gtk.ActionEntry reply_all_message = { ACTION_REPLY_ALL_MESSAGE, null, null,
Gtk.ActionEntry reply_all_message = { ACTION_REPLY_ALL_MESSAGE, null, _("R_eply All"),
"<Ctrl><Shift>R", _("Reply all (Ctrl+Shift+R, Shift+R)"),
on_reply_all_message_action };
entries += reply_all_message;
add_accelerator("<Shift>R", ACTION_REPLY_ALL_MESSAGE);
Gtk.ActionEntry forward_message = { ACTION_FORWARD_MESSAGE, null, null, "<Ctrl>L",
Gtk.ActionEntry forward_message = { ACTION_FORWARD_MESSAGE, null, _("_Forward"), "<Ctrl>L",
_("Forward (Ctrl+L, F)"), on_forward_message_action };
entries += forward_message;
add_accelerator("F", ACTION_FORWARD_MESSAGE);

View file

@ -60,7 +60,7 @@ public class MainToolbar : PillToolbar {
// Archive/delete button.
// For this button, the controller sets the tooltip and icon depending on the context.
insert.clear();
insert.add(create_toolbar_button("", GearyController.ACTION_DELETE_MESSAGE));
insert.add(create_toolbar_button("", GearyController.ACTION_DELETE_MESSAGE, true));
add(create_pill_buttons(insert));
// Spacer.

View file

@ -14,7 +14,8 @@ public class PillToolbar : Gtk.Toolbar {
action_group = toolbar_action_group;
}
private void setup_button(Gtk.Button b, string? icon_name, string action_name) {
private void setup_button(Gtk.Button b, string? icon_name, string action_name,
bool show_label = false) {
b.related_action = action_group.get_action(action_name);
b.tooltip_text = b.related_action.tooltip;
b.image = new Gtk.Image.from_icon_name(icon_name != null ? icon_name :
@ -22,7 +23,10 @@ public class PillToolbar : Gtk.Toolbar {
b.always_show_image = true;
b.image.margin = get_icon_margin();
if (!Geary.String.is_empty(b.related_action.label))
if (!show_label)
b.label = "";
if (show_label && !Geary.String.is_empty(b.related_action.label))
if (b.get_direction() == Gtk.TextDirection.RTL)
b.image.margin_left += 4;
else
@ -32,9 +36,9 @@ public class PillToolbar : Gtk.Toolbar {
/**
* Given an icon and action, creates a button that triggers the action.
*/
public Gtk.Button create_toolbar_button(string? icon_name, string action_name) {
public Gtk.Button create_toolbar_button(string? icon_name, string action_name, bool show_label = false) {
Gtk.Button b = new Gtk.Button();
setup_button(b, icon_name, action_name);
setup_button(b, icon_name, action_name, show_label);
return b;
}