Skip to content

Commit

Permalink
desktop: Rename PathOrUrlField::value() to result()
Browse files Browse the repository at this point in the history
  • Loading branch information
kjarosh authored and torokati44 committed Aug 20, 2024
1 parent 87bf7b5 commit d487d3f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions desktop/src/gui/dialogs/bookmarks_dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl BookmarkAddDialog {
}

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 {
Expand Down Expand Up @@ -71,7 +71,7 @@ impl BookmarkAddDialog {
name: self.name.clone(),
url: self
.url
.value()
.result()
.cloned()
.expect("is_valid() ensured value exists"),
})
Expand Down Expand Up @@ -248,10 +248,10 @@ impl BookmarksDialog {
}
ui.end_row();

let previous_url = bookmark.url.value().cloned();
let previous_url = bookmark.url.result().cloned();

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.
if previous_url.as_ref() != current_url {
Expand Down
4 changes: 2 additions & 2 deletions desktop/src/gui/dialogs/open_dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ impl OpenDialog {
} else {
self.options.player.frame_rate = None;
}
if let Some(url) = self.path.value() {
if let Some(url) = self.path.result() {
if self
.event_loop
.send_event(RuffleEvent::OpenURL(
Expand Down Expand Up @@ -321,7 +321,7 @@ impl OpenDialog {
.striped(true)
.show(ui, |ui| {
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();
});
});
Expand Down
2 changes: 1 addition & 1 deletion desktop/src/gui/widgets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl PathOrUrlField {
self
}

pub fn value(&self) -> Option<&Url> {
pub fn result(&self) -> Option<&Url> {
self.result.as_ref()
}
}

0 comments on commit d487d3f

Please sign in to comment.