Skip to content

Instantly share code, notes, and snippets.

@yeled
Created May 31, 2017 12:53
Show Gist options
  • Save yeled/56bc89191da4567c42cdf52149686b48 to your computer and use it in GitHub Desktop.
Save yeled/56bc89191da4567c42cdf52149686b48 to your computer and use it in GitHub Desktop.
From 701f6f5c89e061d05734839821f3a20c149e93ad Mon Sep 17 00:00:00 2001
From: Charlie Allom <[email protected]>
Date: Wed, 31 May 2017 13:51:27 +0100
Subject: [PATCH] [PATCH] searches: Shift+tab to previous unread
---
src/modes/saved_searches.cc | 52 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git src/modes/saved_searches.cc src/modes/saved_searches.cc
index dad2e8a..9742232 100644
--- src/modes/saved_searches.cc
+++ src/modes/saved_searches.cc
@@ -363,6 +363,58 @@ namespace Astroid {
return true;
});
+ keys.register_key (Key (false, false, (guint) GDK_KEY_ISO_Left_Tab),
+ "searches.previous_unread",
+ "Jump to previous unread thread",
+ [&] (Key) {
+ Gtk::TreePath thispath, path;
+ Gtk::TreeIter iter;
+ Gtk::TreeViewColumn *c;
+
+ tv.get_cursor (path, c);
+ path.prev ();
+ iter = store->get_iter (path);
+ thispath = path;
+
+ Gtk::ListStore::Row row;
+
+ bool found = false;
+ while (iter) {
+ row = *iter;
+
+ if (row[m_columns.m_col_unread_messages] > 0) {
+ path = store->get_path (iter);
+ tv.set_cursor (path);
+ found = true;
+ break;
+ }
+
+ iter--;
+ }
+
+ /* wrap, and check from end */
+ if (!found) {
+ iter = store->children().end ();
+ iter--;
+
+ while (iter && store->get_path(iter) > thispath) {
+ row = *iter;
+
+ if (row[m_columns.m_col_unread_messages] > 0) {
+ path = store->get_path (iter);
+ tv.set_cursor (path);
+ found = true;
+ break;
+ }
+
+ iter--;
+ }
+ }
+
+ return true;
+ });
+
+
keys.register_key (Key (GDK_KEY_Return), { Key (GDK_KEY_KP_Enter) },
"searches.open",
"Open query",
--
2.11.0 (Apple Git-81)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment