Skip to content

Commit

Permalink
gtk: Implement Downgrade for TemplateChild<T>
Browse files Browse the repository at this point in the history
  • Loading branch information
bilelmoussaoui committed May 24, 2024
1 parent 91216d8 commit dbaa54d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion gtk4/src/subclass/widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use std::{boxed::Box as Box_, collections::HashMap, fmt, future::Future};

use glib::{subclass::SignalId, translate::*, GString, Variant};
use glib::{clone::Downgrade, subclass::SignalId, translate::*, GString, Variant};

use crate::{
prelude::*, subclass::prelude::*, AccessibleRole, BuilderRustScope, BuilderScope,
Expand Down Expand Up @@ -1258,6 +1258,17 @@ where
}
}

impl<T> Downgrade for TemplateChild<T>
where
T: ObjectType + FromGlibPtrNone<*mut <T as ObjectType>::GlibType> + Downgrade,
{
type Weak = T::Weak;

fn downgrade(&self) -> Self::Weak {
T::downgrade(&self.get())
}
}

impl<T> TemplateChild<T>
where
T: ObjectType + FromGlibPtrNone<*mut <T as ObjectType>::GlibType>,
Expand Down

0 comments on commit dbaa54d

Please sign in to comment.