-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c3de222
Showing
34 changed files
with
1,335 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
root = true | ||
[*] | ||
indent_style = space | ||
end_of_line = lf | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
charset = utf-8 | ||
|
||
[*.{build,css,doap,scss,ui,xml,xml.in,xml.in.in,yaml,yml}] | ||
indent_size = 2 | ||
|
||
[*.{json,py,rs}] | ||
indent_size = 4 | ||
|
||
[*.{c,h,h.in}] | ||
indent_size = 2 | ||
max_line_length = 80 | ||
|
||
[NEWS] | ||
indent_size = 2 | ||
max_line_length = 72 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
|
||
name: CI | ||
|
||
jobs: | ||
rustfmt: | ||
name: Rustfmt | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
components: rustfmt | ||
- name: Create blank versions of configured file | ||
run: echo -e "" >> src/config.rs | ||
- name: Run cargo fmt | ||
run: cargo fmt --all -- --check | ||
|
||
flatpak: | ||
name: Flatpak | ||
runs-on: ubuntu-latest | ||
container: | ||
image: bilelmoussaoui/flatpak-github-actions:gnome-nightly | ||
options: --privileged | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v6 | ||
with: | ||
bundle: notify.flatpak | ||
manifest-path: build-aux/com.ranfdev.Notify.Devel.json | ||
repository-name: "flathub-beta" | ||
run-tests: true | ||
cache-key: flatpak-builder-${{ github.sha }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/target/ | ||
/build/ | ||
/_build/ | ||
/builddir/ | ||
/build-aux/app | ||
/build-aux/.flatpak-builder/ | ||
/src/config.rs | ||
*.ui.in~ | ||
*.ui~ | ||
/.flatpak/ | ||
/vendor | ||
/.vscode | ||
/subprojects/blueprint-compiler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
stages: | ||
- check | ||
- test | ||
|
||
flatpak: | ||
image: 'quay.io/gnome_infrastructure/gnome-runtime-images:gnome-43' | ||
stage: test | ||
tags: | ||
- flatpak | ||
variables: | ||
BUNDLE: "notify-nightly.flatpak" | ||
MANIFEST_PATH: "build-aux/com.ranfdev.Notify.Devel.json" | ||
FLATPAK_MODULE: "notify" | ||
APP_ID: "com.ranfdev.Notify.Devel" | ||
RUNTIME_REPO: "https://nightly.gnome.org/gnome-nightly.flatpakrepo" | ||
script: | ||
- flatpak install --user --noninteractive org.freedesktop.Sdk.Extension.llvm14//21.08 | ||
- > | ||
xvfb-run -a -s "-screen 0 1024x768x24" | ||
flatpak-builder --keep-build-dirs --user --disable-rofiles-fuse flatpak_app --repo=repo ${BRANCH:+--default-branch=$BRANCH} ${MANIFEST_PATH} | ||
- flatpak build-bundle repo ${BUNDLE} --runtime-repo=${RUNTIME_REPO} ${APP_ID} ${BRANCH} | ||
artifacts: | ||
name: 'Flatpak artifacts' | ||
expose_as: 'Get Flatpak bundle here' | ||
when: 'always' | ||
paths: | ||
- "${BUNDLE}" | ||
- '.flatpak-builder/build/${FLATPAK_MODULE}/_flatpak_build/meson-logs/meson-log.txt' | ||
- '.flatpak-builder/build/${FLATPAK_MODULE}/_flatpak_build/meson-logs/testlog.txt' | ||
expire_in: 14 days | ||
|
||
# Configure and run rustfmt | ||
# Exits and builds fails if on bad format | ||
rustfmt: | ||
image: "rust:slim" | ||
script: | ||
- rustup component add rustfmt | ||
# Create blank versions of our configured files | ||
# so rustfmt does not yell about non-existent files or completely empty files | ||
- echo -e "" >> src/config.rs | ||
- rustc -Vv && cargo -Vv | ||
- cargo fmt --version | ||
- cargo fmt --all -- --color=always --check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[package] | ||
name = "notify" | ||
version = "0.1.0" | ||
authors = ["ranfdev <[email protected]>"] | ||
edition = "2021" | ||
|
||
[profile.release] | ||
lto = true | ||
|
||
[dependencies] | ||
gettext-rs = { version = "0.7", features = ["gettext-system"] } | ||
gtk = { version = "0.6", package = "gtk4", features = ["v4_8"] } | ||
once_cell = "1.14" | ||
tracing = "0.1.37" | ||
tracing-subscriber = "0.3" | ||
adw = { version = "0.4", package = "libadwaita", features = ["v1_4"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# GTK + Libadwaita + Blueprint + Rust + Meson + Flatpak = <3 | ||
|
||
A boilerplate template to get started with GTK, Libadwaita, Blueprint, Rust, Meson, Flatpak made for GNOME. | ||
|
||
 | ||
|
||
## What does it contains? | ||
|
||
- A simple window with a headerbar | ||
- Bunch of useful files that you SHOULD ship with your application on Linux: | ||
- Metainfo: describe your application for the different application stores out there; | ||
- Desktop: the application launcher; | ||
- Icons: This repo contains three icons, a normal, a nightly & monochromatic icon (symbolic) per the GNOME HIG, exported using [App Icon Preview](https://flathub.org/apps/details/org.gnome.design.AppIconPreview). | ||
- Flatpak Manifest for nightly builds | ||
- Dual installation support | ||
- Uses Meson for building the application | ||
- Bundles the UI files & the CSS using gresources | ||
- A pre-commit hook to run rustfmt on your code | ||
- Tests to validate your Metainfo, Schemas & Desktop files | ||
- Gsettings to store the window state, more settings could be added | ||
- Gitlab CI to produce flatpak nightlies | ||
- i18n support | ||
|
||
## How to init a project ? | ||
|
||
The template ships a simple python script to init a project easily. It asks you a few questions and replaces & renames all the necessary files. | ||
|
||
The script requires having `git` installed on your system. | ||
|
||
You can run it with, | ||
|
||
```shell | ||
python3 create-project.py | ||
``` | ||
|
||
```shell | ||
➜ python3 create-project.py | ||
Welcome to GTK Rust Template | ||
Name: Contrast | ||
Project Name: contrast | ||
Application ID (e.g. org.domain.MyAwesomeApp, see: https://developer.gnome.org/ChooseApplicationID/): org.gnome.design.Contrast | ||
Author: Bilal Elmoussaoui | ||
Email: [email protected] | ||
``` | ||
|
||
A new directory named `contrast` containing the generated project | ||
|
||
## Building the project | ||
|
||
Make sure you have `flatpak` and `flatpak-builder` installed. Then run the commands below. Replace `<application_id>` with the value you entered during project creation. Please note that these commands are just for demonstration purposes. Normally this would be handled by your IDE, such as GNOME Builder or VS Code with the Flatpak extension. | ||
|
||
``` | ||
flatpak install --user org.gnome.Sdk//master org.freedesktop.Sdk.Extension.rust-stable org.gnome.Platform//master org.freedesktop.Sdk.Extension.llvm16 | ||
flatpak-builder --user flatpak_app build-aux/<application_id>.Devel.json | ||
``` | ||
|
||
## Running the project | ||
|
||
Once the project is build, run the command below. Replace Replace `<application_id>` and `<project_name>` with the values you entered during project creation. Please note that these commands are just for demonstration purposes. Normally this would be handled by your IDE, such as GNOME Builder or VS Code with the Flatpak extension. | ||
|
||
``` | ||
flatpak-builder --run flatpak_app build-aux/<application_id>.Devel.json <project_name> | ||
``` | ||
|
||
## Community | ||
|
||
Join the GNOME and gtk-rs community! | ||
- [Matrix chat](https://matrix.to/#/#rust:gnome.org): chat with other developers using gtk-rs | ||
- [Discourse forum](https://discourse.gnome.org/tag/rust): topics tagged with `rust` on the GNOME forum. | ||
- [GNOME circle](https://circle.gnome.org/): take inspiration from applications and libraries already extending the GNOME ecosystem. | ||
|
||
## Credits | ||
|
||
- [Podcasts](https://gitlab.gnome.org/World/podcasts) | ||
- [Shortwave](https://gitlab.gnome.org/World/Shortwave) | ||
- [gtk-rust-template without libadwaita and blueprint](https://gitlab.gnome.org/World/Rust/gtk-rust-template) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
"id": "com.ranfdev.Notify.Devel", | ||
"runtime": "org.gnome.Platform", | ||
"runtime-version": "master", | ||
"sdk": "org.gnome.Sdk", | ||
"sdk-extensions": [ | ||
"org.freedesktop.Sdk.Extension.rust-stable", | ||
"org.freedesktop.Sdk.Extension.llvm16" | ||
], | ||
"command": "notify", | ||
"finish-args": [ | ||
"--share=ipc", | ||
"--socket=fallback-x11", | ||
"--socket=wayland", | ||
"--device=dri", | ||
"--env=RUST_LOG=notify=debug", | ||
"--env=G_MESSAGES_DEBUG=none", | ||
"--env=RUST_BACKTRACE=1" | ||
], | ||
"build-options": { | ||
"append-path": "/usr/lib/sdk/rust-stable/bin:/usr/lib/sdk/llvm16/bin", | ||
"build-args": [ | ||
"--share=network" | ||
], | ||
"env": { | ||
"CARGO_REGISTRIES_CRATES_IO_PROTOCOL": "sparse", | ||
"CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER": "clang", | ||
"CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS": "-C link-arg=-fuse-ld=/usr/lib/sdk/rust-stable/bin/mold", | ||
"CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER": "clang", | ||
"CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUSTFLAGS": "-C link-arg=-fuse-ld=/usr/lib/sdk/rust-stable/bin/mold" | ||
}, | ||
"test-args": [ | ||
"--socket=x11", | ||
"--share=network" | ||
] | ||
}, | ||
"modules": [ | ||
{ | ||
"name": "notify", | ||
"buildsystem": "meson", | ||
"run-tests": true, | ||
"config-opts": [ | ||
"-Dprofile=development" | ||
], | ||
"sources": [ | ||
{ | ||
"type": "dir", | ||
"path": "../" | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
export DIST="$1" | ||
export SOURCE_ROOT="$2" | ||
|
||
cd "$SOURCE_ROOT" | ||
mkdir "$DIST"/.cargo | ||
cargo vendor | sed 's/^directory = ".*"/directory = "vendor"/g' > $DIST/.cargo/config | ||
# Move vendor into dist tarball directory | ||
mv vendor "$DIST" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Desktop Entry] | ||
Name=Notify | ||
Comment=Write a GTK + Rust application | ||
Type=Application | ||
Exec=notify | ||
Terminal=false | ||
Categories=GNOME;GTK; | ||
# Translators: Search terms to find this application. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon! | ||
Keywords=Gnome;GTK; | ||
# Translators: Do NOT translate or transliterate this text (this is an icon file name)! | ||
Icon=@icon@ | ||
StartupNotify=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<schemalist> | ||
<schema path="/com/ranfdev/Notify/" id="@app-id@" gettext-domain="@gettext-package@"> | ||
<key name="window-width" type="i"> | ||
<default>600</default> | ||
<summary>Window width</summary> | ||
</key> | ||
<key name="window-height" type="i"> | ||
<default>400</default> | ||
<summary>Window height</summary> | ||
</key> | ||
<key name="is-maximized" type="b"> | ||
<default>false</default> | ||
<summary>Window maximized state</summary> | ||
</key> | ||
</schema> | ||
</schemalist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- ranfdev 2019 <[email protected]> --> | ||
<component type="desktop-application"> | ||
<id>@app-id@</id> | ||
<metadata_license>CC0</metadata_license> | ||
<!-- Insert your license of choice here --> | ||
<!-- <project_license>MIT</project_license> --> | ||
<name>Notify</name> | ||
<summary>Write a GTK + Rust application</summary> | ||
<description> | ||
<p>A boilerplate template for GTK + Rust. It uses Meson as a build system and has flatpak support by default.</p> | ||
</description> | ||
<screenshots> | ||
<screenshot type="default"> | ||
<image>https://gitlab.gnome.org/bilelmoussaoui/notify/raw/master/data/resources/screenshots/screenshot1.png</image> | ||
<caption>Main window</caption> | ||
</screenshot> | ||
</screenshots> | ||
<url type="homepage">https://gitlab.gnome.org/bilelmoussaoui/notify</url> | ||
<url type="bugtracker">https://gitlab.gnome.org/bilelmoussaoui/notify/issues</url> | ||
<content_rating type="oars-1.0" /> | ||
<releases> | ||
<release version="0.1.0" date="2019-07-11" /> | ||
</releases> | ||
<kudos> | ||
<!-- | ||
GNOME Software kudos: | ||
https://gitlab.gnome.org/GNOME/gnome-software/-/blob/main/doc/kudos.md | ||
--> | ||
<kudo>ModernToolkit</kudo> | ||
<kudo>HiDpiIcon</kudo> | ||
</kudos> | ||
<developer_name>ranfdev</developer_name> | ||
<update_contact>[email protected]</update_contact> | ||
<translation type="gettext">@gettext-package@</translation> | ||
<launchable type="desktop-id">@[email protected]</launchable> | ||
</component> |
Oops, something went wrong.