implements sending
This commit is contained in:
@@ -4,7 +4,7 @@ using Gtk;
|
||||
public class MainWindow : Adw.ApplicationWindow
|
||||
{
|
||||
private ConversationListView conversation_list_view;
|
||||
private MessageListView message_list_view;
|
||||
private TranscriptView transcript_view;
|
||||
|
||||
public MainWindow () {
|
||||
Object (title: "Kordophone");
|
||||
@@ -19,16 +19,33 @@ public class MainWindow : Adw.ApplicationWindow
|
||||
var conversation_list_page = new NavigationPage (conversation_list_view, "Conversations");
|
||||
split_view.sidebar = conversation_list_page;
|
||||
|
||||
message_list_view = new MessageListView (new MessageListModel ("123"));
|
||||
var message_list_page = new NavigationPage (message_list_view, "Messages");
|
||||
split_view.content = message_list_page;
|
||||
transcript_view = new TranscriptView ();
|
||||
transcript_view.on_send.connect (on_transcript_send);
|
||||
|
||||
var transcript_page = new NavigationPage (transcript_view, "Transcript");
|
||||
split_view.content = transcript_page;
|
||||
}
|
||||
|
||||
private void conversation_selected(string? conversation_guid) {
|
||||
if (conversation_guid == null) {
|
||||
message_list_view.model = null;
|
||||
transcript_view.message_list.model = null;
|
||||
} else {
|
||||
message_list_view.model = new MessageListModel (conversation_guid);
|
||||
transcript_view.message_list.model = new MessageListModel (conversation_guid);
|
||||
}
|
||||
}
|
||||
|
||||
private void on_transcript_send(string message) {
|
||||
if (transcript_view.message_list.model == null) {
|
||||
GLib.warning("No conversation selected");
|
||||
return;
|
||||
}
|
||||
|
||||
var selected_conversation = transcript_view.message_list.model.conversation_guid;
|
||||
if (selected_conversation == null) {
|
||||
GLib.warning("No conversation selected");
|
||||
return;
|
||||
}
|
||||
|
||||
Repository.get_instance().send_message(selected_conversation, message);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user