Compare commits

..

No commits in common. "562d4871a179cdcf4291356437776627753cf80a" and "cc828c417af2d93fae9335bf81b81b45c4a3fcf1" have entirely different histories.

5 changed files with 13 additions and 33 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,6 @@
use adw::prelude::*; use adw::prelude::*;
use gio::resources_lookup_data;
use glib::IsA; use glib::IsA;
use gtk::{prelude::*, STYLE_PROVIDER_PRIORITY_USER}; use gtk::prelude::*;
mod chat; mod chat;
pub use chat::Chat; pub use chat::Chat;
@ -15,6 +14,9 @@ pub use game_preview::GamePreview;
mod library; mod library;
pub use library::Library; pub use library::Library;
mod layout;
pub use layout::Layout;
mod player_card; mod player_card;
pub use player_card::PlayerCard; pub use player_card::PlayerCard;
@ -38,27 +40,6 @@ pub struct AppWindow {
impl AppWindow { impl AppWindow {
pub fn new(app: &adw::Application) -> Self { 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() let header = adw::HeaderBar::builder()
.title_widget(&gtk::Label::new(Some("Kifu"))) .title_widget(&gtk::Label::new(Some("Kifu")))
.build(); .build();
@ -74,7 +55,7 @@ impl AppWindow {
header.pack_end(&hamburger); header.pack_end(&hamburger);
let content = adw::Bin::builder().css_classes(vec!["content"]).build(); let content = adw::Bin::new();
content.set_child(Some( content.set_child(Some(
&adw::StatusPage::builder().title("Nothing here").build(), &adw::StatusPage::builder().title("Nothing here").build(),
)); ));
@ -85,6 +66,12 @@ impl AppWindow {
layout.append(&header); layout.append(&header);
layout.append(&content); layout.append(&content);
let window = adw::ApplicationWindow::builder()
.application(app)
.width_request(800)
.height_request(500)
.build();
window.set_content(Some(&layout)); window.set_content(Some(&layout));
Self { Self {