In gtk3 I could just instantiate a window, and Gtk::Application and call application->run.
While in Gtk4 I’m required to inherit from window and pass the new class as a template argument to the run function as in the tutorial there Hello World in gtkmm
But it doesn’t make any sense for me to do it this way, plus that the examples I see in other languages don’t require this, so why does the c++ binding require this way. In other words, how can I do it the old way.
Another question: I’ve read on reddit that that gtkmm is going to be abandoned soon, is that true? I’ve seen gnome-terminal being replaced by console and the gnome-terminal is written in c++, so I’ve started getting worried.
This was a gtkmm only API, which incidentally conflicted with the underlying GtkApplication API.
Every language has to do this, since GtkApplication is the main entry point for all GTK applications.
You can use gtk_init() and then spin the default GMainContext yourself, but it’s pointless to do so.
The current maintainer of the gtkmm bindings has said that he does not have enough time to devote to the project, yes.
The language used by libvte and gnome-terminal, and the replacement in the core GNOME apps, has nothing to do with the maintenance situation of gtkmm. Console still uses libvte internally, which is implemented using C++ even if it exposes a C API.
GtkApplication will notify you of when the application should present its window, because it supports single instantiation across multiple launches, and remote activation via IPC.
Building your UI inside main is not really how things work any more.
The only purpose for this is to write small test cases; anything more complicated than that is out of scope, and you are strongly encouraged to use GtkApplication. You don’t even need to subclass it: you can instantiate it and connect to the activate signal.
The C++ bindings do not use gobject-introspection: they have their own mechanism to describe the C API and generate code. You’ll need to look at the gtkmm repository and ask on the gtkmm mailing list.
I’ve read on reddit that gtkmm is going to be abandoned soon, is that true?
I announced more than a year ago that I will spend less time with gtkmm in the future.
See Ten years with gtkmm, glibmm and other mm modules.
It’s not so much because of lack of time. But I never had the intention to become
the main maintainer of gtkmm and a bunch of other C++ modules.
The developers of Inkscape have expressed their concern. No one has offered to replace me.
you can instantiate it (Gtk::Application) and connect to the activate signal.
That’s what application->make_window_and_run() does. It creates a window in a
signal_activate() handler.
Most example programs also in gtkmm3 subclass Gtk::Window or Gtk::ApplicationWindow
and create the other widgets in its constructor. See e.g. the Hello World program at Hello World in gtkmm.
The difference between gtkmm3 and gtkmm4 is that the HelloWorld window is created in
the main() function in gtkmm3.