See the " Application icons" section in Themed Icons
The icon theme specification defines a universal fallback theme, called hicolor, in which applications can install icons that need to be known by the rest of the system.
The main example for this is the application icon that is used in the applications desktop file. This icon should be named to match the application name, and be installed in /usr/share/icons/hicolor/48x48/apps/. Other sizes are optional, but a 256×256 icon is the default size used by GNOME in its application grid, so you’re strongly encouraged to provide one.
Applications are also encouraged to install a symbolic version of the application icon into the hicolor theme, with the same name and a -symbolic suffix. The symbolic icon will be used in the HighContrast theme. Symbolic icons can be installed as SVG, in the /usr/share/icons/hicolor/symbolic/apps directory (which was added to hicolor in 0.15), or as .symbolic.png files in /usr/share/icons/hicolor/48x48/apps/. Other sizes are optional.
After installing your app icons (and .desktop file) with the correct application ID (the one you set when constructing Gtk.Application), the icon will be picked up by the desktop environment.
Some desktop environments still look for icons set on windows. So you probably need to use Gtk.Window.set_icon_name as well. Don’t use Gtk.Window.set_icon, though, which seems to have been removed in GTK 4.