app: use G_DECLARE_INTERFACE() to declare GimpAction interface.

Less boiler plate code so less reasons to mess up.
For this to be feasible, I also had to define a cleanup function for
GimpObject.
This commit is contained in:
Jehan 2023-05-08 15:01:43 +02:00
parent bb4438789a
commit f9993b85b6
3 changed files with 6 additions and 9 deletions

View file

@ -70,5 +70,6 @@ gint gimp_object_name_collate (GimpObject *object1,
gint64 gimp_object_get_memsize (GimpObject *object,
gint64 *gui_size);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GimpObject, g_object_unref);
#endif /* __GIMP_OBJECT_H__ */

View file

@ -21,12 +21,12 @@
#ifndef __GIMP_ACTION_H__
#define __GIMP_ACTION_H__
G_BEGIN_DECLS
#include "core/gimpobject.h"
#define GIMP_TYPE_ACTION (gimp_action_get_type ())
#define GIMP_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_ACTION, GimpAction))
#define GIMP_IS_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_ACTION))
#define GIMP_ACTION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE((obj), GIMP_TYPE_ACTION, GimpActionInterface))
G_DECLARE_INTERFACE (GimpAction, gimp_action, GIMP, ACTION, GimpObject)
enum
{
@ -48,8 +48,6 @@ enum
GIMP_ACTION_PROP_LAST = GIMP_ACTION_PROP_MAX_WIDTH_CHARS,
};
typedef struct _GimpActionInterface GimpActionInterface;
struct _GimpActionInterface
{
GTypeInterface base_interface;
@ -64,8 +62,6 @@ struct _GimpActionInterface
};
GType gimp_action_get_type (void) G_GNUC_CONST;
void gimp_action_init (GimpAction *action);
void gimp_action_emit_activate (GimpAction *action,
@ -158,5 +154,6 @@ void gimp_action_set_default_accels (GimpAction *action,
void gimp_action_set_menu_path (GimpAction *action,
const gchar *menu_path);
G_END_DECLS
#endif /* __GIMP_ACTION_H__ */

View file

@ -30,7 +30,6 @@
#define GIMP_IS_ACTION_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), GIMP_TYPE_ACTION_IMPL))
#define GIMP_ACTION_IMPL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GIMP_TYPE_ACTION_IMPL, GimpActionImplClass))
typedef struct _GimpActionImpl GimpActionImpl;
typedef struct _GimpActionImplClass GimpActionImplClass;
typedef struct _GimpActionImplPrivate GimpActionImplPrivate;