parent
ab0e9d3a40
commit
c25415ea02
4 changed files with 51 additions and 20 deletions
|
|
@ -38,6 +38,8 @@ public class Application.Controller : Geary.BaseObject {
|
|||
public const string ACTION_CONVERSATION_LIST = "focus-conv-list";
|
||||
public const string ACTION_TOGGLE_SEARCH = "toggle-search";
|
||||
public const string ACTION_TOGGLE_FIND = "toggle-find";
|
||||
public const string ACTION_CONVERSATION_UP = "up-conversation";
|
||||
public const string ACTION_CONVERSATION_DOWN = "down-conversation";
|
||||
|
||||
// Properties
|
||||
public const string PROP_SELECTED_CONVERSATIONS ="selected-conversations";
|
||||
|
|
@ -197,6 +199,8 @@ public class Application.Controller : Geary.BaseObject {
|
|||
{ACTION_DELETE_CONVERSATION, on_delete_conversation },
|
||||
{ACTION_COPY_MENU, on_show_copy_menu },
|
||||
{ACTION_MOVE_MENU, on_show_move_menu },
|
||||
{ACTION_CONVERSATION_UP, on_conversation_up },
|
||||
{ACTION_CONVERSATION_DOWN, on_conversation_down },
|
||||
// Message marking actions
|
||||
{ACTION_SHOW_MARK_MENU, on_show_mark_menu },
|
||||
{ACTION_MARK_AS_READ, on_mark_as_read },
|
||||
|
|
@ -606,6 +610,8 @@ public class Application.Controller : Geary.BaseObject {
|
|||
add_window_accelerators(ACTION_ZOOM+("('normal')"), { "<Ctrl>0" });
|
||||
add_window_accelerators(ACTION_SEARCH, { "<Ctrl>S" });
|
||||
add_window_accelerators(ACTION_CONVERSATION_LIST, { "<Ctrl>B" });
|
||||
add_window_accelerators(ACTION_CONVERSATION_UP, { "<Ctrl>bracketleft", "K" });
|
||||
add_window_accelerators(ACTION_CONVERSATION_DOWN, { "<Ctrl>bracketright", "J" });
|
||||
}
|
||||
|
||||
private void add_window_accelerators(string action, string[] accelerators, Variant? param = null) {
|
||||
|
|
@ -2909,6 +2915,14 @@ public class Application.Controller : Geary.BaseObject {
|
|||
);
|
||||
}
|
||||
|
||||
private void on_conversation_up() {
|
||||
this.main_window.conversation_list_view.scroll(Gtk.ScrollType.STEP_UP);
|
||||
}
|
||||
|
||||
private void on_conversation_down() {
|
||||
this.main_window.conversation_list_view.scroll(Gtk.ScrollType.STEP_DOWN);
|
||||
}
|
||||
|
||||
private void on_save_attachments(Gee.Collection<Geary.Attachment> attachments) {
|
||||
GLib.Cancellable? cancellable = null;
|
||||
if (this.current_account != null) {
|
||||
|
|
|
|||
|
|
@ -122,6 +122,39 @@ public class ConversationListView : Gtk.TreeView, Geary.BaseInterface {
|
|||
selection.changed.connect(on_selection_changed);
|
||||
}
|
||||
|
||||
public void scroll(Gtk.ScrollType where) {
|
||||
Gtk.TreeSelection selection = get_selection();
|
||||
weak Gtk.TreeModel model;
|
||||
GLib.List<Gtk.TreePath> selected = selection.get_selected_rows(out model);
|
||||
Gtk.TreePath? target_path = null;
|
||||
Gtk.TreeIter? target_iter = null;
|
||||
if (selected.length() > 0) {
|
||||
switch (where) {
|
||||
case STEP_UP:
|
||||
target_path = selected.first().data;
|
||||
model.get_iter(out target_iter, target_path);
|
||||
if (model.iter_previous(ref target_iter)) {
|
||||
target_path = model.get_path(target_iter);
|
||||
} else {
|
||||
this.get_window().beep();
|
||||
}
|
||||
break;
|
||||
|
||||
case STEP_DOWN:
|
||||
target_path = selected.last().data;
|
||||
model.get_iter(out target_iter, target_path);
|
||||
if (model.iter_next(ref target_iter)) {
|
||||
target_path = model.get_path(target_iter);
|
||||
} else {
|
||||
this.get_window().beep();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
set_cursor(target_path, null, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies an action is currently changing the view's selection.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -36,22 +36,6 @@ public class FolderList.Tree : Sidebar.Tree, Geary.BaseInterface {
|
|||
unowned Gtk.BindingSet? binding_set = Gtk.BindingSet.find("GtkTreeView");
|
||||
assert(binding_set != null);
|
||||
Gtk.BindingEntry.remove(binding_set, Gdk.Key.N, Gdk.ModifierType.CONTROL_MASK);
|
||||
// add j/k bindings for gmail or vim users
|
||||
// The add_signal API is hard to use (need to pass variable arguments with
|
||||
// type identifiers), so we might as well use this version that parses a
|
||||
// string.
|
||||
Gtk.BindingEntry.add_signal_from_string(
|
||||
binding_set,
|
||||
"""
|
||||
bind "j" { "move-cursor" (display-lines, 1) }
|
||||
"""
|
||||
);
|
||||
Gtk.BindingEntry.add_signal_from_string(
|
||||
binding_set,
|
||||
"""
|
||||
bind "k" { "move-cursor" (display-lines, -1) }
|
||||
"""
|
||||
);
|
||||
}
|
||||
|
||||
~Tree() {
|
||||
|
|
|
|||
|
|
@ -244,15 +244,15 @@
|
|||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes" context="shortcut window">Select next conversation down</property>
|
||||
<property name="accelerator">J</property>
|
||||
<property name="title" translatable="yes" context="shortcut window">Select the conversation down</property>
|
||||
<property name="accelerator"><primary>bracketright J</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes" context="shortcut window">Select previous conversation up</property>
|
||||
<property name="accelerator">K</property>
|
||||
<property name="title" translatable="yes" context="shortcut window">Select the conversation up</property>
|
||||
<property name="accelerator"><primary>bracketleft K</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue