Commit b44f77e5 authored by Bilal Elmoussaoui's avatar Bilal Elmoussaoui

use gtk-rs from git

This is in preparation for a future gtk-rs release
parent 347c85f3
...@@ -8,10 +8,10 @@ edition = "2018" ...@@ -8,10 +8,10 @@ edition = "2018"
video = ["gst_player", "gst"] video = ["gst_player", "gst"]
[dependencies] [dependencies]
gtk = { package = "gtk4", version = "0.3", features= ["v4_2"]} gtk = { package = "gtk4", git = "https://github.com/gtk-rs/gtk4-rs", features= ["v4_2"]}
log = "0.4" log = "0.4"
gettext-rs = { version = "0.6", features = ["gettext-system"] } gettext-rs = { version = "0.7", features = ["gettext-system"] }
libadwaita = "0.1.0-beta-1" adw = {package = "libadwaita", git = "https://gitlab.gnome.org/World/Rust/libadwaita-rs"}
pretty_env_logger = "0.4" pretty_env_logger = "0.4"
[dependencies.gst_player] [dependencies.gst_player]
......
...@@ -8,14 +8,13 @@ use log::info; ...@@ -8,14 +8,13 @@ use log::info;
use std::{cell::RefCell, rc::Rc}; use std::{cell::RefCell, rc::Rc};
pub struct Application { pub struct Application {
app: libadwaita::Application, app: adw::Application,
window: RefCell<Rc<Option<Window>>>, window: RefCell<Rc<Option<Window>>>,
} }
impl Application { impl Application {
pub fn new() -> Rc<Self> { pub fn new() -> Rc<Self> {
let app = let app = adw::Application::new(Some(config::APP_ID), gio::ApplicationFlags::FLAGS_NONE);
libadwaita::Application::new(Some(config::APP_ID), gio::ApplicationFlags::FLAGS_NONE);
app.set_resource_base_path(Some("/org/gnome/Tour")); app.set_resource_base_path(Some("/org/gnome/Tour"));
let application = Rc::new(Self { let application = Rc::new(Self {
......
...@@ -32,7 +32,7 @@ impl ImagePageWidget { ...@@ -32,7 +32,7 @@ impl ImagePageWidget {
.margin_start(12) .margin_start(12)
.margin_end(12) .margin_end(12)
.build(); .build();
let clamp = libadwaita::Clamp::new(); let clamp = adw::Clamp::new();
clamp.set_child(Some(&container)); clamp.set_child(Some(&container));
let picture = gtk::Picture::builder() let picture = gtk::Picture::builder()
......
...@@ -78,7 +78,7 @@ impl WelcomePageWidget { ...@@ -78,7 +78,7 @@ impl WelcomePageWidget {
self.widget.add_css_class("page"); self.widget.add_css_class("page");
self.widget.add_css_class("welcome-page"); self.widget.add_css_class("welcome-page");
let clamp = libadwaita::Clamp::new(); let clamp = adw::Clamp::new();
clamp.set_child(Some(&container)); clamp.set_child(Some(&container));
#[cfg(not(feature = "video"))] #[cfg(not(feature = "video"))]
......
...@@ -6,8 +6,8 @@ use std::rc::Rc; ...@@ -6,8 +6,8 @@ use std::rc::Rc;
pub struct PaginatorWidget { pub struct PaginatorWidget {
pub widget: gtk::Box, pub widget: gtk::Box,
carousel: libadwaita::Carousel, carousel: adw::Carousel,
carousel_dots: libadwaita::CarouselIndicatorDots, carousel_dots: adw::CarouselIndicatorDots,
headerbar: gtk::HeaderBar, headerbar: gtk::HeaderBar,
pages: RefCell<Vec<gtk::Widget>>, pages: RefCell<Vec<gtk::Widget>>,
current_page: RefCell<u32>, current_page: RefCell<u32>,
...@@ -25,8 +25,8 @@ impl PaginatorWidget { ...@@ -25,8 +25,8 @@ impl PaginatorWidget {
let paginator = Rc::new(Self { let paginator = Rc::new(Self {
widget, widget,
carousel: libadwaita::Carousel::new(), carousel: adw::Carousel::new(),
carousel_dots: libadwaita::CarouselIndicatorDots::new(), carousel_dots: adw::CarouselIndicatorDots::new(),
headerbar: gtk::HeaderBar::builder().show_title_buttons(false).build(), headerbar: gtk::HeaderBar::builder().show_title_buttons(false).build(),
start_btn: gtk::Button::with_label(&gettext("_Start")), start_btn: gtk::Button::with_label(&gettext("_Start")),
next_overlay: gtk::Overlay::new(), next_overlay: gtk::Overlay::new(),
...@@ -114,7 +114,7 @@ impl PaginatorWidget { ...@@ -114,7 +114,7 @@ impl PaginatorWidget {
self.carousel.set_hexpand(true); self.carousel.set_hexpand(true);
self.carousel.set_vexpand(true); self.carousel.set_vexpand(true);
self.carousel self.carousel
.set_scroll_params(&libadwaita::SpringParams::new(1.0, 0.5, 300.0)); .set_scroll_params(&adw::SpringParams::new(1.0, 0.5, 300.0));
self.carousel self.carousel
.connect_position_notify(clone!(@weak p => move |_| { .connect_position_notify(clone!(@weak p => move |_| {
......
use adw::prelude::*;
use gettextrs::gettext; use gettextrs::gettext;
use gtk::glib;
use gtk::prelude::*;
use libadwaita::traits::ApplicationWindowExt;
use std::cell::RefCell; use std::cell::RefCell;
use std::rc::Rc; use std::rc::Rc;
...@@ -10,13 +8,13 @@ use super::paginator::PaginatorWidget; ...@@ -10,13 +8,13 @@ use super::paginator::PaginatorWidget;
use crate::config::{APP_ID, PROFILE}; use crate::config::{APP_ID, PROFILE};
pub struct Window { pub struct Window {
pub widget: libadwaita::ApplicationWindow, pub widget: adw::ApplicationWindow,
pub paginator: RefCell<Rc<PaginatorWidget>>, pub paginator: RefCell<Rc<PaginatorWidget>>,
} }
impl Window { impl Window {
pub fn new(app: &libadwaita::Application) -> Self { pub fn new(app: &adw::Application) -> Self {
let widget = libadwaita::ApplicationWindow::new(app); let widget = adw::ApplicationWindow::new(app);
let paginator = RefCell::new(PaginatorWidget::new()); let paginator = RefCell::new(PaginatorWidget::new());
......
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