Commit 7f51836d authored by Bilal Elmoussaoui's avatar Bilal Elmoussaoui

Bump gtk-rs crates

parent 93bb458d
......@@ -6,9 +6,9 @@ edition = "2021"
[dependencies]
gtk = { package = "gtk4", version = "0.5", features= ["v4_2"]}
gtk = { package = "gtk4", version = "0.6", features= ["gnome_44"]}
log = "0.4"
gettext-rs = { version = "0.7", features = ["gettext-system"] }
adw = {package = "libadwaita", version = "0.2"}
adw = {package = "libadwaita", version = "0.3"}
pretty_env_logger = "0.4"
regex = "1.5"
......@@ -24,7 +24,7 @@ mod imp {
impl ApplicationImpl for Application {
fn activate(&self) {
self.parent_activate();
let application = self.instance();
let application = self.obj();
let window = Window::new(&application);
application.add_window(&window);
......@@ -34,7 +34,7 @@ mod imp {
fn startup(&self) {
self.parent_startup();
let application = self.instance();
let application = self.obj();
// Quit
let quit = gio::ActionEntry::builder("quit")
.activate(move |app: &Self::Type, _, _| app.quit())
......@@ -65,9 +65,7 @@ mod imp {
}
})
.build();
application
.add_action_entries([quit, start_tour, skip_tour, next_page, previous_page])
.unwrap();
application.add_action_entries([quit, start_tour, skip_tour, next_page, previous_page]);
application.set_accels_for_action("app.quit", &["<Control>q"]);
application.set_accels_for_action("app.skip-tour", &["Escape"]);
......@@ -86,10 +84,10 @@ glib::wrapper! {
impl Application {
#[allow(clippy::new_without_default)]
pub fn new() -> Self {
glib::Object::new(&[
("application-id", &config::APP_ID),
("resource-base-path", &Some("/org/gnome/Tour")),
])
glib::Object::builder()
.property("application-id", &config::APP_ID)
.property("resource-base-path", &Some("/org/gnome/Tour"))
.build()
}
fn window(&self) -> Window {
......
......@@ -27,7 +27,7 @@ mod imp {
impl ObjectImpl for ImagePageWidget {
fn constructed(&self) {
self.parent_constructed();
let obj = self.instance();
let obj = self.obj();
let layout_manager = obj
.layout_manager()
.map(|l| l.downcast::<gtk::BoxLayout>().unwrap())
......@@ -55,7 +55,7 @@ mod imp {
clamp.set_child(Some(&container));
self.picture.set_can_shrink(false);
self.picture.set_keep_aspect_ratio(true);
self.picture.set_content_fit(gtk::ContentFit::Contain);
container.append(&self.picture);
let head_label = gtk::Label::builder()
......@@ -138,11 +138,11 @@ glib::wrapper! {
impl ImagePageWidget {
pub fn new(resource_uri: &str, head: String, body: String) -> Self {
glib::Object::new::<Self>(&[
("resource-uri", &resource_uri),
("head", &head),
("body", &body),
])
glib::Object::builder()
.property("resource-uri", &resource_uri)
.property("head", &head)
.property("body", &body)
.build()
}
pub fn set_body(&self, body: &str) {
......
......@@ -44,7 +44,7 @@ mod imp {
impl ObjectImpl for PaginatorWidget {
fn constructed(&self) {
self.parent_constructed();
let obj = self.instance();
let obj = self.obj();
let layout_manager = obj
.layout_manager()
.map(|l| l.downcast::<gtk::BoxLayout>().unwrap())
......@@ -67,7 +67,7 @@ mod imp {
gtk::Inhibit(false)
}));
obj.add_controller(&controller);
obj.add_controller(controller);
}
}
impl WidgetImpl for PaginatorWidget {}
......@@ -77,7 +77,7 @@ mod imp {
if !self.carousel.is_bound() {
self.parent_add_child(builder, child, type_);
} else {
self.instance()
self.obj()
.add_page(child.clone().downcast::<gtk::Widget>().unwrap());
}
}
......@@ -92,7 +92,7 @@ glib::wrapper! {
impl PaginatorWidget {
pub fn new() -> Self {
glib::Object::new(&[])
glib::Object::new()
}
pub fn try_next(&self) -> Option<()> {
......
......@@ -39,7 +39,7 @@ mod imp {
impl ObjectImpl for Window {
fn constructed(&self) {
self.parent_constructed();
let widget = self.instance();
let widget = self.obj();
widget.set_icon_name(Some(config::APP_ID));
// Devel Profile
......@@ -71,7 +71,7 @@ glib::wrapper! {
impl Window {
pub fn new(app: &Application) -> Self {
glib::Object::new(&[("application", app)])
glib::Object::builder().property("application", app).build()
}
pub fn paginator(&self) -> PaginatorWidget {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment