desktop: Rename PathOrUrlField::value() to result()

This commit is contained in:
Kamil Jarosz 2024-08-08 01:08:50 +02:00 committed by TÖRÖK Attila
parent 87bf7b5b19
commit d487d3f1aa
3 changed files with 7 additions and 7 deletions

View File

@ -32,7 +32,7 @@ impl BookmarkAddDialog {
} }
fn is_valid(&self) -> bool { fn is_valid(&self) -> bool {
self.url.value().is_some() && !self.name.is_empty() self.url.result().is_some() && !self.name.is_empty()
} }
pub fn show(&mut self, locale: &LanguageIdentifier, egui_ctx: &egui::Context) -> bool { pub fn show(&mut self, locale: &LanguageIdentifier, egui_ctx: &egui::Context) -> bool {
@ -71,7 +71,7 @@ impl BookmarkAddDialog {
name: self.name.clone(), name: self.name.clone(),
url: self url: self
.url .url
.value() .result()
.cloned() .cloned()
.expect("is_valid() ensured value exists"), .expect("is_valid() ensured value exists"),
}) })
@ -248,10 +248,10 @@ impl BookmarksDialog {
} }
ui.end_row(); ui.end_row();
let previous_url = bookmark.url.value().cloned(); let previous_url = bookmark.url.result().cloned();
ui.label(text(locale, "bookmarks-dialog-location")); ui.label(text(locale, "bookmarks-dialog-location"));
let current_url = bookmark.url.ui(locale, ui).value(); let current_url = bookmark.url.ui(locale, ui).result();
// TODO: Change the UrlOrPathField widget to return a response instead, so we can update when we lose the focus, removes the need to clone every redraw. // TODO: Change the UrlOrPathField widget to return a response instead, so we can update when we lose the focus, removes the need to clone every redraw.
if previous_url.as_ref() != current_url { if previous_url.as_ref() != current_url {

View File

@ -288,7 +288,7 @@ impl OpenDialog {
} else { } else {
self.options.player.frame_rate = None; self.options.player.frame_rate = None;
} }
if let Some(url) = self.path.value() { if let Some(url) = self.path.result() {
if self if self
.event_loop .event_loop
.send_event(RuffleEvent::OpenURL( .send_event(RuffleEvent::OpenURL(
@ -321,7 +321,7 @@ impl OpenDialog {
.striped(true) .striped(true)
.show(ui, |ui| { .show(ui, |ui| {
ui.label(text(locale, "open-dialog-path")); ui.label(text(locale, "open-dialog-path"));
is_valid &= self.path.ui(locale, ui).value().is_some(); is_valid &= self.path.ui(locale, ui).result().is_some();
ui.end_row(); ui.end_row();
}); });
}); });

View File

@ -86,7 +86,7 @@ impl PathOrUrlField {
self self
} }
pub fn value(&self) -> Option<&Url> { pub fn result(&self) -> Option<&Url> {
self.result.as_ref() self.result.as_ref()
} }
} }