Source Files

The code that describes the application’s behavior is stored in the src directory. This typically contains files that are generated by an IDE (such as GNOME Builder) when the project is created and those that the developer creates. Since this example is written in Python, these files are all .py files except for the treasure.in file, which is a template for the script that will be installed as the application’s executable, and the config.py.in file, which is a template Python module. Both .in files will be processed by the build system to create valid Python scripts.

Name

Purpose

__init__.py

The package file for the application’s code.

config.py.in

A template Python module containing information
about the installation that the application can
query at run-time.

main.py

The main program.

meson.build

The build file for the src directory.

treasure.gresource.xml

A resource description file describing the files
that will be included in a binary resource bundle.

treasure.in

A template for the main executable file.

The treasure.gresource.xml file contains references to files that will be compiled into a resource bundle. Using a bundle is a convenient way to include fairly small resources that the application depends on, and is most often used to include user interface (UI) files for menus and windows.

The user interface files are included in the src/ui subdirectory. We will look at these in more detail in User Interface.