Compare commits

..

2 Commits

Author SHA1 Message Date
Savanni D'Gerinel 562d4871a1 Create padding within the content view 2023-08-24 22:33:36 -04:00
Savanni D'Gerinel 16c8dcb682 Add a CSS stylesheet 2023-08-24 22:10:05 -04:00
5 changed files with 33 additions and 13 deletions

View File

@ -1,7 +1,7 @@
fn main() {
glib_build_tools::compile_resources(
&["resources"],
"resources/resources.gresources.xml",
"resources/gresources.xml",
"com.luminescent-dreams.kifu-gtk.gresource",
);
}

View File

@ -2,5 +2,6 @@
<gresources>
<gresource prefix="/com/luminescent-dreams/kifu-gtk/">
<file>wood_texture.jpg</file>
<file>style.css</file>
</gresource>
</gresources>

View File

@ -0,0 +1,3 @@
.content {
padding: 8px;
}

View File

@ -131,7 +131,10 @@ impl Home {
players.append(&white_player);
*s.imp().white_player.borrow_mut() = Some(white_player.clone());
let new_game_button = gtk::Button::builder().label(&view.start_game.label).build();
let new_game_button = gtk::Button::builder()
.css_classes(vec!["suggested-action"])
.label(&view.start_game.label)
.build();
s.append(&new_game_button);
let library = Library::new();

View File

@ -1,6 +1,7 @@
use adw::prelude::*;
use gio::resources_lookup_data;
use glib::IsA;
use gtk::prelude::*;
use gtk::{prelude::*, STYLE_PROVIDER_PRIORITY_USER};
mod chat;
pub use chat::Chat;
@ -14,9 +15,6 @@ pub use game_preview::GamePreview;
mod library;
pub use library::Library;
mod layout;
pub use layout::Layout;
mod player_card;
pub use player_card::PlayerCard;
@ -40,6 +38,27 @@ pub struct AppWindow {
impl AppWindow {
pub fn new(app: &adw::Application) -> Self {
let window = adw::ApplicationWindow::builder()
.application(app)
.width_request(800)
.height_request(500)
.build();
let stylesheet = String::from_utf8(
resources_lookup_data(
"/com/luminescent-dreams/kifu-gtk/style.css",
gio::ResourceLookupFlags::NONE,
)
.expect("stylesheet should just be available")
.to_vec(),
)
.expect("to parse stylesheet");
let provider = gtk::CssProvider::new();
provider.load_from_data(&stylesheet);
let context = window.style_context();
context.add_provider(&provider, STYLE_PROVIDER_PRIORITY_USER);
let header = adw::HeaderBar::builder()
.title_widget(&gtk::Label::new(Some("Kifu")))
.build();
@ -55,7 +74,7 @@ impl AppWindow {
header.pack_end(&hamburger);
let content = adw::Bin::new();
let content = adw::Bin::builder().css_classes(vec!["content"]).build();
content.set_child(Some(
&adw::StatusPage::builder().title("Nothing here").build(),
));
@ -66,12 +85,6 @@ impl AppWindow {
layout.append(&header);
layout.append(&content);
let window = adw::ApplicationWindow::builder()
.application(app)
.width_request(800)
.height_request(500)
.build();
window.set_content(Some(&layout));
Self {