Sorry for asking a dumb question, but I’m just starting out…
I started with the code here to build an application with gtk-rs. I added a button to open another gtk window which I would like to set modal and transient for the base window. Setting it modal by putting <property name="modal">true</property> works fine, however for <property name="transient-for">id</property> I would need to set an id for the main window. Since the main window is defined as a template and not as an object, I cannot set an id (I think). What should I do?
I guess my problem is that I don’t really understand templates yet…
Dear Jamie, thanks for your reply! Unfortunately that does not work. When compiling, I get the following warning:
Gtk-CRITICAL **: 16:33:42.142: Error building template class 'NewMeasurementWindow' for an instance of type 'NewMeasurementWindow': .:0:0 Object with ID ThermometerWindow not found
(I set the template class to ThermometerWindow rather than MyGtkAppWindow).
Well, here is the thing:
You can, in theory, have multiple “root” windows, to which the window of your template could be set transient to. For example, your ThermometerWindow could also have multiple instances.
For this reason, the transient-for property requires a reference to an specific, instanced window. But this is not information you can realistically store in the template file.
For transient-for, you probably won’t get around setting it in your code instead.