Skip to content
This repository was archived by the owner on Mar 4, 2024. It is now read-only.

Commit 3ddda89

Browse files
committed
Update for glib::Object::new() API changes
1 parent e276298 commit 3ddda89

File tree

9 files changed

+10
-15
lines changed

9 files changed

+10
-15
lines changed

examples/basic_subclass/simple_application/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,5 @@ impl SimpleApplication {
1515
("application-id", &"org.gtk-rs.SimpleApplication"),
1616
("flags", &ApplicationFlags::empty()),
1717
])
18-
.expect("Failed to create SimpleApp")
1918
}
2019
}

examples/basic_subclass/simple_window/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ glib::wrapper! {
1111

1212
impl SimpleWindow {
1313
pub fn new(app: &SimpleApplication) -> Self {
14-
glib::Object::new(&[("application", app)]).expect("Failed to create SimpleWindow")
14+
glib::Object::new(&[("application", app)])
1515
}
1616
}

examples/composite_template/example_application_window/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ glib::wrapper! {
1212
impl ExampleApplicationWindow {
1313
pub fn new<P: glib::IsA<gtk::Application>>(app: &P) -> Self {
1414
glib::Object::new(&[("application", app)])
15-
.expect("Failed to create ExampleApplicationWindow")
1615
}
1716

1817
fn init_label(&self) {

examples/list_box_model/model/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ glib::wrapper! {
1515
impl Model {
1616
#[allow(clippy::new_without_default)]
1717
pub fn new() -> Model {
18-
glib::Object::new(&[]).expect("Failed to create Model")
18+
glib::Object::new(&[])
1919
}
2020

2121
pub fn append(&self, obj: &RowData) {

examples/list_box_model/row_data/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ glib::wrapper! {
1818
// initial values for our two properties and then returns the new instance
1919
impl RowData {
2020
pub fn new(name: &str, count: u32) -> RowData {
21-
glib::Object::new(&[("name", &name), ("count", &count)]).expect("Failed to create row data")
21+
glib::Object::new(&[("name", &name), ("count", &count)])
2222
}
2323
}

gtk/src/builder.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,11 @@ impl<O: IsA<Builder>> BuilderExtManual for O {
199199
let handler_name: Borrowed<GString> = from_glib_borrow(handler_name);
200200
let callback: *mut P = user_data as *const _ as usize as *mut P;
201201
let func = (*callback)(&builder, handler_name.as_str());
202-
object
203-
.try_connect_unsafe(
204-
signal_name.as_str(),
205-
flags & glib::gobject_ffi::G_CONNECT_AFTER != 0,
206-
move |args| func(args),
207-
)
208-
.expect("Failed to connect to builder signal");
202+
object.connect_unsafe(
203+
signal_name.as_str(),
204+
flags & glib::gobject_ffi::G_CONNECT_AFTER != 0,
205+
move |args| func(args),
206+
);
209207
}
210208
let func = Some(func_func::<P> as _);
211209
let super_callback0: &P = &func_data;

gtk/src/image.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ impl ImageBuilder {
253253
if let Some(ref width_request) = self.width_request {
254254
properties.push(("width-request", width_request));
255255
}
256-
glib::Object::new::<Image>(&properties).expect("Failed to create an instance of Image")
256+
glib::Object::new::<Image>(&properties)
257257
}
258258

259259
pub fn file(mut self, file: &str) -> Self {

gtk/src/stack_switcher.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@ impl StackSwitcherBuilder {
259259
properties.push(("orientation", orientation));
260260
}
261261
glib::Object::new::<StackSwitcher>(&properties)
262-
.expect("Failed to create an instance of StackSwitcher")
263262
}
264263

265264
pub fn icon_size(mut self, icon_size: IconSize) -> Self {

gtk3-macros/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ use syn::{parse_macro_input, DeriveInput};
7575
///
7676
/// impl MyWidget {
7777
/// pub fn new() -> Self {
78-
/// glib::Object::new(&[]).expect("Failed to create an instance of MyWidget")
78+
/// glib::Object::new(&[])
7979
/// }
8080
/// }
8181
/// # fn main() {}

0 commit comments

Comments
 (0)