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