gimp/app/gimpcoreapp.h

85 lines
2.7 KiB
C
Raw Normal View History

/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* gimpcoreapp.h
* Copyright (C) 2022 Lukas Oberhuber <lukaso@gmail.com>
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <https://www.gnu.org/licenses/>.
*/
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-07 02:44:06 +08:00
#ifndef __GIMP_CORE_APP_H__
#define __GIMP_CORE_APP_H__
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-07 02:44:06 +08:00
G_BEGIN_DECLS
#define GIMP_APPLICATION_ID "org.gimp.GIMP"
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-07 02:44:06 +08:00
enum
{
GIMP_CORE_APP_PROP_0,
GIMP_CORE_APP_PROP_GIMP,
GIMP_CORE_APP_PROP_FILENAMES,
GIMP_CORE_APP_PROP_AS_NEW,
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-07 02:44:06 +08:00
GIMP_CORE_APP_PROP_QUIT,
GIMP_CORE_APP_PROP_BATCH_INTERPRETER,
GIMP_CORE_APP_PROP_BATCH_COMMANDS,
GIMP_CORE_APP_PROP_LAST = GIMP_CORE_APP_PROP_BATCH_COMMANDS,
};
#define GIMP_TYPE_CORE_APP gimp_core_app_get_type()
G_DECLARE_INTERFACE (GimpCoreApp, gimp_core_app, GIMP, CORE_APP, GObject)
struct _GimpCoreAppInterface
{
GTypeInterface parent_iface;
/* Padding to allow adding up to 12 new virtual functions without
* breaking ABI. */
gpointer padding[12];
};
Gimp * gimp_core_app_get_gimp (GimpCoreApp *self);
gboolean gimp_core_app_get_quit (GimpCoreApp *self);
gboolean gimp_core_app_get_as_new (GimpCoreApp *self);
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-07 02:44:06 +08:00
const gchar ** gimp_core_app_get_filenames (GimpCoreApp *self);
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-07 02:44:06 +08:00
const gchar * gimp_core_app_get_batch_interpreter (GimpCoreApp *self);
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-07 02:44:06 +08:00
const gchar ** gimp_core_app_get_batch_commands (GimpCoreApp *self);
void gimp_core_app_set_exit_status (GimpCoreApp *self,
gint exit_status);
gboolean gimp_core_app_get_exit_status (GimpCoreApp *self);
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-07 02:44:06 +08:00
/* Protected functions. */
void gimp_core_app_install_properties (GObjectClass *klass);
void gimp_core_app_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
void gimp_core_app_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
G_END_DECLS
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-07 02:44:06 +08:00
#endif /* __GIMP_CORE_APP_H__ */