Commit Graph

3 Commits

Author SHA1 Message Date
Jehan 9f62bd5822 app: remove useless gimp_core_app_finalize().
If we want to reuse this in subclasses, we'd need to overwrite finalize() in the
subclasses, call gimp_core_app_finalize() and chain up with the parent class.
Not doing this until now was leading us not to call GApplication or
GtkApplication finalize() function, which in turn, in the later case, was
leaking all the GAction-s which were added to the GActionMap. I realized this as
a leaking GimpContext-s warning was printing when ending GIMP.
2023-04-12 22:07:08 +02:00
Jehan fb1cb22f62 app: cleanup MR !734.
- app_activate_callback() moved with other private functions.
- Removing the `if (app)` test in app_activate_callback() as we don't
  set it to NULL anymore. The app variable is always set.
- As a consequence of the previous point, change signature of
  app_exit_after_callback() which doesn't have to change the value of
  app anymore.
- Don't emit direcly the "exit" signal from app_activate_callback(). We
  must call `gimp_exit (gimp, TRUE);` instead, which does more than just
  emitting this signal. It also takes care of cleaning any remaining
  images without a display. If we don't do this, we are leaking
  GeglBuffer when opening images from command lines while quitting
  immediately with --quit.
- Get rid of gimp_core_app_set_values() which was completely bypassing
  the fact that all the properties of a GimpCoreApp were construct-only.
  Instead make these proper properties. I use a trick used in other
  interface, creating a gimp_container_view_install_properties() which
  is called from child classes.
  The point of GimpCoreApp is not just to share a common interface, it's
  rather to weakly simulate some kind of multi-inheritance in GObject.
  Since we want both GimpApp and GimpConsoleApp to inherit from a same
  parent class while we also want them to inherit either from
  GtkApplication and GApplication respectively (yet without linking to
  GTK in this second case), we are stuck as far as normal GObject
  inheritance goes. This is why we use an interface to which we add a
  private struct through a GQuark trick. We want the property settings
  and function implementations to also be part of this shared code.
- Get rid of all the abstract methods of GimpCoreApp of the form
  get_*(). These are useless as we don't expect these to have different
  implementation depending on the actual child class. Once again, our
  main goal was to simulate multiple inheritance rather than actually
  have an interface with various implementations.
- Make "no-splash" a property of GimpApp, because it's cleaner this way.
- Fix gimp_core_app_private_finalize().
- don't use #pragma once, it's not standard. Just use include guards.
- Fix includes: order was wrong, include from the source, not other
  headers, etc.
- Clean various other details, coding styles, fix several more bugs and
  more…
2022-10-09 16:12:07 +02:00
Lukas Oberhuber 1ee1224d05 app: Add in gimpconsoleapp and gimpcoreapp interface
GimpApp is a GtkApplication
GimpCoreApp is an interface for common functions
GimpConsoleApp is a GApplication (to avoid linking in Gtk)
2022-10-09 16:12:07 +02:00