diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/src/main.rs b/src/main.rs index bc60f0a..fcd0281 100644 --- a/src/main.rs +++ b/src/main.rs @@ -46,6 +46,7 @@ pub struct Config { auto_connect: bool, storage_dir: Option<String>, dburl: Option<String>, + message_view_config: message_view::Config, } impl Default for Config { @@ -54,6 +55,7 @@ impl Default for Config { auto_connect: true, storage_dir: None, dburl: None, + message_view_config: message_view::Config::default(), } } } @@ -338,7 +340,6 @@ pub enum Message { GotChats(Vec<Chat>), GotMessageHistory(Chat, IndexMap<Uuid, ChatMessage>), ToggleChat(JID), - MessageCompose(String), SendMessage(JID, String), Error(Error), MessageView(message_view::Message), @@ -548,7 +549,7 @@ impl Macaw { } None => {} } - self.open_chat = Some(MessageView::new(jid.clone())); + self.open_chat = Some(MessageView::new(jid.clone(), &self.config)); let jid1 = jid.clone(); match &self.client { Account::LoggedIn(client) => { @@ -691,12 +692,6 @@ impl Macaw { } Task::none() } - Message::MessageCompose(m) => { - if let Some(open_chat) = &mut self.open_chat { - open_chat.new_message = m; - } - Task::none() - } Message::SendMessage(jid, body) => { let client = match &self.client { Account::LoggedIn(client) => client.clone(), @@ -755,18 +750,20 @@ impl Macaw { }; let connected = self.client.is_connected(); - let account_view = row![ + let account_view = container(row![ text(client_jid), - toggler(connected) - .on_toggle(|connect| { - if connect { - Message::Connect - } else { - Message::Disconnect - } - }) - .label(connection_status), - ]; + horizontal_space(), + text(connection_status), + horizontal_space().width(8), + toggler(connected).on_toggle(|connect| { + if connect { + Message::Connect + } else { + Message::Disconnect + } + }) + ]) + .padding(8); // TODO: config width/resizing let sidebar = column![chats_list, account_view].height(Fill).width(300); |