diff --git a/src/client/accounts/accounts-editor-add-pane.vala b/src/client/accounts/accounts-editor-add-pane.vala index 3e746be0..4b4c72f3 100644 --- a/src/client/accounts/accounts-editor-add-pane.vala +++ b/src/client/accounts/accounts-editor-add-pane.vala @@ -26,6 +26,12 @@ internal class Accounts.EditorAddPane : Gtk.Grid, EditorPane { [GtkChild] private Gtk.Overlay osd_overlay; + [GtkChild] + private Gtk.Grid pane_content; + + [GtkChild] + private Gtk.Adjustment pane_adjustment; + [GtkChild] private Gtk.ListBox details_list; @@ -66,6 +72,8 @@ internal class Accounts.EditorAddPane : Gtk.Grid, EditorPane { this.accounts = application.controller.account_manager; this.engine = application.engine; + this.pane_content.set_focus_vadjustment(this.pane_adjustment); + this.details_list.set_header_func(Editor.seperator_headers); this.receiving_list.set_header_func(Editor.seperator_headers); this.sending_list.set_header_func(Editor.seperator_headers); @@ -331,6 +339,32 @@ internal class Accounts.EditorAddPane : Gtk.Grid, EditorPane { this.editor.pop(); } + [GtkCallback] + private bool on_list_keynav_failed(Gtk.Widget widget, + Gtk.DirectionType direction) { + bool ret = Gdk.EVENT_PROPAGATE; + Gtk.Container? next = null; + if (direction == Gtk.DirectionType.DOWN) { + if (widget == this.details_list) { + next = this.receiving_list; + } else if (widget == this.receiving_list) { + next = this.sending_list; + } + } else if (direction == Gtk.DirectionType.UP) { + if (widget == this.sending_list) { + next = this.receiving_list; + } else if (widget == this.receiving_list) { + next = this.details_list; + } + } + + if (next != null) { + next.child_focus(direction); + ret = Gdk.EVENT_STOP; + } + return ret; + } + } @@ -359,6 +393,22 @@ private abstract class Accounts.EntryRow : AddPaneRow { this.value.width_chars = 32; } + public override bool focus(Gtk.DirectionType direction) { + bool ret = Gdk.EVENT_PROPAGATE; + switch (direction) { + case Gtk.DirectionType.TAB_FORWARD: + case Gtk.DirectionType.TAB_BACKWARD: + ret = this.value.child_focus(direction); + break; + + default: + ret = base.focus(direction); + break; + } + + return ret; + } + } diff --git a/src/client/accounts/accounts-editor-edit-pane.vala b/src/client/accounts/accounts-editor-edit-pane.vala index 7095de14..8ec931e7 100644 --- a/src/client/accounts/accounts-editor-edit-pane.vala +++ b/src/client/accounts/accounts-editor-edit-pane.vala @@ -24,6 +24,12 @@ internal class Accounts.EditorEditPane : Gtk.Grid, EditorPane, AccountPane { [GtkChild] private Gtk.HeaderBar header; + [GtkChild] + private Gtk.Grid pane_content; + + [GtkChild] + private Gtk.Adjustment pane_adjustment; + [GtkChild] private Gtk.ListBox details_list; @@ -47,6 +53,8 @@ internal class Accounts.EditorEditPane : Gtk.Grid, EditorPane, AccountPane { this.editor = editor; this.account = account; + this.pane_content.set_focus_vadjustment(this.pane_adjustment); + this.details_list.set_header_func(Editor.seperator_headers); this.details_list.add(new NicknameRow(account)); @@ -64,21 +72,14 @@ internal class Accounts.EditorEditPane : Gtk.Grid, EditorPane, AccountPane { this.signature_preview.events | Gdk.EventType.FOCUS_CHANGE ); this.signature_preview.content_loaded.connect(() => { - debug("Signature loaded"); // Only enable editability after the content has fully // loaded to avoid the WebProcess crashing. this.signature_preview.set_editable.begin(true, null); }); this.signature_preview.document_modified.connect(() => { - debug("Signature changed"); this.signature_changed = true; }); - this.signature_preview.focus_in_event.connect(() => { - debug("Sig focus in"); - return Gdk.EVENT_PROPAGATE; - }); this.signature_preview.focus_out_event.connect(() => { - debug("Sig focus out"); // This event will also be fired if the top-level // window loses focus, e.g. if the user alt-tabs away, // so don't execute the command if the signature web @@ -196,6 +197,36 @@ internal class Accounts.EditorEditPane : Gtk.Grid, EditorPane, AccountPane { this.editor.pop(); } + [GtkCallback] + private bool on_list_keynav_failed(Gtk.Widget widget, + Gtk.DirectionType direction) { + bool ret = Gdk.EVENT_PROPAGATE; + Gtk.Container? next = null; + if (direction == Gtk.DirectionType.DOWN) { + if (widget == this.details_list) { + next = this.senders_list; + } else if (widget == this.senders_list) { + this.signature_preview.grab_focus(); + } else if (widget == this.signature_preview) { + next = this.settings_list; + } + } else if (direction == Gtk.DirectionType.UP) { + if (widget == this.settings_list) { + this.signature_preview.grab_focus(); + } else if (widget == this.signature_preview) { + next = this.senders_list; + } else if (widget == this.senders_list) { + next = this.details_list; + } + } + + if (next != null) { + next.child_focus(direction); + ret = Gdk.EVENT_STOP; + } + return ret; + } + } diff --git a/src/client/accounts/accounts-editor-list-pane.vala b/src/client/accounts/accounts-editor-list-pane.vala index 9136ebcf..f5798bde 100644 --- a/src/client/accounts/accounts-editor-list-pane.vala +++ b/src/client/accounts/accounts-editor-list-pane.vala @@ -40,6 +40,12 @@ internal class Accounts.EditorListPane : Gtk.Grid, EditorPane { [GtkChild] private Gtk.Overlay osd_overlay; + [GtkChild] + private Gtk.Grid pane_content; + + [GtkChild] + private Gtk.Adjustment pane_adjustment; + [GtkChild] private Gtk.Grid welcome_panel; @@ -64,6 +70,8 @@ internal class Accounts.EditorListPane : Gtk.Grid, EditorPane { this.accounts = ((GearyApplication) editor.application).controller.account_manager; + this.pane_content.set_focus_vadjustment(this.pane_adjustment); + this.accounts_list.set_header_func(Editor.seperator_headers); this.accounts_list.set_sort_func(ordinal_sort); foreach (Geary.AccountInformation account in this.accounts.iterable()) { @@ -238,6 +246,22 @@ internal class Accounts.EditorListPane : Gtk.Grid, EditorPane { } } + [GtkCallback] + private bool on_list_keynav_failed(Gtk.Widget widget, + Gtk.DirectionType direction) { + bool ret = Gdk.EVENT_PROPAGATE; + if (direction == Gtk.DirectionType.DOWN && + widget == this.accounts_list) { + this.service_list.child_focus(direction); + ret = Gdk.EVENT_STOP; + } else if (direction == Gtk.DirectionType.UP && + widget == this.service_list) { + this.accounts_list.child_focus(direction); + ret = Gdk.EVENT_STOP; + } + return ret; + } + } diff --git a/src/client/accounts/accounts-editor-servers-pane.vala b/src/client/accounts/accounts-editor-servers-pane.vala index 8ac599b6..43cd001d 100644 --- a/src/client/accounts/accounts-editor-servers-pane.vala +++ b/src/client/accounts/accounts-editor-servers-pane.vala @@ -20,6 +20,12 @@ internal class Accounts.EditorServersPane : Gtk.Grid, EditorPane, AccountPane { [GtkChild] private Gtk.HeaderBar header; + [GtkChild] + private Gtk.Grid pane_content; + + [GtkChild] + private Gtk.Adjustment pane_adjustment; + [GtkChild] private Gtk.ListBox details_list; @@ -34,6 +40,8 @@ internal class Accounts.EditorServersPane : Gtk.Grid, EditorPane, AccountPane { this.editor = editor; this.account = account; + this.pane_content.set_focus_vadjustment(this.pane_adjustment); + this.details_list.set_header_func(Editor.seperator_headers); this.details_list.add( new ServiceProviderRow( @@ -81,6 +89,32 @@ internal class Accounts.EditorServersPane : Gtk.Grid, EditorPane, AccountPane { private void on_apply_button_clicked() { } + [GtkCallback] + private bool on_list_keynav_failed(Gtk.Widget widget, + Gtk.DirectionType direction) { + bool ret = Gdk.EVENT_PROPAGATE; + Gtk.Container? next = null; + if (direction == Gtk.DirectionType.DOWN) { + if (widget == this.details_list) { + next = this.receiving_list; + } else if (widget == this.receiving_list) { + next = this.sending_list; + } + } else if (direction == Gtk.DirectionType.UP) { + if (widget == this.sending_list) { + next = this.receiving_list; + } else if (widget == this.receiving_list) { + next = this.details_list; + } + } + + if (next != null) { + next.child_focus(direction); + ret = Gdk.EVENT_STOP; + } + return ret; + } + private void on_account_changed() { update_header(); } diff --git a/src/client/accounts/accounts-editor.vala b/src/client/accounts/accounts-editor.vala index 0079fa08..f69c116e 100644 --- a/src/client/accounts/accounts-editor.vala +++ b/src/client/accounts/accounts-editor.vala @@ -65,6 +65,31 @@ public class Accounts.Editor : Gtk.Dialog { push(this.editor_list_pane); } + public override bool key_press_event(Gdk.EventKey event) { + bool ret = Gdk.EVENT_PROPAGATE; + + if (get_current_pane() != this.editor_list_pane) { + Gdk.ModifierType state = ( + event.state & Gtk.accelerator_get_default_mod_mask() + ); + bool is_ltr = (get_direction() == Gtk.TextDirection.LTR); + if (event.keyval == Gdk.Key.Escape || + event.keyval == Gdk.Key.Back || + (state == Gdk.ModifierType.MOD1_MASK && + (is_ltr && event.keyval == Gdk.Key.Left) || + (!is_ltr && event.keyval == Gdk.Key.Right))) { + pop(); + ret = Gdk.EVENT_STOP; + } + } + + if (ret != Gdk.EVENT_STOP) { + ret = base.key_press_event(event); + } + + return ret; + } + public override void destroy() { this.editor_panes.notify["visible-child"].disconnect(on_pane_changed); base.destroy(); diff --git a/ui/accounts_editor_add_pane.ui b/ui/accounts_editor_add_pane.ui index fb381c9c..1b27d776 100644 --- a/ui/accounts_editor_add_pane.ui +++ b/ui/accounts_editor_add_pane.ui @@ -1,7 +1,12 @@ - + + + 100 + 1 + 10 + True diff --git a/ui/accounts_editor_edit_pane.ui b/ui/accounts_editor_edit_pane.ui index 83a616eb..cd02476b 100644 --- a/ui/accounts_editor_edit_pane.ui +++ b/ui/accounts_editor_edit_pane.ui @@ -1,7 +1,76 @@ - + + + True + False + Edit Account + Account Name + False + True + + + True + False + + + True + True + True + + + + True + False + True + go-previous-symbolic + + + + + 0 + 0 + + + + + + + True + False + + + True + True + True + win.undo + + + True + False + True + edit-undo-symbolic + + + + + 0 + 0 + + + + + end + 1 + + + + + 100 + 1 + 10 + - - True - False - Edit Account - Account Name - False - True - - - True - False - - - True - True - True - - - - True - False - True - go-previous-symbolic - - - - - 0 - 0 - - - - - - - True - False - - - True - True - True - win.undo - - - True - False - True - edit-undo-symbolic - - - - - 0 - 0 - - - - - end - 1 - - - diff --git a/ui/accounts_editor_list_pane.ui b/ui/accounts_editor_list_pane.ui index 96e9bbec..a85d978e 100644 --- a/ui/accounts_editor_list_pane.ui +++ b/ui/accounts_editor_list_pane.ui @@ -1,7 +1,19 @@ - + + + True + False + Accounts + False + True + + + 100 + 1 + 10 + - - True - False - Accounts - False - True - diff --git a/ui/accounts_editor_remove_pane.ui b/ui/accounts_editor_remove_pane.ui index e11dd170..05b4c916 100644 --- a/ui/accounts_editor_remove_pane.ui +++ b/ui/accounts_editor_remove_pane.ui @@ -1,5 +1,5 @@ - + True diff --git a/ui/accounts_editor_servers_pane.ui b/ui/accounts_editor_servers_pane.ui index 8dfa598a..f2e5da9f 100644 --- a/ui/accounts_editor_servers_pane.ui +++ b/ui/accounts_editor_servers_pane.ui @@ -1,140 +1,7 @@ - + - True False @@ -187,4 +54,149 @@ + + 100 + 1 + 10 + + diff --git a/ui/geary.css b/ui/geary.css index d01150d3..9fee378e 100644 --- a/ui/geary.css +++ b/ui/geary.css @@ -183,8 +183,8 @@ grid.geary-message-summary { /* Accounts.Editor */ -grid.geary-account-view { - margin: 32px 128px; +grid.geary-accounts-editor-pane-content { + padding: 32px 128px; } grid.geary-account-view image:dir(ltr) {