Hi! o/ First-time poster, long-time user, slowly ramping up to making things in GTK4.
I’m working on a very simple GTK4 terminal emulator in C. At the moment I’ve literally just taken the standard GNOME Builder C app template and replaced the content
label with a VteTerminal
. I don’t currently have any custom needs for the terminal widget itself, so I’ve experimented with binding directly to VteTerminal
in an app window template.
I initially tried to work out the right library Id for VTE to add to the <requires>
elements. Based on pkgconfig and gir values, I’ve tried several casing permutations of vte-2.91-gtk4
, vte-3.91
, vte
, and setting the version
string with either the suffix values above or the VTE build tag (e.g., 0.76.3
).
Running Builder, using any of the above values, and inserting a VteTerminal
directly into the app window template, I get a content-less window and the following error in the Builder terminal:
(thinko:2): Gtk-CRITICAL **: 21:59:41.976: Error building template class 'ThinkoWindow' for an instance of type 'ThinkoWindow': .:0:0 Invalid object type 'VteTerminal'
Fair enough. So it seems that VteTerminal
can’t be bound-to directly in a widget template like this.
If I subclass a new type from VteTerminal
with no custom properties or methods, as long as the new type is compiled in (i.e., not excluded from source files in the Meson config), I’m able to render an app window with a terminal widget, and the error message disappears. I don’t have to reference Vte at all in the terminal widget’s own template, I don’t have to reference the terminal widget header in the app window, and I can even still bind directly to VteTerminal
, not ThinkoTerminal
, in both the code and the window template. (Unsurprisingly, I do subsequently have to reference vte.h
in the window source for the build to succeed.)
If this were a serious project, in all likelihood I would subclass VteTerminal
just for the sake of future extensibility, but all of the above has got me curious as to the disconnect I’m seeing. Basically, my questions are
- What currently prevents
VteTerminal
from being directly accessible to widget templates? - Is there an expectation that this will be enabled in the future?
*Worth noting, this was available in GTK+3 (cf. Example of a Gtk application using a VTE terminal widget written in Python 3 · GitHub) - Where should I start if I specifically want to understand the mechanism that enables the template to bind to
ThinkoTerminal
without having to tellThinkoWindow
(the app window) about it? I would expect to have reference the specific type explicitly inThinkoWindow
for the template binding to succeed- Might be a simple case of me missing something very simple - I only play a C developer on TV - definitely make me RTFM, just need to know what’s the right FM is in this case
- Might be a simple case of me missing something very simple - I only play a C developer on TV - definitely make me RTFM, just need to know what’s the right FM is in this case
Again, mainly asking as a matter of curiosity, but any and all knowledge is valuable, and hence any and all insight is appreciated!