diff --git a/gfm/sec14.md b/gfm/sec14.md index 2d1f2c2..e64f5e7 100644 --- a/gfm/sec14.md +++ b/gfm/sec14.md @@ -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) diff --git a/gfm/sec15.md b/gfm/sec15.md index 7203915..7253055 100644 --- a/gfm/sec15.md +++ b/gfm/sec15.md @@ -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 diff --git a/gfm/sec2.md b/gfm/sec2.md index 9b9eea5..018b9ad 100644 --- a/gfm/sec2.md +++ b/gfm/sec2.md @@ -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. diff --git a/src/sec14.src.md b/src/sec14.src.md index 3f11cdb..e3a9cf1 100644 --- a/src/sec14.src.md +++ b/src/sec14.src.md @@ -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. diff --git a/src/sec15.src.md b/src/sec15.src.md index 2e6cb34..8c59e94 100644 --- a/src/sec15.src.md +++ b/src/sec15.src.md @@ -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 diff --git a/src/sec2.src.md b/src/sec2.src.md index 3285bd9..bbe295e 100644 --- a/src/sec2.src.md +++ b/src/sec2.src.md @@ -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.