[geary/wip/warn-delete-713875: 2/2] Cancelling Shift state when re-focused
- From: Charles Lindsay <clindsay src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/warn-delete-713875: 2/2] Cancelling Shift state when re-focused
- Date: Tue, 11 Feb 2014 00:10:52 +0000 (UTC)
commit 81e67fc62c98676d103015b4f497eb724490101b
Author: Charles Lindsay <chaz yorba org>
Date: Mon Feb 10 16:08:01 2014 -0800
Cancelling Shift state when re-focused
If you hold down shift, delete a message, then hit cancel, the toolbar
button would stay as Delete when it should go back to Trash (assuming
you stopped pressing shift at some point). This makes it so it always
reverts to Trash when the window is focused.
src/client/application/geary-controller.vala | 9 ++++++---
src/client/components/main-window.vala | 9 ++++++++-
2 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index 52f2256..fb09d59 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -1337,9 +1337,12 @@ public class GearyController : Geary.BaseObject {
}
private void on_shift_key(bool pressed) {
- main_window.main_toolbar.update_trash_buttons(
- (!pressed && current_folder_supports_trash()) || !(current_folder is Geary.FolderSupport.Remove),
- current_account.can_support_archive);
+ if (main_window != null && main_window.main_toolbar != null
+ && current_account != null && current_folder != null) {
+ main_window.main_toolbar.update_trash_buttons(
+ (!pressed && current_folder_supports_trash()) || !(current_folder is
Geary.FolderSupport.Remove),
+ current_account.can_support_archive);
+ }
}
// this signal does not necessarily indicate that the application previously didn't have
diff --git a/src/client/components/main-window.vala b/src/client/components/main-window.vala
index e6fc42b..887bd43 100644
--- a/src/client/components/main-window.vala
+++ b/src/client/components/main-window.vala
@@ -38,7 +38,8 @@ public class MainWindow : Gtk.ApplicationWindow {
conversation_list_view = new ConversationListView(conversation_list_store);
- add_events(Gdk.EventMask.KEY_PRESS_MASK | Gdk.EventMask.KEY_RELEASE_MASK);
+ add_events(Gdk.EventMask.KEY_PRESS_MASK | Gdk.EventMask.KEY_RELEASE_MASK
+ | Gdk.EventMask.FOCUS_CHANGE_MASK);
// This code both loads AND saves the pane positions with live
// updating. This is more resilient against crashes because
@@ -63,6 +64,7 @@ public class MainWindow : Gtk.ApplicationWindow {
delete_event.connect(on_delete_event);
key_press_event.connect(on_key_press_event);
key_release_event.connect(on_key_release_event);
+ focus_in_event.connect(on_focus_event);
GearyApplication.instance.controller.notify[GearyController.PROP_CURRENT_CONVERSATION].
connect(on_conversation_monitor_changed);
Geary.Engine.instance.account_available.connect(on_account_available);
@@ -188,6 +190,11 @@ public class MainWindow : Gtk.ApplicationWindow {
return propagate_key_event(event);
}
+ private bool on_focus_event() {
+ on_shift_key(false);
+ return false;
+ }
+
private void on_conversation_monitor_changed() {
Geary.App.ConversationMonitor? conversation_monitor =
GearyApplication.instance.controller.current_conversations;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]