changeset 8:51a6c86d3141

Add mnemonic to all current tools.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 01 Nov 2020 14:49:26 +0100
parents 9c3e2d2efaa8
children d1972fc49a5b
files src/main.rs
diffstat 1 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/main.rs
+++ b/src/main.rs
@@ -290,28 +290,28 @@ fn build_ui(application: &gtk::Applicati
 
     macro_rules! impl_tool {
         ($tool:tt) => {
-            let tool = gtk::Button::with_label($tool);
+            let tool = gtk::Button::with_mnemonic($tool);
             let state_weak = Arc::downgrade(&state);
             tool.connect_clicked(move |b| {
                 let state = state_weak.upgrade().unwrap();
                 let mut state = state.lock().unwrap();
                 state.selected_tool = match b.get_label().unwrap().as_str() {
-                    "Pen" => Key::ButtonToolPen,
-                    "Rubber" => Key::ButtonToolRubber,
-                    "Brush" => Key::ButtonToolBrush,
-                    "Pencil" => Key::ButtonToolPencil,
-                    "Airbrush" => Key::ButtonToolAirbrush,
+                    "_Pen" => Key::ButtonToolPen,
+                    "_Rubber" => Key::ButtonToolRubber,
+                    "_Brush" => Key::ButtonToolBrush,
+                    "P_encil" => Key::ButtonToolPencil,
+                    "_Airbrush" => Key::ButtonToolAirbrush,
                     _ => unreachable!(),
                 };
             });
             tools_box.add(&tool);
         };
     };
-    impl_tool!("Pen");
-    impl_tool!("Rubber");
-    impl_tool!("Brush");
-    impl_tool!("Pencil");
-    impl_tool!("Airbrush");
+    impl_tool!("_Pen");
+    impl_tool!("_Rubber");
+    impl_tool!("_Brush");
+    impl_tool!("P_encil");
+    impl_tool!("_Airbrush");
 
     let drawing_area = gtk::DrawingArea::new();
     drawing_area.set_size_request(WIDTH, HEIGHT);