[geary] Enable L/M keyboard shortcut for label/moving messages. Fixes Bug 731737.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary] Enable L/M keyboard shortcut for label/moving messages. Fixes Bug 731737.
- Date: Sun, 29 May 2016 13:27:57 +0000 (UTC)
commit 66928f73f6cbaf3d57ca58ab9b0998ab5a7bcd88
Author: Michael James Gratton <mike vee net>
Date: Sun May 29 23:25:49 2016 +1000
Enable L/M keyboard shortcut for label/moving messages. Fixes Bug 731737.
* help/C/shortcuts.page: Document new shortcuts.
* src/client/application/geary-controller.vala: Add shortcuts for copy
and move actions.
* src/client/components/pill-toolbar.vala (PillBar::create_menu_button):
Hook up the button's related action to invoke the button's popup menu,
taking care not to cause an infinte loop.
(PillBar::setup_button): Connect to the related_action's tooltip notify
signal via a local variable rather than via the button, so it does not
get lost when it changes for Gtk.MenuButton actions.
help/C/shortcuts.page | 8 ++++++++
src/client/application/geary-controller.vala | 2 ++
src/client/components/pill-toolbar.vala | 16 +++++++++++++---
3 files changed, 23 insertions(+), 3 deletions(-)
---
diff --git a/help/C/shortcuts.page b/help/C/shortcuts.page
index ea69163..67a0f68 100644
--- a/help/C/shortcuts.page
+++ b/help/C/shortcuts.page
@@ -55,6 +55,14 @@
<td><p>Mark unread</p></td>
<td><p> <keyseq><key>Ctrl</key><key>U</key></keyseq> or
<keyseq><key>Shift</key><key>U</key></keyseq> </p></td>
</tr>
+ <tr>
+ <td><p>Open the Label Conversation menu</p></td>
+ <td><p><key>L</key></p></td>
+ </tr>
+ <tr>
+ <td><p>Open the Move Conversation menu</p></td>
+ <td><p><key>M</key></p></td>
+ </tr>
<tr>
<td><p>Move focus to the next/previous pane</p></td>
<td><p> <keyseq><key>F6</key></keyseq> / <keyseq><key>Shift</key><key>F6</key></keyseq> </p></td>
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index 25d7642..1e698cf 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -429,10 +429,12 @@ public class GearyController : Geary.BaseObject {
_("Add label"), null };
copy_menu.label = _("_Label");
entries += copy_menu;
+ add_accelerator("l", ACTION_COPY_MENU);
Gtk.ActionEntry move_menu = { ACTION_MOVE_MENU, null, TRANSLATABLE, "M", _("Move conversation"),
null };
move_menu.label = _("_Move");
entries += move_menu;
+ add_accelerator("m", ACTION_MOVE_MENU);
Gtk.ActionEntry new_message = { ACTION_NEW_MESSAGE, null, null, "<Ctrl>N",
_("Compose new message (Ctrl+N, N)"), on_new_message };
diff --git a/src/client/components/pill-toolbar.vala b/src/client/components/pill-toolbar.vala
index 0bde8c2..79f4b50 100644
--- a/src/client/components/pill-toolbar.vala
+++ b/src/client/components/pill-toolbar.vala
@@ -35,9 +35,10 @@ public interface PillBar : Gtk.Container {
public virtual 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.related_action.notify["tooltip"].connect(() => { b.tooltip_text = b.related_action.tooltip; });
+ Gtk.Action related_action = action_group.get_action(action_name);
+ b.tooltip_text = related_action.tooltip;
+ related_action.notify["tooltip"].connect(() => { b.tooltip_text = related_action.tooltip; });
+ b.related_action = related_action;
// Load icon by name with this fallback order: specified icon name, the action's icon name,
// the action's stock ID ... although stock IDs are being deprecated, that's how we specify
@@ -88,6 +89,15 @@ public interface PillBar : Gtk.Container {
Gtk.MenuButton b = new Gtk.MenuButton();
setup_button(b, icon_name, action_name);
b.popup = menu;
+
+ if (b.related_action != null) {
+ b.related_action.activate.connect(() => {
+ b.clicked();
+ });
+ // Null out the action since by connecting it to clicked
+ // above, invoking would cause an infinite loop otherwise.
+ b.related_action = null;
+ }
return b;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]