finally get toolbarview working ._.

This commit is contained in:
Bit Borealis 2023-08-24 16:07:25 +00:00
parent 0dd1df7e1d
commit cba402db0e
7 changed files with 119 additions and 51 deletions

48
Cargo.lock generated
View file

@ -4,9 +4,9 @@ version = 3
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.72" version = "1.0.75"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
[[package]] [[package]]
name = "app_units" name = "app_units"
@ -111,9 +111,9 @@ dependencies = [
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.82" version = "1.0.83"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01" checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
dependencies = [ dependencies = [
"libc", "libc",
] ]
@ -396,7 +396,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.28", "syn 2.0.29",
] ]
[[package]] [[package]]
@ -581,7 +581,7 @@ dependencies = [
"proc-macro-error", "proc-macro-error",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.28", "syn 2.0.29",
] ]
[[package]] [[package]]
@ -989,9 +989,9 @@ checksum = "8f1383dff4092fe903ac180e391a8d4121cc48f08ccf850614b0290c6673b69d"
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.32" version = "1.0.33"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
@ -1041,9 +1041,9 @@ checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.183" version = "1.0.186"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c" checksum = "9f5db24220c009de9bd45e69fb2938f4b6d2df856aa9304ce377b3180f83b7c1"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
@ -1059,13 +1059,13 @@ dependencies = [
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.183" version = "1.0.186"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816" checksum = "5ad697f7e0b65af4983a4ce8f56ed5b357e8d3c36651bf6a7e13639c17b8e670"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.28", "syn 2.0.29",
] ]
[[package]] [[package]]
@ -1101,9 +1101,9 @@ dependencies = [
[[package]] [[package]]
name = "slab" name = "slab"
version = "0.4.8" version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
dependencies = [ dependencies = [
"autocfg", "autocfg",
] ]
@ -1142,9 +1142,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.28" version = "2.0.29"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1184,22 +1184,22 @@ checksum = "9d0e916b1148c8e263850e1ebcbd046f333e0683c724876bb0da63ea4373dc8a"
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.44" version = "1.0.47"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f"
dependencies = [ dependencies = [
"thiserror-impl", "thiserror-impl",
] ]
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "1.0.44" version = "1.0.47"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.28", "syn 2.0.29",
] ]
[[package]] [[package]]
@ -1380,9 +1380,9 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]] [[package]]
name = "winnow" name = "winnow"
version = "0.5.10" version = "0.5.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5504cc7644f4b593cbc05c4a55bf9bd4e94b867c3c0bd440934174d50482427d" checksum = "d09770118a7eb1ccaf4a594a221334119a44a814fcb0d31c5b85e83e97227a97"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]

View file

@ -6,6 +6,14 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
gtk4 = "0.7.2"
libadwaita = "0.5.2"
webrender = "0.61.0" webrender = "0.61.0"
[dependencies.gtk]
package = "gtk4"
version = "0.7.2"
features = [ "v4_12"]
[dependencies.adw]
package = "libadwaita"
version = "0.5.2"
features = [ "v1_4" ]

View file

@ -1,5 +1,15 @@
{ lib, fetchFromGitHub, rustPlatform, cmake, pkg-config, gtk4, gdk-pixbuf, cairo, libadwaita, pango }: {# lib
#, fetchFromGitHub
#,
rustPlatform
, cmake
, pkg-config
, gtk4
, gdk-pixbuf
, cairo
, pango
, libadwaita
}:
rustPlatform.buildRustPackage rec { rustPlatform.buildRustPackage rec {
pname = "xenon-browser"; pname = "xenon-browser";
version = "0.1.0"; version = "0.1.0";

View file

@ -1,23 +1,58 @@
{ {
"nodes": { "nodes": {
"nixpkgs": { "flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": { "locked": {
"lastModified": 1692128808, "lastModified": 1689068808,
"narHash": "sha256-Di1Zm/P042NuwThMiZNrtmaAjd4Tm2qBOKHX7xUOfMk=", "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
"owner": "NixOS", "owner": "numtide",
"repo": "nixpkgs", "repo": "flake-utils",
"rev": "4ed9856be002a730234a1a1ed9dcd9dd10cbdb40", "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "owner": "numtide",
"type": "indirect" "repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1692614049,
"narHash": "sha256-RF+eM5oQGZ58rvdBV4NoF/J3S1z11g52WPWcLsYJVVY=",
"owner": "theotheroracle",
"repo": "nixpkgs",
"rev": "908fc0c68613ee426a81427693a9b26aaba9b224",
"type": "github"
},
"original": {
"owner": "theotheroracle",
"repo": "nixpkgs",
"type": "github"
} }
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -1,9 +1,20 @@
{ {
description = "xenon-browser"; description = "xenon-browser";
outputs = { self, nixpkgs }: inputs = {
let pkgs = nixpkgs.legacyPackages.x86_64-linux; in flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:theotheroracle/nixpkgs";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{ {
packages.x86_64-linux.default = pkgs.callPackage ./default.nix {}; devShells.default = import ./shell.nix { inherit pkgs; };
}; packages.default = pkgs.callPackage ./default.nix { };
} }
);
}

View file

@ -1,4 +1,5 @@
with import <nixpkgs> {}; { pkgs ? import <nixpkgs> {} }:
with pkgs;
mkShell { mkShell {
buildInputs = [ buildInputs = [
# rust deps # rust deps
@ -20,6 +21,7 @@ mkShell {
# editor deps # editor deps
lapce lapce
vscodium
rust-analyzer rust-analyzer
nil nil
]; ];

View file

@ -1,10 +1,11 @@
use libadwaita::prelude::*; use adw::prelude::*;
use libadwaita::{ActionRow, Application, ApplicationWindow, HeaderBar};
use gtk4::{Box, ListBox, Orientation, SelectionMode}; use adw::{ToolbarView, ActionRow, Application, ApplicationWindow, HeaderBar};
use gtk::{Box, ListBox, Orientation, SelectionMode};
fn main() { fn main() {
let application = Application::builder() let application = Application::builder()
.application_id("os.saturn.halogen") .application_id("com.example.FirstAdwaitaApp")
.build(); .build();
application.connect_activate(|app| { application.connect_activate(|app| {
@ -29,14 +30,14 @@ fn main() {
list.append(&row); list.append(&row);
// Combine the content in a box // Combine the content in a box
let content = Box::new(Orientation::Vertical, 0); let content = ToolbarView ::new();
// Adwaitas' ApplicationWindow does not include a HeaderBar // Adwaitas' ApplicationWindow does not include a HeaderBar
content.append(&HeaderBar::new()); content.add_top_bar(&HeaderBar::new());
content.append(&list); content.set_content(Some(&list));
let window = ApplicationWindow::builder() let window = ApplicationWindow::builder()
.application(app) .application(app)
.title("First App") .title("xenon")
.default_width(350) .default_width(350)
// add content to window // add content to window
.content(&content) .content(&content)
@ -46,3 +47,4 @@ fn main() {
application.run(); application.run();
} }