[geary] Check for inline composers before switching current folder
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary] Check for inline composers before switching current folder
- Date: Wed, 21 May 2014 00:43:05 +0000 (UTC)
commit 4108dd94eaecda603a06347392b542d28abe85b9
Author: Robert Schroll <rschroll gmail com>
Date: Mon May 19 16:44:59 2014 -0700
Check for inline composers before switching current folder
We add a virtual method, accept_cursor_changed, to Sidebar.Tree, which
says whether we should accept a change in the cursor or not. It default
to being true all the time, but we override this with a check of the
inline composers in FolderList.Tree.
src/client/folder-list/folder-list-tree.vala | 4 ++++
src/client/sidebar/sidebar-tree.vala | 14 ++++++++++++--
2 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/client/folder-list/folder-list-tree.vala b/src/client/folder-list/folder-list-tree.vala
index b876bf8..889417e 100644
--- a/src/client/folder-list/folder-list-tree.vala
+++ b/src/client/folder-list/folder-list-tree.vala
@@ -45,6 +45,10 @@ public class FolderList.Tree : Sidebar.Tree {
account_branch.get_entry_for_path(folder.path));
}
+ public override bool accept_cursor_changed() {
+ return GearyApplication.instance.controller.can_switch_conversation_view();
+ }
+
private void on_entry_selected(Sidebar.SelectableEntry selectable) {
AbstractFolderEntry? abstract_folder_entry = selectable as AbstractFolderEntry;
if (abstract_folder_entry != null)
diff --git a/src/client/sidebar/sidebar-tree.vala b/src/client/sidebar/sidebar-tree.vala
index 4d22271..cc0eb88 100644
--- a/src/client/sidebar/sidebar-tree.vala
+++ b/src/client/sidebar/sidebar-tree.vala
@@ -295,6 +295,10 @@ public class Sidebar.Tree : Gtk.TreeView {
return name;
}
+ public virtual bool accept_cursor_changed() {
+ return true;
+ }
+
public override void cursor_changed() {
Gtk.TreePath? path = get_selected_path();
if (path == null) {
@@ -306,6 +310,7 @@ public class Sidebar.Tree : Gtk.TreeView {
EntryWrapper? wrapper = get_wrapper_at_path(path);
if (selected_wrapper != wrapper) {
+ EntryWrapper old_wrapper = selected_wrapper;
selected_wrapper = wrapper;
if (editing_disabled == 0 && wrapper != null && wrapper.entry is Sidebar.RenameableEntry)
@@ -313,8 +318,13 @@ public class Sidebar.Tree : Gtk.TreeView {
if (wrapper != null && !mask_entry_selected_signal) {
Sidebar.SelectableEntry? selectable = wrapper.entry as Sidebar.SelectableEntry;
- if (selectable != null)
- entry_selected(selectable);
+ if (selectable != null) {
+ if (accept_cursor_changed()) {
+ entry_selected(selectable);
+ } else {
+ place_cursor(old_wrapper.entry, true);
+ }
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]