aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/ui/unified_window.vala
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-03-10 19:53:24 +0100
committerfiaxh <git@mx.ax.lt>2017-03-10 19:53:24 +0100
commit24b55d83a1f9e21b028c8d5ac9778e75565f417d (patch)
tree195b0f332e32d08e1a18fc3d8a5a6725c5ed11d7 /libdino/src/ui/unified_window.vala
parent4c48c5c16d5f5b010c2e5dfb1affcb59f937510c (diff)
parent29ca70a6d534e1cd79963718c793ae740318cff1 (diff)
downloaddino-24b55d83a1f9e21b028c8d5ac9778e75565f417d.tar.gz
dino-24b55d83a1f9e21b028c8d5ac9778e75565f417d.zip
Merge branch 'master' of github.com:dino/dino
Diffstat (limited to 'libdino/src/ui/unified_window.vala')
-rw-r--r--libdino/src/ui/unified_window.vala81
1 files changed, 81 insertions, 0 deletions
diff --git a/libdino/src/ui/unified_window.vala b/libdino/src/ui/unified_window.vala
new file mode 100644
index 00000000..269799c2
--- /dev/null
+++ b/libdino/src/ui/unified_window.vala
@@ -0,0 +1,81 @@
+using Gtk;
+
+using Dino.Entities;
+
+namespace Dino.Ui {
+
+public class UnifiedWindow : Window {
+ public ChatInput chat_input;
+ public ConversationListTitlebar conversation_list_titlebar;
+ public ConversationSelector.View filterable_conversation_list;
+ public ConversationSummary.View conversation_frame;
+ public ConversationTitlebar conversation_titlebar;
+ public Paned paned;
+
+ private StreamInteractor stream_interactor;
+ private Conversation? conversation;
+
+ public UnifiedWindow(Application application, StreamInteractor stream_interactor) {
+ Object(application : application);
+ this.stream_interactor = stream_interactor;
+ focus_in_event.connect(on_focus_in_event);
+ focus_out_event.connect(on_focus_out_event);
+
+ default_width = 1200;
+ default_height = 700;
+
+ chat_input = new ChatInput(stream_interactor);
+ conversation_frame = new ConversationSummary.View(stream_interactor);
+ conversation_titlebar = new ConversationTitlebar(stream_interactor);
+ paned = new Paned(Orientation.HORIZONTAL);
+ paned.set_position(300);
+ filterable_conversation_list = new ConversationSelector.View(stream_interactor);
+ conversation_list_titlebar = new ConversationListTitlebar(this, stream_interactor);
+ conversation_list_titlebar.search_button.bind_property("active", filterable_conversation_list.search_bar, "search-mode-enabled",
+ BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL);
+ Grid grid = new Grid();
+ grid.orientation = Orientation.VERTICAL;
+ Paned toolbar_paned = new Paned(Orientation.HORIZONTAL);
+
+ add(paned);
+ paned.add1(filterable_conversation_list);
+ paned.add2(grid);
+
+ grid.add(conversation_frame);
+ grid.add(new Separator(Orientation.HORIZONTAL));
+ grid.add(chat_input);
+
+ conversation_frame.show_all();
+
+ toolbar_paned.add1(conversation_list_titlebar);
+ toolbar_paned.add2(conversation_titlebar);
+ paned.bind_property("position", toolbar_paned, "position", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL);
+ set_titlebar(toolbar_paned);
+
+ filterable_conversation_list.conversation_list.conversation_selected.connect(on_conversation_selected);
+ conversation_list_titlebar.conversation_opened.connect(on_conversation_selected);
+ }
+
+ private void on_conversation_selected(Conversation conversation) {
+ this.conversation = conversation;
+ ChatInteraction.get_instance(stream_interactor).on_conversation_selected(conversation);
+ conversation.active = true; // only for conversation_selected
+ filterable_conversation_list.conversation_list.on_conversation_selected(conversation); // only for conversation_opened
+
+ chat_input.initialize_for_conversation(conversation);
+ conversation_frame.initialize_for_conversation(conversation);
+ conversation_titlebar.initialize_for_conversation(conversation);
+ }
+
+ private bool on_focus_in_event() {
+ ChatInteraction.get_instance(stream_interactor).window_focus_in(conversation);
+ return false;
+ }
+
+ private bool on_focus_out_event() {
+ ChatInteraction.get_instance(stream_interactor).window_focus_out(conversation);
+ return false;
+ }
+}
+
+} \ No newline at end of file