general: Use glib::Object::builder for objects w/ props

Builders are more idiomatic rust code than the old
pattern.
This commit is contained in:
Christopher Davis 2022-11-24 12:26:04 -05:00
parent d1d53e4f4a
commit 583794a3ec
2 changed files with 6 additions and 6 deletions

View file

@ -99,11 +99,11 @@ glib::wrapper! {
#[allow(clippy::new_without_default)]
impl LpApplication {
pub fn new() -> Self {
glib::Object::new(&[
("application-id", &config::APP_ID.to_string()),
("flags", &gio::ApplicationFlags::HANDLES_OPEN),
("resource-base-path", &"/org/gnome/Loupe/".to_string()),
])
glib::Object::builder()
.property("application-id", config::APP_ID)
.property("flags", gio::ApplicationFlags::HANDLES_OPEN)
.property("resource-base-path", "/org/gnome/Loupe")
.build()
}
pub fn setup_actions(&self) {

View file

@ -255,7 +255,7 @@ glib::wrapper! {
#[gtk::template_callbacks]
impl LpWindow {
pub fn new<A: IsA<gtk::Application>>(app: &A) -> Self {
glib::Object::new(&[("application", app)])
glib::Object::builder().property("application", app).build()
}
fn toggle_fullscreen(&self, fullscreen: bool) {