chiark / gitweb /
Flag readonly mode on the main menu.
authorSimon Tatham <anakin@pobox.com>
Fri, 5 Jan 2024 10:12:58 +0000 (10:12 +0000)
committerSimon Tatham <anakin@pobox.com>
Fri, 5 Jan 2024 10:12:58 +0000 (10:12 +0000)
Then I get a reminder of whether I can safely compose embarrassingly
nonsensical test toots, or whether I'm supposed to be being coherent :-)

src/client.rs
src/menu.rs

index 5c4d5b0bcf91c63c7a63b8d94b5bf9c06e69edc0..e6700ea34f6bbacbce5af085a30614b8683c8839 100644 (file)
@@ -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<File>) {
         self.logfile = file;
     }
index f33c6dbf28a7211ed0ec2dde08b9ed7b58354b4e..c8857734e90d51d0b4f724fe60b090fbd100be2f 100644 (file)
@@ -229,6 +229,10 @@ pub fn main_menu(client: &Client) -> Box<dyn ActivityState> {
     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())
 }