gtk: update Dialog subclassing
close/response are signals virtual functions
so they can be None
@@ -29,27 +29,25 @@ impl<T: DialogImpl> DialogImplExt for T {
unsafe {
let data = T::type_data();
let parent_class = data.as_ref().get_parent_class() as *mut gtk_sys::GtkDialogClass;
- let f = (*parent_class)
- .response
- .expect("No parent class impl for \"response\"");
+ if let Some(f) = (*parent_class).response {
f(
dialog.unsafe_cast_ref::<Dialog>().to_glib_none().0,
response.to_glib(),
)
}
}
+ }
fn parent_close(&self, dialog: &Self::Type) {
unsafe {
let data = T::type_data();
let parent_class = data.as_ref().get_parent_class() as *mut gtk_sys::GtkDialogClass;
- let f = (*parent_class)
- .close
- .expect("No parent class impl for \"close\"");
+ if let Some(f) = (*parent_class).close {
f(dialog.unsafe_cast_ref::<Dialog>().to_glib_none().0)
}
}
}
+}
unsafe impl<T: DialogImpl> IsSubclassable<T> for Dialog {
fn override_vfuncs(class: &mut glib::Class<Self>) {
