display the whole welcome message
This commit is contained in:
parent
aaf2f974c7
commit
a7b3ecf178
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -581,6 +581,7 @@ version = "0.1.1"
|
||||
dependencies = [
|
||||
"either",
|
||||
"nom",
|
||||
"serde",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
|
@ -30,7 +30,7 @@ pub(crate) async fn run(
|
||||
connected.log_server_settings().await;
|
||||
to_frontend_tx
|
||||
.send(BackToFront::ServerConnected(
|
||||
connected.get_greeting().unwrap(),
|
||||
connected.get_server_capabilities(),
|
||||
))
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -1,4 +1,4 @@
|
||||
use std::{cell::RefCell, rc::Rc};
|
||||
use std::{cell::RefCell, fmt::Display, rc::Rc};
|
||||
|
||||
use gtk4::{
|
||||
glib,
|
||||
@ -40,10 +40,14 @@ fn build_ui(
|
||||
action_content_status.append(&action);
|
||||
action_content_status.append(&main_log_server_info);
|
||||
action_content_status.append(&status);
|
||||
let log = gtk4::Label::new(Some("Log"));
|
||||
let server_info = gtk4::Label::new(Some("Server Info"));
|
||||
let log = gtk4::Label::builder().label("Log").hexpand(true).build();
|
||||
let server_info_content = gtk4::Label::builder().label("Server Info").build();
|
||||
let server_info_container = gtk4::ScrolledWindow::builder()
|
||||
.child(&server_info_content)
|
||||
.width_request(400)
|
||||
.build();
|
||||
main_log_server_info.append(&log);
|
||||
main_log_server_info.append(&server_info);
|
||||
main_log_server_info.append(&server_info_container);
|
||||
let main_window = gtk4::ApplicationWindow::builder()
|
||||
.application(app)
|
||||
.title("Sieverman")
|
||||
@ -53,7 +57,7 @@ fn build_ui(
|
||||
.build();
|
||||
main_window.present();
|
||||
|
||||
let server_info = Rc::new(RefCell::new(server_info));
|
||||
let server_info = Rc::new(RefCell::new(server_info_content));
|
||||
|
||||
let future = {
|
||||
let mut data_event_receiver = from_backend_rx.take().expect("data_event_reciver");
|
||||
@ -62,8 +66,9 @@ fn build_ui(
|
||||
trace!("data event: {:?}", event);
|
||||
match event {
|
||||
BackToFront::ServerConnected(message) => {
|
||||
trace!("Received {}", message);
|
||||
server_info.borrow_mut().set_text(&message);
|
||||
server_info
|
||||
.borrow_mut()
|
||||
.set_label(&format!("{:#?}", message));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use managesieve::Capability;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
pub enum BackToFront {
|
||||
ServerConnected(String),
|
||||
ServerConnected(Vec<Capability>),
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
use std::{any, net::SocketAddr, sync::Arc};
|
||||
use std::{any, net::SocketAddr, sync::Arc, time::Duration};
|
||||
|
||||
use log::{error, info, trace};
|
||||
use managesieve::Capability;
|
||||
@ -116,6 +116,7 @@ impl ConnectionConnected {
|
||||
buffer,
|
||||
server_settings,
|
||||
} = self;
|
||||
tokio::time::sleep(Duration::from_millis(500)).await;
|
||||
let mut bf = buffer.lock().await;
|
||||
let bf_str = bf.clone();
|
||||
match managesieve::response_capability(&bf_str) {
|
||||
@ -155,6 +156,9 @@ impl ConnectionConnected {
|
||||
}
|
||||
None
|
||||
}
|
||||
pub fn get_server_capabilities(&self) -> Vec<Capability> {
|
||||
self.server_settings.clone()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
Loading…
Reference in New Issue
Block a user