1
1
mirror of https://gitlab.gnome.org/GNOME/gimp.git synced 2025-10-06 01:12:40 +02:00

app: G_DECLARE_DERIVABLE_TYPE() in GimpFilter, GimpItem, GimpViewable,

plus somewhat related cleanup in the .c files
This commit is contained in:
Michael Natterer
2025-07-12 19:07:30 +02:00
parent 9359839e84
commit d2ca61d5e2
5 changed files with 23 additions and 50 deletions

View File

@@ -57,7 +57,8 @@ struct _GimpFilterPrivate
GimpApplicator *applicator;
};
#define GET_PRIVATE(filter) ((GimpFilterPrivate *) gimp_filter_get_instance_private ((GimpFilter *) (filter)))
#define GET_PRIVATE(filter) \
((GimpFilterPrivate *) gimp_filter_get_instance_private ((GimpFilter *) (filter)))
/* local function prototypes */
@@ -223,12 +224,10 @@ gimp_filter_new (const gchar *name)
GeglNode *
gimp_filter_get_node (GimpFilter *filter)
{
GimpFilterPrivate *private;
GimpFilterPrivate *private = GET_PRIVATE (filter);
g_return_val_if_fail (GIMP_IS_FILTER (filter), NULL);
private = GET_PRIVATE (filter);
if (private->node)
return private->node;
@@ -297,12 +296,10 @@ void
gimp_filter_set_applicator (GimpFilter *filter,
GimpApplicator *applicator)
{
GimpFilterPrivate *private;
GimpFilterPrivate *private = GET_PRIVATE (filter);
g_return_if_fail (GIMP_IS_FILTER (filter));
private = GET_PRIVATE (filter);
private->applicator = applicator;
}

View File

@@ -24,21 +24,13 @@
#include "gimpviewable.h"
#define GIMP_TYPE_FILTER (gimp_filter_get_type ())
#define GIMP_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_FILTER, GimpFilter))
#define GIMP_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_FILTER, GimpFilterClass))
#define GIMP_IS_FILTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_FILTER))
#define GIMP_IS_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_FILTER))
#define GIMP_FILTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_FILTER, GimpFilterClass))
#define GIMP_TYPE_FILTER (gimp_filter_get_type ())
G_DECLARE_DERIVABLE_TYPE (GimpFilter,
gimp_filter,
GIMP, FILTER,
GimpViewable)
typedef struct _GimpFilterClass GimpFilterClass;
struct _GimpFilter
{
GimpViewable parent_instance;
};
struct _GimpFilterClass
{
GimpViewableClass parent_class;

View File

@@ -22,21 +22,13 @@
#include "gimpfilter.h"
#define GIMP_TYPE_ITEM (gimp_item_get_type ())
#define GIMP_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_ITEM, GimpItem))
#define GIMP_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_ITEM, GimpItemClass))
#define GIMP_IS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_ITEM))
#define GIMP_IS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_ITEM))
#define GIMP_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_ITEM, GimpItemClass))
#define GIMP_TYPE_ITEM (gimp_item_get_type ())
G_DECLARE_DERIVABLE_TYPE (GimpItem,
gimp_item,
GIMP, ITEM,
GimpFilter)
typedef struct _GimpItemClass GimpItemClass;
struct _GimpItem
{
GimpFilter parent_instance;
};
struct _GimpItemClass
{
GimpFilterClass parent_class;

View File

@@ -48,8 +48,10 @@ enum
PROP_FROZEN,
N_PROPS
};
static GParamSpec *obj_props[N_PROPS] = { NULL, };
enum
{
INVALIDATE_PREVIEW,
@@ -80,7 +82,8 @@ struct _GimpViewablePrivate
GeglColor *preview_temp_buf_background;
};
#define GET_PRIVATE(viewable) ((GimpViewablePrivate *) gimp_viewable_get_instance_private ((GimpViewable *) (viewable)))
#define GET_PRIVATE(viewable) \
((GimpViewablePrivate *) gimp_viewable_get_instance_private ((GimpViewable *) (viewable)))
static void gimp_viewable_config_iface_init (GimpConfigInterface *iface);
@@ -583,7 +586,6 @@ gimp_viewable_invalidate_preview (GimpViewable *viewable)
g_return_if_fail (GIMP_IS_VIEWABLE (viewable));
if (private->freeze_count == 0)
g_signal_emit (viewable, viewable_signals[INVALIDATE_PREVIEW], 0);
else

View File

@@ -31,21 +31,13 @@
#define GIMP_VIEWABLE_MAX_MENU_SIZE 48
#define GIMP_TYPE_VIEWABLE (gimp_viewable_get_type ())
#define GIMP_VIEWABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_VIEWABLE, GimpViewable))
#define GIMP_VIEWABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_VIEWABLE, GimpViewableClass))
#define GIMP_IS_VIEWABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_VIEWABLE))
#define GIMP_IS_VIEWABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_VIEWABLE))
#define GIMP_VIEWABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_VIEWABLE, GimpViewableClass))
#define GIMP_TYPE_VIEWABLE (gimp_viewable_get_type ())
G_DECLARE_DERIVABLE_TYPE (GimpViewable,
gimp_viewable,
GIMP, VIEWABLE,
GimpObject)
typedef struct _GimpViewableClass GimpViewableClass;
struct _GimpViewable
{
GimpObject parent_instance;
};
struct _GimpViewableClass
{
GimpObjectClass parent_class;
@@ -213,7 +205,5 @@ void gimp_viewable_set_expanded (GimpViewable *viewable,
gboolean gimp_viewable_is_ancestor (GimpViewable *ancestor,
GimpViewable *descendant);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GimpViewable, g_object_unref);
#endif /* __GIMP_VIEWABLE_H__ */