Skip to content

Commit

Permalink
Rename pending_handle to new_handle
Browse files Browse the repository at this point in the history
  • Loading branch information
ecton committed Oct 4, 2024
1 parent 4f3ef7d commit 75b7b88
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion examples/nested-modals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fn main() -> cushy::Result {
}

fn show_modal(present_in: &impl ModalTarget, level: usize) {
let handle = present_in.pending_handle();
let handle = present_in.new_handle();
handle
.build_dialog(
format!("Modal level: {level}")
Expand Down
2 changes: 1 addition & 1 deletion src/dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ where
T: ModalTarget,
{
fn open_message_box(&self, message: &MessageBox) {
let handle = self.pending_handle();
let handle = self.new_handle();
let dialog = handle.build_dialog(
message
.title
Expand Down
14 changes: 7 additions & 7 deletions src/widgets/layers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ impl Modal {
/// Returns a new pending handle that can be used to show a modal and
/// dismiss it.
#[must_use]
pub fn pending_handle(&self) -> ModalHandle {
pub fn new_handle(&self) -> ModalHandle {
ModalHandle {
layer: self.clone(),
above: None,
Expand All @@ -936,7 +936,7 @@ impl Modal {

/// Returns a builder for a modal dialog that displays `message`.
pub fn build_dialog(&self, message: impl MakeWidget) -> DialogBuilder {
DialogBuilder::new(self.pending_handle(), message)
DialogBuilder::new(self.new_handle(), message)
}

/// Dismisses the modal session.
Expand Down Expand Up @@ -1272,14 +1272,14 @@ impl Drop for ModalHandle {
/// A target for a [`Modal`] session.
pub trait ModalTarget: Send + 'static {
/// Returns a new handle that can be used to show a dialog above `self`.
fn pending_handle(&self) -> ModalHandle;
fn new_handle(&self) -> ModalHandle;
/// Returns a reference to the modal layer this target presents to.
fn layer(&self) -> &Modal;
}

impl ModalTarget for Modal {
fn pending_handle(&self) -> ModalHandle {
self.pending_handle()
fn new_handle(&self) -> ModalHandle {
self.new_handle()
}

fn layer(&self) -> &Modal {
Expand All @@ -1288,8 +1288,8 @@ impl ModalTarget for Modal {
}

impl ModalTarget for ModalHandle {
fn pending_handle(&self) -> ModalHandle {
self.layer.pending_handle().above(self)
fn new_handle(&self) -> ModalHandle {
self.layer.new_handle().above(self)
}

fn layer(&self) -> &Modal {
Expand Down

0 comments on commit 75b7b88

Please sign in to comment.