aboutsummaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorRoberto Santalla <roobre@roobre.es>2019-03-21 17:20:35 +0100
committerfiaxh <git@lightrise.org>2019-04-12 19:12:50 +0200
commit27fe07c3b41a53a276fb5f6a71c4c97cb0279170 (patch)
treeab0b809be75f16125e02051a3c37ed55117ed5c4 /main/src
parentc14459a2bd0463234d1c3e451b050cbfe215ca39 (diff)
downloaddino-27fe07c3b41a53a276fb5f6a71c4c97cb0279170.tar.gz
dino-27fe07c3b41a53a276fb5f6a71c4c97cb0279170.zip
Allow to cycle active conversations with Ctrl+(Shift)+Tab
Closes #400, Closes #142, related to #145
Diffstat (limited to 'main/src')
-rw-r--r--main/src/ui/application.vala10
-rw-r--r--main/src/ui/unified_window_controller.vala9
2 files changed, 19 insertions, 0 deletions
diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala
index 132705cf..ca78c735 100644
--- a/main/src/ui/application.vala
+++ b/main/src/ui/application.vala
@@ -132,6 +132,16 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
});
add_action(conference_action);
set_accels_for_action("app.add_conference", new string[]{"<Ctrl>G"});
+
+ SimpleAction loop_conversations_action = new SimpleAction("loop_conversations", null);
+ loop_conversations_action.activate.connect(() => {controller.loop_conversations(false);});
+ add_action(loop_conversations_action);
+ set_accels_for_action("app.loop_conversations", new string[]{"<Ctrl>Tab"});
+
+ SimpleAction loop_conversations_bw_action = new SimpleAction("loop_conversations_bw", null);
+ loop_conversations_bw_action.activate.connect(() => {controller.loop_conversations(true);});
+ add_action(loop_conversations_bw_action);
+ set_accels_for_action("app.loop_conversations_bw", new string[]{"<Ctrl><Shift>Tab"});
}
public bool use_csd() {
diff --git a/main/src/ui/unified_window_controller.vala b/main/src/ui/unified_window_controller.vala
index bef6b7dc..ce15ecc9 100644
--- a/main/src/ui/unified_window_controller.vala
+++ b/main/src/ui/unified_window_controller.vala
@@ -142,6 +142,15 @@ public class UnifiedWindowController : Object {
}
}
+ public void loop_conversations(bool backwards = false) {
+ Gee.List<Conversation> conversations = stream_interactor.get_module(ConversationManager.IDENTITY).get_active_conversations();
+ conversations.sort((a, b) => { return b.last_active.compare(a.last_active); });
+ int index = conversations.index_of(this.conversation);
+ index += backwards ? -1 : 1;
+ select_conversation(conversations.get(index % conversations.size));
+ }
+
+
private void update_conversation_display_name() {
conversation_display_name = Util.get_conversation_display_name(stream_interactor, conversation);
}