[gnome-tour/wip/exalm/ui-cleanups: 3/3] Clean up buttons



commit aca427aaf96605fb1a7bf5e6c15d592528d419f7
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Tue Jul 14 02:20:37 2020 +0500

    Clean up buttons
    
    Use with_label() instead of a manually created label, make the headerbar
    ones translatable, add mnenonics everywhere.

 src/widgets/pages/welcome.rs |  8 ++++----
 src/widgets/paginator.rs     | 12 ++++++------
 2 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/src/widgets/pages/welcome.rs b/src/widgets/pages/welcome.rs
index a61ae2c..e0636a5 100644
--- a/src/widgets/pages/welcome.rs
+++ b/src/widgets/pages/welcome.rs
@@ -48,17 +48,17 @@ impl WelcomePageWidget {
         actions_container.set_halign(gtk::Align::Center);
         actions_container.set_margin_top(36);
 
-        let start_tour_btn = gtk::Button::new();
-        start_tour_btn.add(&gtk::Label::new(Some(&gettext("Take the Tour"))));
+        let start_tour_btn = gtk::Button::with_label(&gettext("_Take the Tour"));
         start_tour_btn.get_style_context().add_class("suggested-action");
         start_tour_btn.set_property_height_request(40);
         start_tour_btn.set_property_width_request(180);
+        start_tour_btn.set_use_underline(true);
         start_tour_btn.set_action_name(Some("app.start-tour"));
 
-        let skip_tour_btn = gtk::Button::new();
-        skip_tour_btn.add(&gtk::Label::new(Some(&gettext("No Thanks"))));
+        let skip_tour_btn = gtk::Button::with_label(&gettext("_No Thanks"));
         skip_tour_btn.set_property_height_request(40);
         skip_tour_btn.set_property_width_request(180);
+        skip_tour_btn.set_use_underline(true);
         skip_tour_btn.set_action_name(Some("app.skip-tour"));
 
         actions_container.add(&skip_tour_btn);
diff --git a/src/widgets/paginator.rs b/src/widgets/paginator.rs
index 8209ebc..e957742 100644
--- a/src/widgets/paginator.rs
+++ b/src/widgets/paginator.rs
@@ -25,8 +25,8 @@ impl PaginatorWidget {
             widget,
             carousel: libhandy::Carousel::new(),
             headerbar: libhandy::HeaderBar::new(),
-            next_btn: gtk::Button::new(),
-            close_btn: gtk::Button::new(),
+            next_btn: gtk::Button::with_label(&gettext("_Next")),
+            close_btn: gtk::Button::with_label(&gettext("_Close")),
             pages: RefCell::new(Vec::new()),
             current_page: RefCell::new(0),
         });
@@ -78,8 +78,8 @@ impl PaginatorWidget {
             p.current_page.replace(page_nr);
         }));
 
-        let previous_btn = gtk::Button::new();
-        previous_btn.add(&gtk::Label::new(Some("Previous")));
+        let previous_btn = gtk::Button::with_label(&gettext("_Previous"));
+        previous_btn.set_use_underline(true);
         previous_btn.set_action_name(Some("app.previous-page"));
 
         let btn_size_group = gtk::SizeGroup::new(gtk::SizeGroupMode::Horizontal);
@@ -87,12 +87,12 @@ impl PaginatorWidget {
         btn_size_group.add_widget(&self.next_btn);
         btn_size_group.add_widget(&self.close_btn);
 
-        self.next_btn.add(&gtk::Label::new(Some(&gettext("Next"))));
         self.next_btn.get_style_context().add_class("suggested-action");
+        self.next_btn.set_use_underline(true);
         self.next_btn.set_action_name(Some("app.next-page"));
 
-        self.close_btn.add(&gtk::Label::new(Some(&gettext("Close"))));
         self.close_btn.get_style_context().add_class("suggested-action");
+        self.close_btn.set_use_underline(true);
         self.close_btn.set_action_name(Some("app.next-page"));
 
         let next_overlay = gtk::Overlay::new();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]