[fractal/remove-clippy-warnings: 11/12] clippy: Remove media_viewer data new function
- From: Daniel Garcia Moreno <danigm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal/remove-clippy-warnings: 11/12] clippy: Remove media_viewer data new function
- Date: Fri, 3 Jul 2020 14:51:26 +0000 (UTC)
commit ba38421d7670ed8eb361ba4d9f52b06870553a07
Author: Daniel GarcĂa Moreno <dani danigm net>
Date: Fri Jul 3 15:32:06 2020 +0200
clippy: Remove media_viewer data new function
The Data::new function is not needed, it just creates the struct with
the same params. This patch removes this method and moves the struct
creation to the MediaViewer constructor.
https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
fractal-gtk/src/widgets/media_viewer.rs | 63 +++++++++++----------------------
1 file changed, 21 insertions(+), 42 deletions(-)
---
diff --git a/fractal-gtk/src/widgets/media_viewer.rs b/fractal-gtk/src/widgets/media_viewer.rs
index 6ea0b2eb..3a91730e 100644
--- a/fractal-gtk/src/widgets/media_viewer.rs
+++ b/fractal-gtk/src/widgets/media_viewer.rs
@@ -144,41 +144,6 @@ struct Data {
}
impl Data {
- pub fn new(
- server_url: Url,
- access_token: AccessToken,
- media_list: Vec<Message>,
- current_media_index: usize,
- main_window: gtk::Window,
- builder: gtk::Builder,
- uid: UserId,
- admins: HashMap<UserId, i32>,
- ) -> Data {
- let is_fullscreen = main_window
- .get_window()
- .unwrap()
- .get_state()
- .contains(gdk::WindowState::FULLSCREEN);
- Data {
- media_list,
- current_media_index,
- prev_batch: None,
- loading_more_media: false,
- loading_error: false,
- no_more_media: false,
- widget: Widget::None,
- builder,
- server_url,
- access_token,
- uid,
- admins,
- main_window,
- signal_id: None,
- is_fullscreen,
- double_click_handler_id: None,
- }
- }
-
pub fn enter_full_screen(&mut self, thread_pool: ThreadPool) {
self.main_window.fullscreen();
self.is_fullscreen = true;
@@ -649,17 +614,31 @@ impl MediaViewer {
.position(|media| media.id == current_media_msg.id)
.unwrap_or_default();
+ let is_fullscreen = main_window
+ .get_window()
+ .unwrap()
+ .get_state()
+ .contains(gdk::WindowState::FULLSCREEN);
+
MediaViewer {
- data: Rc::new(RefCell::new(Data::new(
- server_url,
- access_token,
+ data: Rc::new(RefCell::new(Data {
media_list,
current_media_index,
- main_window,
- builder.clone(),
+ prev_batch: None,
+ loading_more_media: false,
+ loading_error: false,
+ no_more_media: false,
+ widget: Widget::None,
+ builder: builder.clone(),
+ server_url,
+ access_token,
uid,
- room.admins.clone(),
- ))),
+ admins: room.admins.clone(),
+ main_window,
+ signal_id: None,
+ is_fullscreen,
+ double_click_handler_id: None,
+ })),
builder,
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]