[gnome-tour: 1/2] Use default line length for cargo fmt




commit 8790f16eeb3b05ac975775937f687f238064a586
Author: Julian Hofer <julianhofer gnome org>
Date:   Thu Oct 1 20:43:14 2020 +0200

    Use default line length for cargo fmt

 rustfmt.toml                 |  1 -
 src/application.rs           | 18 ++++++++++--------
 src/widgets/pages/welcome.rs | 36 ++++++++++++++++++++++++------------
 src/widgets/paginator.rs     | 21 +++++++++++++++------
 src/widgets/window.rs        |  8 ++++++--
 5 files changed, 55 insertions(+), 29 deletions(-)
---
diff --git a/src/application.rs b/src/application.rs
index ee6cec7..fa4bf78 100644
--- a/src/application.rs
+++ b/src/application.rs
@@ -15,7 +15,8 @@ pub struct Application {
 
 impl Application {
     pub fn new() -> Rc<Self> {
-        let app = gtk::Application::new(Some(config::APP_ID), gio::ApplicationFlags::FLAGS_NONE).unwrap();
+        let app =
+            gtk::Application::new(Some(config::APP_ID), gio::ApplicationFlags::FLAGS_NONE).unwrap();
 
         let application = Rc::new(Self {
             app,
@@ -89,13 +90,14 @@ impl Application {
             app.setup_css();
             app.setup_gactions(app.clone());
         }));
-        self.app.connect_activate(clone!(@weak app => move |gtk_app| {
-           let window = Window::new(&gtk_app);
-            gtk_app.add_window(&window.widget);
-            window.widget.present();
-            window.widget.show();
-            app.window.replace(Rc::new(Some(window)));
-        }));
+        self.app
+            .connect_activate(clone!(@weak app => move |gtk_app| {
+               let window = Window::new(&gtk_app);
+                gtk_app.add_window(&window.widget);
+                window.widget.present();
+                window.widget.show();
+                app.window.replace(Rc::new(Some(window)));
+            }));
     }
 
     fn setup_css(&self) {
diff --git a/src/widgets/pages/welcome.rs b/src/widgets/pages/welcome.rs
index c2fc45f..fbcbbf2 100644
--- a/src/widgets/pages/welcome.rs
+++ b/src/widgets/pages/welcome.rs
@@ -36,9 +36,13 @@ impl WelcomePageWidget {
         #[cfg(feature = "video")]
         let player = {
             let dispatcher = gst_player::PlayerGMainContextSignalDispatcher::new(None);
-            let sink = gst::ElementFactory::make("gtksink", None).expect("Missing dependency: element 
gtksink is needed (usually, in gstreamer-plugins-good or in gst-plugin-gtk).");
+            let sink = gst::ElementFactory::make("gtksink", None)
+                .expect("Missing dependency: element gtksink is needed (usually, in gstreamer-plugins-good 
or in gst-plugin-gtk).");
             let renderer = gst_player::PlayerVideoOverlayVideoRenderer::with_sink(&sink).upcast();
-            gst_player::Player::new(Some(&renderer), 
Some(&dispatcher.upcast::<gst_player::PlayerSignalDispatcher>()))
+            gst_player::Player::new(
+                Some(&renderer),
+                Some(&dispatcher.upcast::<gst_player::PlayerSignalDispatcher>()),
+            )
         };
         #[cfg(feature = "video")]
         let (sender, r) = glib::MainContext::channel(glib::PRIORITY_DEFAULT);
@@ -120,15 +124,19 @@ impl WelcomePageWidget {
                 }),
             );
 
-            self.player.connect_state_changed(clone!(@strong self.sender as sender => move |_p,state| {
-                if state == gst_player::PlayerState::Playing {
-                    sender.send(Action::VideoUp).unwrap();
-                }
-            }));
+            self.player.connect_state_changed(
+                clone!(@strong self.sender as sender => move |_p,state| {
+                    if state == gst_player::PlayerState::Playing {
+                        sender.send(Action::VideoUp).unwrap();
+                    }
+                }),
+            );
 
-            self.player.connect_uri_loaded(clone!(@strong self.sender as sender => move |_p, _uri| {
-                sender.send(Action::VideoReady).unwrap();
-            }));
+            self.player.connect_uri_loaded(
+                clone!(@strong self.sender as sender => move |_p, _uri| {
+                    sender.send(Action::VideoReady).unwrap();
+                }),
+            );
             self.player.connect_end_of_stream(move |p| p.stop());
 
             let video_file = gio::File::new_for_path(config::VIDEO_PATH);
@@ -150,7 +158,9 @@ impl WelcomePageWidget {
         title.show();
         container.add(&title);
 
-        let text = gtk::Label::new(Some(&gettext("Hi there! Take the tour to learn your way around and 
discover essential features.")));
+        let text = gtk::Label::new(Some(&gettext(
+            "Hi there! Take the tour to learn your way around and discover essential features.",
+        )));
         text.get_style_context().add_class("body");
         text.set_margin_top(12);
         text.show();
@@ -180,7 +190,9 @@ impl WelcomePageWidget {
             .use_underline(true)
             .action_name("app.start-tour")
             .build();
-        start_tour_btn.get_style_context().add_class("suggested-action");
+        start_tour_btn
+            .get_style_context()
+            .add_class("suggested-action");
         start_tour_btn.show();
         actions_container.add(&start_tour_btn);
         actions_container.set_focus_child(Some(&start_tour_btn));
diff --git a/src/widgets/paginator.rs b/src/widgets/paginator.rs
index 20f25fb..1507b56 100644
--- a/src/widgets/paginator.rs
+++ b/src/widgets/paginator.rs
@@ -71,7 +71,11 @@ impl PaginatorWidget {
 
         let opacity_close = (position - n_pages + 2_f64).max(0_f64);
         let opacity_previous = if position <= 1_f64 { position } else { 1_f64 };
-        let opacity_next = if position <= 1_f64 && position <= n_pages { position % n_pages } else { 1_f64 };
+        let opacity_next = if position <= 1_f64 && position <= n_pages {
+            position % n_pages
+        } else {
+            1_f64
+        };
 
         self.close_btn.set_opacity(opacity_close);
         self.close_btn.set_visible(opacity_close > 0_f64);
@@ -93,20 +97,25 @@ impl PaginatorWidget {
         self.carousel.set_animation_duration(300);
         self.carousel.show();
 
-        self.carousel.connect_property_position_notify(clone!(@weak p => move |_| {
-            p.update_position();
-        }));
+        self.carousel
+            .connect_property_position_notify(clone!(@weak p => move |_| {
+                p.update_position();
+            }));
 
         let btn_size_group = gtk::SizeGroup::new(gtk::SizeGroupMode::Horizontal);
         btn_size_group.add_widget(&self.previous_btn);
         btn_size_group.add_widget(&self.next_btn);
         btn_size_group.add_widget(&self.close_btn);
 
-        self.next_btn.get_style_context().add_class("suggested-action");
+        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.get_style_context().add_class("suggested-action");
+        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.quit"));
 
diff --git a/src/widgets/window.rs b/src/widgets/window.rs
index 91902e3..34c0f5d 100644
--- a/src/widgets/window.rs
+++ b/src/widgets/window.rs
@@ -42,7 +42,9 @@ impl Window {
         if PROFILE == "Devel" {
             self.widget.get_style_context().add_class("devel");
         }
-        self.paginator.borrow_mut().add_page(WelcomePageWidget::new().widget.upcast::<gtk::Widget>());
+        self.paginator
+            .borrow_mut()
+            .add_page(WelcomePageWidget::new().widget.upcast::<gtk::Widget>());
 
         self.paginator.borrow_mut().add_page(
             ImagePageWidget::new(
@@ -102,7 +104,9 @@ impl Window {
             gettext("To get more advice and tips, see the Help app."),
         );
         last_page.widget.get_style_context().add_class("last-page");
-        self.paginator.borrow_mut().add_page(last_page.widget.upcast::<gtk::Widget>());
+        self.paginator
+            .borrow_mut()
+            .add_page(last_page.widget.upcast::<gtk::Widget>());
 
         self.widget.add(&self.paginator.borrow().widget);
     }


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