Add compilation instruction for tfe.

This commit is contained in:
Toshio Sekiya 2021-01-16 20:20:11 +09:00
parent 9267b68030
commit 4a94ab4b83
6 changed files with 94 additions and 4 deletions

View file

@ -226,7 +226,7 @@ Isn't it a contradiction?
When first instance is launched, then it register itself with its application ID (for example, `com.github.ToshioCP.tfe`).
Just after the registration, startup signal is emitted, then activate or open signal is emitted and the instance's main loop runs.
I wrote "startup signal is emitted just after the application is generated" in the prior subsection.
More precisely, it is emitted just after registration.
More precisely, it is emitted just after the registration.
If another instance which has the same application ID is invoked after that, it also tries to register itself.
Because this is the second instance, the registration of the ID has already done, so it fails.
@ -302,5 +302,21 @@ First, get the top level window and call `gtk_window_destroy`.
In this file, just the source file names are modified.
## source files
The [source files](https://github.com/ToshioCP/Gtk4-tutorial/tree/main/src/tfe5) of the text editor `tfe` will be shown in the next section.
You can download the files.
There are two options.
- Use git and clone.
- Run your browser and open the [top page](https://github.com/ToshioCP/Gtk4-tutorial). Then click on "Code" button and click "Download ZIP" in the popup menu.
After that, unzip the archive file.
If you use git, run the terminal and type the following.
git clone https://github.com/ToshioCP/Gtk4-tutorial.git
The source files are under `/src/tfe5` directory.
Up: [Readme.md](../Readme.md), Prev: [Section 13](sec13.md), Next: [Section 15](sec15.md)

View file

@ -2,7 +2,34 @@ Up: [Readme.md](../Readme.md), Prev: [Section 14](sec14.md), Next: [Section 16]
# tfe5 source files
The followings are the source files of tfe5.
## How to compile and execute tfe text editor.
First, source files are shown in the later subsections.
How to download them is written at the end of the [previous section](../src/sec14.src.md).
The following is the instruction of compilation and execution.
- You need meson and ninja.
- Set necessary environment variables.
If you have installed gtk4 under the instruction in [Section 2](sec2.md), type `. env.sh` to set the environment variables.
- change your current directory to `src/tfe5` directory.
- type `meson _build` for configuration.
- type `ninja -C _build` for compilation.
Then the application `tfe` is build under the `_build` directory.
- type `_build/tfe` to execute it.
Then the window appears.
There are four buttons, `New`, `Open`, `Save` and `Close`.
- Click on `Open` button, then a FileChooserDialog appears.
Choose a file in the list and click on `Open` button.
Then the file is read and a new Notebook Page appears.
- Edit the file and click on `Save` button, then the text is saved to the original file.
- Click `Close`, then the Notebook Page disappears.
- Click `Close` again, then the `Untitle` Notebook Page disappears and at the same time the appication quits.
This is a very simple editor.
It is a good practice for you to add more features.
## meson.buld

View file

@ -133,6 +133,8 @@ Compile and install it.
$ ninja -C _build
$ ninja -C _build install
If you want to know more information, refer to [Gtk4 reference manual](https://gnome.pages.gitlab.gnome.org/gtk/gtk/gtk-building.html).
## Modify env.sh
Because environment variables disappear when you log out, you need to add them again.

View file

@ -147,7 +147,7 @@ Isn't it a contradiction?
When first instance is launched, then it register itself with its application ID (for example, `com.github.ToshioCP.tfe`).
Just after the registration, startup signal is emitted, then activate or open signal is emitted and the instance's main loop runs.
I wrote "startup signal is emitted just after the application is generated" in the prior subsection.
More precisely, it is emitted just after registration.
More precisely, it is emitted just after the registration.
If another instance which has the same application ID is invoked after that, it also tries to register itself.
Because this is the second instance, the registration of the ID has already done, so it fails.
@ -185,3 +185,19 @@ First, get the top level window and call `gtk_window_destroy`.
In this file, just the source file names are modified.
## source files
The [source files](https://github.com/ToshioCP/Gtk4-tutorial/tree/main/src/tfe5) of the text editor `tfe` will be shown in the next section.
You can download the files.
There are two options.
- Use git and clone.
- Run your browser and open the [top page](https://github.com/ToshioCP/Gtk4-tutorial). Then click on "Code" button and click "Download ZIP" in the popup menu.
After that, unzip the archive file.
If you use git, run the terminal and type the following.
git clone https://github.com/ToshioCP/Gtk4-tutorial.git
The source files are under `/src/tfe5` directory.

View file

@ -1,6 +1,33 @@
# tfe5 source files
The followings are the source files of tfe5.
## How to compile and execute tfe text editor.
First, source files are shown in the later subsections.
How to download them is written at the end of the [previous section](sec14.src.md).
The following is the instruction of compilation and execution.
- You need meson and ninja.
- Set necessary environment variables.
If you have installed gtk4 under the instruction in [Section 2](sec2.src.md), type `. env.sh` to set the environment variables.
- change your current directory to `src/tfe5` directory.
- type `meson _build` for configuration.
- type `ninja -C _build` for compilation.
Then the application `tfe` is build under the `_build` directory.
- type `_build/tfe` to execute it.
Then the window appears.
There are four buttons, `New`, `Open`, `Save` and `Close`.
- Click on `Open` button, then a FileChooserDialog appears.
Choose a file in the list and click on `Open` button.
Then the file is read and a new Notebook Page appears.
- Edit the file and click on `Save` button, then the text is saved to the original file.
- Click `Close`, then the Notebook Page disappears.
- Click `Close` again, then the `Untitle` Notebook Page disappears and at the same time the appication quits.
This is a very simple editor.
It is a good practice for you to add more features.
## meson.buld

View file

@ -131,6 +131,8 @@ Compile and install it.
$ ninja -C _build
$ ninja -C _build install
If you want to know more information, refer to [Gtk4 reference manual](https://gnome.pages.gitlab.gnome.org/gtk/gtk/gtk-building.html).
## Modify env.sh
Because environment variables disappear when you log out, you need to add them again.