Skip to content

Commit

Permalink
Add more information to the readme
Browse files Browse the repository at this point in the history
  • Loading branch information
DitherWither committed Mar 21, 2023
1 parent c4f2a3f commit b65e5ec
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 17 deletions.
20 changes: 3 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,18 @@
This template is a starting point for making GTK applications using gircore,
and [blueprint](https://jwestman.pages.gitlab.gnome.org/blueprint-compiler/index.html).

# Installing
## Installing

- Install the latest version of the [dotnet sdk](https://dotnet.microsoft.com/en-us/download)
- Install the [blueprint compiler](https://jwestman.pages.gitlab.gnome.org/blueprint-compiler/index.html).
- Install this template using `dotnet new install <path to this repo>/template/`

# Building flatpak

- Install dotnet-warp by running `dotnet tool install -g dotnet-warp`
- Make the build script executable by running `chmod +x build_flatpak.sh`
- Run the build script by running `./build_flatpak.sh`
- The flatpak will be added to the `repo` repository. It should also get installed on your system
## Steps for using

# Steps for using
Create a new project using `dotnet new gircore-blueprint --app-id com.example.MyApp --display-name "My app"`, replacing `com.example.MyApp` with an app id follows the reverse domain name format. See [the documentation for app id on gnome docs](https://developer.gnome.org/documentation/tutorials/application-id.html). Also replace `My app` with the name of your application.

- Create a new project using `dotnet new gircore-blueprint --app-id <app id>`, where app id follows the reverse domain name format. See [the documentation for app id on gnome docs](https://developer.gnome.org/documentation/tutorials/application-id.html)
- (Optional) Change the name of the application inside the .desktop file to something more user-friendly.
- (Optional) Add icons and appdata files to the project.

# Building/Running

Just run `dotnet run` in the project directory. The blueprints will be compiled and the application will be run.

# Notes when creating blueprints

- Make sure that the blueprints are stored in the `blueprints` directory, and end with `.blp`.

# TODO for this template

Expand Down
41 changes: 41 additions & 0 deletions template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# **DISPLAY_NAME**

This readme was generated automatically by the template generator.

## Build

To run this project, run the following commands:

```bash
dotnet run
```

To generate a flatpak, run the following commands:

```bash
chmod +x build_flatpak.sh
./build_flatpak.sh
```

The flatpak will be stored in a local repository inside `flatpak_build/repo`.

## Project Structure

The file structure of this project is as follows:

- `blueprints/`: Contains the blueprints for the project. Is scanned by the build system for blueprints.
- `MainWindow.blp`: The blueprint for the main window. This is used inside the `MainWindow.cs` file.
- `ui/`: Contains the UI files for the project. Put any classes that show UI here.
- `MainWindow.cs`: The main window for the application. This is shown when the application starts.
- `data/`: Contains the data files for the project. These files are copied to the flatpak build directory. Put any files used in the flatpak manifest here.
- `__APP_ID__.desktop`: The desktop file for the flatpak. This is used to define the application id, name, icon, etc. and is used to create the application menu entry.
- `__APP_ID__.yml`: The flatpak manifest. This is used to define the flatpak build. You should set permissions, dependencies, etc. here.
- `run.sh`: The script that runs the application. This is used to set the environment variables for the application.
- `Program.cs`: The entry point for the project. This is where the application starts.
- `Constants.cs`: Contains the constants for the project. This is where things like the application id are defined.
- `build_flatpak.sh`: The script that builds the flatpak. Run this to build the flatpak.
- `build/`: Contains the compiled bluprints. All ui files here are added as a embedded resource to the project.

## Note when creating blueprints

Make sure that the blueprints are stored in the `blueprints` directory, and end with `.blp`. Files that do not end with `.blp` are ignored by the build system. For example, `MainWindow.blp` is a valid blueprint, but `MainWindow.foo` is not.
14 changes: 14 additions & 0 deletions template/build_flatpak.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
#!/bin/sh

if ! command -v flatpak-builder &> /dev/null
then
echo "flatpak-builder could not be found"
exit
fi

if ! command -v dotnet-warp &> /dev/null
then
echo "dotnet-warp could not be found"
echo "Please install it with 'dotnet tool install -g dotnet-warp'"
echo "and make sure it is in your \$PATH"
exit
fi

# Create a new build directory
rm -r flatpak_build/ # Remove the old build directory
mkdir -p flatpak_build/
Expand Down

0 comments on commit b65e5ec

Please sign in to comment.