From: Simon Tatham Date: Fri, 5 Jan 2024 10:12:58 +0000 (+0000) Subject: Flag readonly mode on the main menu. X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=e7b02cc3600418b936ac6453a7e4da6de2e6a479;p=mastodonochrome.git Flag readonly mode on the main menu. Then I get a reminder of whether I can safely compose embarrassingly nonsensical test toots, or whether I'm supposed to be being coherent :-) --- diff --git a/src/client.rs b/src/client.rs index 5c4d5b0..e6700ea 100644 --- a/src/client.rs +++ b/src/client.rs @@ -364,6 +364,8 @@ impl Client { self.permit_write = permit; } + pub fn is_writable(&self) -> bool { self.permit_write } + pub fn set_logfile(&mut self, file: Option) { self.logfile = file; } diff --git a/src/menu.rs b/src/menu.rs index f33c6db..c885773 100644 --- a/src/menu.rs +++ b/src/menu.rs @@ -229,6 +229,10 @@ pub fn main_menu(client: &Client) -> Box { menu.add_action(Escape, "Utilities and Exit", LogicalAction::Nothing); menu.add_info(&format!("Logged in as {}", &client.our_account_fq())); + if !client.is_writable() { + menu.add_info_coloured(ColouredString::uniform( + "Mastodonochrome was run in readonly mode", 'r')); + } Box::new(menu.finalise()) }