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

Bump gtk-rs crates

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