From 0898bf63c9f7c798fbe0a3bb4c2da2bf4e7fc553 Mon Sep 17 00:00:00 2001 From: Elias Projahn Date: Mon, 15 Feb 2021 17:29:39 +0100 Subject: [PATCH] Adapt to newest gtk-rs --- musicus/src/editors/recording.rs | 2 +- musicus/src/editors/work.rs | 2 +- musicus/src/editors/work_part.rs | 2 +- musicus/src/editors/work_section.rs | 2 +- musicus/src/import/medium_editor.rs | 4 ++-- musicus/src/preferences/login.rs | 4 ++-- musicus/src/preferences/register.rs | 10 +++++----- musicus/src/preferences/server.rs | 2 +- musicus/src/screens/main.rs | 2 +- musicus/src/selectors/selector.rs | 2 +- musicus/src/widgets/entry_row.rs | 2 +- musicus/src/widgets/screen.rs | 2 +- 12 files changed, 18 insertions(+), 18 deletions(-) diff --git a/musicus/src/editors/recording.rs b/musicus/src/editors/recording.rs index 7bea155..a9c9b22 100644 --- a/musicus/src/editors/recording.rs +++ b/musicus/src/editors/recording.rs @@ -188,7 +188,7 @@ impl RecordingEditor { .borrow() .clone() .expect("Tried to create recording without work!"), - comment: self.comment_entry.get_text().unwrap().to_string(), + comment: self.comment_entry.get_text().to_string(), performances: self.performances.borrow().clone(), }; diff --git a/musicus/src/editors/work.rs b/musicus/src/editors/work.rs index ce105f5..e8e5e40 100644 --- a/musicus/src/editors/work.rs +++ b/musicus/src/editors/work.rs @@ -322,7 +322,7 @@ impl WorkEditor { let work = Work { id: self.id.clone(), - title: self.title_entry.get_text().unwrap().to_string(), + title: self.title_entry.get_text().to_string(), composer: self .composer .borrow() diff --git a/musicus/src/editors/work_part.rs b/musicus/src/editors/work_part.rs index 82745d9..22ebcaf 100644 --- a/musicus/src/editors/work_part.rs +++ b/musicus/src/editors/work_part.rs @@ -43,7 +43,7 @@ impl Screen, WorkPart> for WorkPartEditor { save_button.connect_clicked(clone!(@weak this => move |_| { let section = WorkPart { - title: this.title_entry.get_text().unwrap().to_string(), + title: this.title_entry.get_text().to_string(), }; this.handle.pop(Some(section)); diff --git a/musicus/src/editors/work_section.rs b/musicus/src/editors/work_section.rs index 5f04762..5be6d58 100644 --- a/musicus/src/editors/work_section.rs +++ b/musicus/src/editors/work_section.rs @@ -44,7 +44,7 @@ impl Screen, WorkSection> for WorkSectionEditor { save_button.connect_clicked(clone!(@weak this => move |_| { let section = WorkSection { before_index: 0, - title: this.title_entry.get_text().unwrap().to_string(), + title: this.title_entry.get_text().to_string(), }; this.handle.pop(Some(section)); diff --git a/musicus/src/import/medium_editor.rs b/musicus/src/import/medium_editor.rs index c2b1027..787461a 100644 --- a/musicus/src/import/medium_editor.rs +++ b/musicus/src/import/medium_editor.rs @@ -154,7 +154,7 @@ impl Screen>, ()> for MediumEditor { impl MediumEditor { /// Save the medium and possibly upload it to the server. async fn save(&self) -> Result<()> { - let name = self.name_entry.get_text().unwrap().to_string(); + let name = self.name_entry.get_text().to_string(); // Create a new directory in the music library path for the imported medium. @@ -200,7 +200,7 @@ impl MediumEditor { let medium = Medium { id: generate_id(), - name: self.name_entry.get_text().unwrap().to_string(), + name: self.name_entry.get_text().to_string(), discid: self.source.discid(), tracks: track_sets, }; diff --git a/musicus/src/preferences/login.rs b/musicus/src/preferences/login.rs index 2df4038..cd7f14c 100644 --- a/musicus/src/preferences/login.rs +++ b/musicus/src/preferences/login.rs @@ -57,8 +57,8 @@ impl Screen, Option> for LoginDialog { this.widget.set_visible_child_name("loading"); let data = LoginData { - username: this.username_entry.get_text().unwrap().to_string(), - password: this.password_entry.get_text().unwrap().to_string(), + username: this.username_entry.get_text().to_string(), + password: this.password_entry.get_text().to_string(), }; spawn!(@clone this, async move { diff --git a/musicus/src/preferences/register.rs b/musicus/src/preferences/register.rs index 268b111..ebe84b8 100644 --- a/musicus/src/preferences/register.rs +++ b/musicus/src/preferences/register.rs @@ -56,8 +56,8 @@ impl Screen<(), LoginData> for RegisterDialog { })); register_button.connect_clicked(clone!(@weak this => move |_| { - let password = this.password_entry.get_text().unwrap().to_string(); - let repeat = this.repeat_password_entry.get_text().unwrap().to_string(); + let password = this.password_entry.get_text().to_string(); + let repeat = this.repeat_password_entry.get_text().to_string(); if password != repeat { // TODO: Show error and validate other input. @@ -65,10 +65,10 @@ impl Screen<(), LoginData> for RegisterDialog { this.widget.set_visible_child_name("loading"); spawn!(@clone this, async move { - let username = this.username_entry.get_text().unwrap().to_string(); - let email = this.email_entry.get_text().unwrap().to_string(); + let username = this.username_entry.get_text().to_string(); + let email = this.email_entry.get_text().to_string(); let captcha_id = this.captcha_id.borrow().clone().unwrap(); - let answer = this.captcha_entry.get_text().unwrap().to_string(); + let answer = this.captcha_entry.get_text().to_string(); let email = if email.len() == 0 { None diff --git a/musicus/src/preferences/server.rs b/musicus/src/preferences/server.rs index be3de36..fa46cf2 100644 --- a/musicus/src/preferences/server.rs +++ b/musicus/src/preferences/server.rs @@ -40,7 +40,7 @@ impl ServerDialog { })); set_button.connect_clicked(clone!(@strong this => move |_| { - let url = this.url_entry.get_text().unwrap().to_string(); + let url = this.url_entry.get_text().to_string(); this.backend.set_server_url(&url); if let Some(cb) = &*this.selected_cb.borrow() { diff --git a/musicus/src/screens/main.rs b/musicus/src/screens/main.rs index 2f0c29a..97fca89 100644 --- a/musicus/src/screens/main.rs +++ b/musicus/src/screens/main.rs @@ -135,7 +135,7 @@ impl Screen<(), ()> for MainScreen { this.poe_list.set_filter_cb(clone!(@weak this => move |index| { let poe = &this.poes.borrow()[index]; - let search = this.search_entry.get_text().unwrap().to_string().to_lowercase(); + let search = this.search_entry.get_text().to_string().to_lowercase(); let title = poe.get_title().to_lowercase(); search.is_empty() || title.contains(&search) })); diff --git a/musicus/src/selectors/selector.rs b/musicus/src/selectors/selector.rs index a191116..f9e7f12 100644 --- a/musicus/src/selectors/selector.rs +++ b/musicus/src/selectors/selector.rs @@ -105,7 +105,7 @@ impl Selector { match &*this.filter.borrow() { Some(filter) => { let item = &this.items.borrow()[index]; - let search = this.search_entry.get_text().unwrap().to_string().to_lowercase(); + let search = this.search_entry.get_text().to_string().to_lowercase(); search.is_empty() || filter(&search, item) } None => true, diff --git a/musicus/src/widgets/entry_row.rs b/musicus/src/widgets/entry_row.rs index bab51fe..b61e960 100644 --- a/musicus/src/widgets/entry_row.rs +++ b/musicus/src/widgets/entry_row.rs @@ -39,6 +39,6 @@ impl EntryRow { /// Get the text that was entered by the user. pub fn get_text(&self) -> String { - self.entry.get_text().unwrap().to_string() + self.entry.get_text().to_string() } } diff --git a/musicus/src/widgets/screen.rs b/musicus/src/widgets/screen.rs index ff50514..13af797 100644 --- a/musicus/src/widgets/screen.rs +++ b/musicus/src/widgets/screen.rs @@ -98,7 +98,7 @@ impl Screen { /// Get the current search string. pub fn get_search(&self) -> String { - self.search_entry.get_text().unwrap().to_string().to_lowercase() + self.search_entry.get_text().to_string().to_lowercase() } /// Hide the loading page and switch to the content.