binding-pool: Use macros for subclassing boilerplate

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
This commit is contained in:
Bilal Elmoussaoui 2023-11-10 15:06:37 +01:00
parent e729e63963
commit ae23caa537
3 changed files with 13 additions and 24 deletions

View File

@ -33,7 +33,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActor, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterAlignConstraint, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBackend, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBindConstraint, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBindingPool, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBlurEffect, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBoxLayout, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBrightnessContrastEffect, g_object_unref)

View File

@ -101,16 +101,12 @@
#include "clutter/clutter-marshal.h"
#include "clutter/clutter-private.h"
#define CLUTTER_BINDING_POOL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), CLUTTER_TYPE_BINDING_POOL, ClutterBindingPoolClass))
#define CLUTTER_IS_BINDING_POOL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CLUTTER_TYPE_BINDING_POOL))
#define CLUTTER_BINDING_POOL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CLUTTER_TYPE_BINDING_POOL, ClutterBindingPoolClass))
#define BINDING_MOD_MASK ((CLUTTER_SHIFT_MASK | \
#define BINDING_MOD_MASK ((CLUTTER_SHIFT_MASK | \
CLUTTER_CONTROL_MASK | \
CLUTTER_MOD1_MASK | \
CLUTTER_SUPER_MASK | \
CLUTTER_HYPER_MASK | \
CLUTTER_META_MASK) | CLUTTER_RELEASE_MASK)
CLUTTER_MOD1_MASK | \
CLUTTER_SUPER_MASK | \
CLUTTER_HYPER_MASK | \
CLUTTER_META_MASK) | CLUTTER_RELEASE_MASK)
typedef struct _ClutterBindingEntry ClutterBindingEntry;
@ -127,11 +123,6 @@ struct _ClutterBindingPool
GHashTable *entries_hash;
};
struct _ClutterBindingPoolClass
{
GObjectClass parent_class;
};
struct _ClutterBindingEntry
{
gchar *name; /* interned string, do not free */
@ -155,7 +146,7 @@ enum
static GParamSpec *obj_props[PROP_LAST];
G_DEFINE_TYPE (ClutterBindingPool, clutter_binding_pool, G_TYPE_OBJECT);
G_DEFINE_FINAL_TYPE (ClutterBindingPool, clutter_binding_pool, G_TYPE_OBJECT);
static guint
binding_entry_hash (gconstpointer v)

View File

@ -34,11 +34,13 @@
G_BEGIN_DECLS
#define CLUTTER_TYPE_BINDING_POOL (clutter_binding_pool_get_type ())
#define CLUTTER_BINDING_POOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BINDING_POOL, ClutterBindingPool))
#define CLUTTER_IS_BINDING_POOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BINDING_POOL))
typedef struct _ClutterBindingPool ClutterBindingPool;
typedef struct _ClutterBindingPoolClass ClutterBindingPoolClass;
CLUTTER_EXPORT
G_DECLARE_FINAL_TYPE (ClutterBindingPool,
clutter_binding_pool,
CLUTTER,
BINDING_POOL,
GObject)
/**
* ClutterBindingActionFunc:
@ -61,9 +63,6 @@ typedef gboolean (* ClutterBindingActionFunc) (GObject *gobject,
ClutterModifierType modifiers,
gpointer user_data);
CLUTTER_EXPORT
GType clutter_binding_pool_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
ClutterBindingPool * clutter_binding_pool_new (const gchar *name);
CLUTTER_EXPORT