How to Build tfe (Text File Editor)
How to Compile and Execute the Text Editor ‘tfe’.
First, the source files are in the Gtk4-tutorial repository. How to download them is written at the end of the previous section.
The following is the instruction for compilation and execution.
- You need meson and ninja.
- If you have installed gtk4 from source, you need to set environment variables to match your installation.
- Change your current directory to
src/tfe5directory. - Type
meson setup _buildfor configuration. - Type
ninja -C _buildfor compilation. Then the applicationtfeis built under the_builddirectory. - Type
_build/tfeto execute it.
Then the window appears. There are four buttons,
New, Open, Save and
Close.
- Click on
Openbutton, then a file chooser dialog appears. Choose a file from the list and click onOpenbutton. Then the file is read and a new Notebook Page appears. - Edit the file and click on
Savebutton, then the text is saved to the original file. - Click
Close, then the Notebook Page disappears. - Click
Closeagain, then theUntitledNotebook Page disappears and at the same time the application quits.
This is a very simple editor. It is a good practice for you to add more features.
Total Number of Lines, Words and Characters
The command below is the output of wc executed
in the src directory.
$ LANG=C wc tfe5/meson.build tfe5/tfeapplication.c tfe5/tfe.gresource.xml tfe5/tfenotebook.c tfe5/tfenotebook.h tfetextview/tfetextview.c tfetextview/tfetextview.h tfe5/tfe.ui
10 17 294 tfe5/meson.build
110 335 3602 tfe5/tfeapplication.c
6 9 153 tfe5/tfe.gresource.xml
144 391 3669 tfe5/tfenotebook.c
15 21 241 tfe5/tfenotebook.h
235 825 8516 tfetextview/tfetextview.c
32 54 624 tfetextview/tfetextview.h
61 100 2073 tfe5/tfe.ui
613 1752 19172 total
$