diff options
author | fiaxh <git@mx.ax.lt> | 2017-03-10 19:53:24 +0100 |
---|---|---|
committer | fiaxh <git@mx.ax.lt> | 2017-03-10 19:53:24 +0100 |
commit | 24b55d83a1f9e21b028c8d5ac9778e75565f417d (patch) | |
tree | 195b0f332e32d08e1a18fc3d8a5a6725c5ed11d7 /client/src/ui/add_conversation/chat/dialog.vala | |
parent | 4c48c5c16d5f5b010c2e5dfb1affcb59f937510c (diff) | |
parent | 29ca70a6d534e1cd79963718c793ae740318cff1 (diff) | |
download | dino-24b55d83a1f9e21b028c8d5ac9778e75565f417d.tar.gz dino-24b55d83a1f9e21b028c8d5ac9778e75565f417d.zip |
Merge branch 'master' of github.com:dino/dino
Diffstat (limited to 'client/src/ui/add_conversation/chat/dialog.vala')
-rw-r--r-- | client/src/ui/add_conversation/chat/dialog.vala | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/client/src/ui/add_conversation/chat/dialog.vala b/client/src/ui/add_conversation/chat/dialog.vala deleted file mode 100644 index cad2b367..00000000 --- a/client/src/ui/add_conversation/chat/dialog.vala +++ /dev/null @@ -1,83 +0,0 @@ -using Gee; -using Gdk; -using Gtk; - -using Dino.Entities; - -namespace Dino.Ui.AddConversation.Chat { - -public class Dialog : Gtk.Dialog { - - public signal void conversation_opened(Conversation conversation); - - private Button ok_button; - - private RosterList roster_list; - private SelectJidFragment select_jid_fragment; - private StreamInteractor stream_interactor; - - public Dialog(StreamInteractor stream_interactor) { - Object(use_header_bar : 1); - this.title = "Start Chat"; - this.modal = true; - this.stream_interactor = stream_interactor; - - setup_headerbar(); - setup_view(); - } - - private void setup_headerbar() { - HeaderBar header_bar = get_header_bar() as HeaderBar; - header_bar.show_close_button = false; - - Button cancel_button = new Button(); - cancel_button.set_label("Cancel"); - cancel_button.visible = true; - header_bar.pack_start(cancel_button); - - ok_button = new Button(); - ok_button.get_style_context().add_class("suggested-action"); - ok_button.label = "Start"; - ok_button.sensitive = false; - ok_button.visible = true; - header_bar.pack_end(ok_button); - - cancel_button.clicked.connect(() => { close(); }); - ok_button.clicked.connect(on_ok_button_clicked); - } - - private void setup_view() { - roster_list = new RosterList(stream_interactor); - roster_list.row_activated.connect(() => { ok_button.clicked(); }); - select_jid_fragment = new SelectJidFragment(stream_interactor, roster_list); - select_jid_fragment.add_jid.connect((row) => { - AddContactDialog add_contact_dialog = new AddContactDialog(stream_interactor); - add_contact_dialog.set_transient_for(this); - add_contact_dialog.show(); - }); - select_jid_fragment.edit_jid.connect(() => { - - }); - select_jid_fragment.remove_jid.connect((row) => { - ListRow list_row = roster_list.get_selected_row() as ListRow; - RosterManager.get_instance(stream_interactor).remove_jid(list_row.account, list_row.jid); - }); - select_jid_fragment.notify["done"].connect(() => { - ok_button.sensitive = select_jid_fragment.done; - }); - get_content_area().add(select_jid_fragment); - } - - protected void on_ok_button_clicked() { - ListRow? selected_row = roster_list.get_selected_row() as ListRow; - if (selected_row != null) { - // TODO move in list to front immediately - ConversationManager.get_instance(stream_interactor).ensure_start_conversation(selected_row.jid, selected_row.account); - Conversation conversation = ConversationManager.get_instance(stream_interactor).get_conversation(selected_row.jid, selected_row.account); - conversation_opened(conversation); - } - close(); - } -} - -}
\ No newline at end of file |