Use one standard Iris resource bundle
This commit is contained in:
1 parent
d8bb1699a8
commit
213a0debb7
24 files changed
+177
-186
No files matched your search
+9
-17
@@ -58,11 +58,7 @@ struct Client {
|
||||
impl DesktopAppState for Client {
|
||||
type Event = AppEvent;
|
||||
|
||||
fn new(
|
||||
mut ui_state: DesktopUiState,
|
||||
rsc: &mut DesktopRsc<Self>,
|
||||
proxy: Proxy<AppEvent>,
|
||||
) -> Self {
|
||||
fn new(mut ui_state: DesktopUiState, rsc: &mut StdRsc<Self>, proxy: Proxy<AppEvent>) -> Self {
|
||||
let (server, ca_pem) = super::startup::load_startup_config().unwrap_or_else(|e| {
|
||||
eprintln!("desktop-app: {e}");
|
||||
process::exit(2);
|
||||
@@ -107,7 +103,7 @@ impl DesktopAppState for Client {
|
||||
client
|
||||
}
|
||||
|
||||
fn event(&mut self, event: AppEvent, rsc: &mut DesktopRsc<Self>) {
|
||||
fn event(&mut self, event: AppEvent, rsc: &mut StdRsc<Self>) {
|
||||
match event {
|
||||
AppEvent::Sessions(Ok(sessions)) => {
|
||||
self.sessions = sessions;
|
||||
@@ -177,7 +173,7 @@ impl Client {
|
||||
&& self.generation.load(Ordering::SeqCst) == generation
|
||||
}
|
||||
|
||||
fn show_message(&mut self, rsc: &mut DesktopRsc<Self>, message: &str) {
|
||||
fn show_message(&mut self, rsc: &mut StdRsc<Self>, message: &str) {
|
||||
let widget = placeholder(rsc, message);
|
||||
(self.transcript_ptr)(rsc).set(widget);
|
||||
}
|
||||
@@ -191,7 +187,7 @@ impl Client {
|
||||
});
|
||||
}
|
||||
|
||||
fn rebuild_list(&mut self, rsc: &mut DesktopRsc<Self>) {
|
||||
fn rebuild_list(&mut self, rsc: &mut StdRsc<Self>) {
|
||||
let list = Span::empty(Dir::DOWN).gap(2).add(rsc);
|
||||
for session in &self.sessions {
|
||||
let selected = self.selected.as_deref() == Some(session.id.as_str());
|
||||
@@ -205,7 +201,7 @@ impl Client {
|
||||
(self.list_ptr)(rsc).set(tree);
|
||||
}
|
||||
|
||||
fn select_session(&mut self, rsc: &mut DesktopRsc<Self>, session_id: String) {
|
||||
fn select_session(&mut self, rsc: &mut StdRsc<Self>, session_id: String) {
|
||||
let generation = self.generation.fetch_add(1, Ordering::SeqCst) + 1;
|
||||
self.selected = Some(session_id.clone());
|
||||
self.items.clear();
|
||||
@@ -270,7 +266,7 @@ impl Client {
|
||||
});
|
||||
}
|
||||
|
||||
fn rebuild_transcript(&mut self, rsc: &mut DesktopRsc<Self>) {
|
||||
fn rebuild_transcript(&mut self, rsc: &mut StdRsc<Self>) {
|
||||
let in_progress = self
|
||||
.screen
|
||||
.as_ref()
|
||||
@@ -299,11 +295,7 @@ impl Client {
|
||||
}
|
||||
}
|
||||
|
||||
fn session_row(
|
||||
rsc: &mut DesktopRsc<Client>,
|
||||
session: &SessionSummary,
|
||||
selected: bool,
|
||||
) -> StrongWidget {
|
||||
fn session_row(rsc: &mut StdRsc<Client>, session: &SessionSummary, selected: bool) -> StrongWidget {
|
||||
let bg = if selected {
|
||||
Srgba8::rgb(58, 90, 138)
|
||||
} else {
|
||||
@@ -319,7 +311,7 @@ fn session_row(
|
||||
.background(rect(bg))
|
||||
.on(
|
||||
CursorSense::click(),
|
||||
move |ctx, rsc: &mut DesktopRsc<Client>| {
|
||||
move |ctx, rsc: &mut StdRsc<Client>| {
|
||||
ctx.state.select_session(rsc, id.clone());
|
||||
},
|
||||
)
|
||||
@@ -327,7 +319,7 @@ fn session_row(
|
||||
.any()
|
||||
}
|
||||
|
||||
fn placeholder(rsc: &mut DesktopRsc<Client>, message: &str) -> StrongWidget {
|
||||
fn placeholder(rsc: &mut StdRsc<Client>, message: &str) -> StrongWidget {
|
||||
wtext(message.to_string())
|
||||
.color(PaintId::WHITE)
|
||||
.wrap(true)
|
||||
|
||||
Reference in new issue
Block a user