[mutter/wip/nielsdg/use-g-declare-interface: 1/2] clutter: Content: use G_DECLARE_INTERFACE()
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/nielsdg/use-g-declare-interface: 1/2] clutter: Content: use G_DECLARE_INTERFACE()
- Date: Tue, 8 Jan 2019 14:44:08 +0000 (UTC)
commit 1007aa40f25b0cc7b2250cb21582f0876f060952
Author: Niels De Graef <nielsdegraef gmail com>
Date: Tue Jan 8 15:16:47 2019 +0100
clutter: Content: use G_DECLARE_INTERFACE()
It cuts away a bit of the GObject boilerplate, gives us support for
`g_autoptr`, and removes the typedef hack inside clutter-content.c.
clutter/clutter/clutter-canvas.c | 4 ++--
clutter/clutter/clutter-content.c | 12 +++++-------
clutter/clutter/clutter-content.h | 26 ++++++--------------------
clutter/clutter/clutter-image.c | 4 ++--
clutter/tests/interactive/test-content.c | 4 ++--
clutter/tests/interactive/test-image.c | 4 ++--
6 files changed, 19 insertions(+), 35 deletions(-)
---
diff --git a/clutter/clutter/clutter-canvas.c b/clutter/clutter/clutter-canvas.c
index aa9f1ea41..9f29f18ad 100644
--- a/clutter/clutter/clutter-canvas.c
+++ b/clutter/clutter/clutter-canvas.c
@@ -97,7 +97,7 @@ enum
static guint canvas_signals[LAST_SIGNAL] = { 0, };
-static void clutter_content_iface_init (ClutterContentIface *iface);
+static void clutter_content_iface_init (ClutterContentInterface *iface);
G_DEFINE_TYPE_WITH_CODE (ClutterCanvas, clutter_canvas, G_TYPE_OBJECT,
G_ADD_PRIVATE (ClutterCanvas)
@@ -457,7 +457,7 @@ clutter_canvas_get_preferred_size (ClutterContent *content,
}
static void
-clutter_content_iface_init (ClutterContentIface *iface)
+clutter_content_iface_init (ClutterContentInterface *iface)
{
iface->invalidate = clutter_canvas_invalidate;
iface->paint_content = clutter_canvas_paint_content;
diff --git a/clutter/clutter/clutter-content.c b/clutter/clutter/clutter-content.c
index 35419305e..d2a0c3fe3 100644
--- a/clutter/clutter/clutter-content.c
+++ b/clutter/clutter/clutter-content.c
@@ -44,8 +44,6 @@
#include "clutter-marshal.h"
#include "clutter-private.h"
-typedef struct _ClutterContentIface ClutterContentInterface;
-
enum
{
ATTACHED,
@@ -123,7 +121,7 @@ clutter_content_default_init (ClutterContentInterface *iface)
g_signal_new (I_("attached"),
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (ClutterContentIface, attached),
+ G_STRUCT_OFFSET (ClutterContentInterface, attached),
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
@@ -143,7 +141,7 @@ clutter_content_default_init (ClutterContentInterface *iface)
g_signal_new (I_("detached"),
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (ClutterContentIface, detached),
+ G_STRUCT_OFFSET (ClutterContentInterface, detached),
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
@@ -199,7 +197,7 @@ clutter_content_invalidate (ClutterContent *content)
* is associated to a #ClutterContent, to set up a backpointer from
* the @content to the @actor.
*
- * This function will invoke the #ClutterContentIface.attached() virtual
+ * This function will invoke the #ClutterContentInterface.attached() virtual
* function.
*/
void
@@ -233,7 +231,7 @@ _clutter_content_attached (ClutterContent *content,
* This function should be used internally every time a #ClutterActor
* removes the association with a #ClutterContent.
*
- * This function will invoke the #ClutterContentIface.detached() virtual
+ * This function will invoke the #ClutterContentInterface.detached() virtual
* function.
*/
void
@@ -262,7 +260,7 @@ _clutter_content_detached (ClutterContent *content,
*
* Creates the render tree for the @content and @actor.
*
- * This function will invoke the #ClutterContentIface.paint_content()
+ * This function will invoke the #ClutterContentInterface.paint_content()
* virtual function.
*/
void
diff --git a/clutter/clutter/clutter-content.h b/clutter/clutter/clutter-content.h
index 69836d5a1..2e9a29b86 100644
--- a/clutter/clutter/clutter-content.h
+++ b/clutter/clutter/clutter-content.h
@@ -33,24 +33,13 @@
G_BEGIN_DECLS
-#define CLUTTER_TYPE_CONTENT (clutter_content_get_type ())
-#define CLUTTER_CONTENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_CONTENT,
ClutterContent))
-#define CLUTTER_IS_CONTENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_CONTENT))
-#define CLUTTER_CONTENT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLUTTER_TYPE_CONTENT,
ClutterContentIface))
+#define CLUTTER_TYPE_CONTENT (clutter_content_get_type ())
-typedef struct _ClutterContentIface ClutterContentIface;
-
-/**
- * ClutterContent:
- *
- * The #ClutterContent structure is an opaque type
- * whose members cannot be acccessed directly.
- *
- * Since: 1.10
- */
+CLUTTER_EXPORT
+G_DECLARE_INTERFACE (ClutterContent, clutter_content, CLUTTER, CONTENT, GObject)
/**
- * ClutterContentIface:
+ * ClutterContentInterface:
* @get_preferred_size: virtual function; should be overridden by subclasses
* of #ClutterContent that have a natural size
* @paint_content: virtual function; called each time the content needs to
@@ -62,12 +51,12 @@ typedef struct _ClutterContentIface ClutterContentIface;
* @invalidate: virtual function; called each time a #ClutterContent state
* is changed.
*
- * The #ClutterContentIface structure contains only
+ * The #ClutterContentInterface structure contains only
* private data.
*
* Since: 1.10
*/
-struct _ClutterContentIface
+struct _ClutterContentInterface
{
/*< private >*/
GTypeInterface g_iface;
@@ -88,9 +77,6 @@ struct _ClutterContentIface
void (* invalidate) (ClutterContent *content);
};
-CLUTTER_EXPORT
-GType clutter_content_get_type (void) G_GNUC_CONST;
-
CLUTTER_EXPORT
gboolean clutter_content_get_preferred_size (ClutterContent *content,
gfloat *width,
diff --git a/clutter/clutter/clutter-image.c b/clutter/clutter/clutter-image.c
index d4356598b..6739dc7e1 100644
--- a/clutter/clutter/clutter-image.c
+++ b/clutter/clutter/clutter-image.c
@@ -55,7 +55,7 @@ struct _ClutterImagePrivate
CoglTexture *texture;
};
-static void clutter_content_iface_init (ClutterContentIface *iface);
+static void clutter_content_iface_init (ClutterContentInterface *iface);
G_DEFINE_TYPE_WITH_CODE (ClutterImage, clutter_image, G_TYPE_OBJECT,
G_ADD_PRIVATE (ClutterImage)
@@ -131,7 +131,7 @@ clutter_image_get_preferred_size (ClutterContent *content,
}
static void
-clutter_content_iface_init (ClutterContentIface *iface)
+clutter_content_iface_init (ClutterContentInterface *iface)
{
iface->get_preferred_size = clutter_image_get_preferred_size;
iface->paint_content = clutter_image_paint_content;
diff --git a/clutter/tests/interactive/test-content.c b/clutter/tests/interactive/test-content.c
index ecf731d34..c068764f3 100644
--- a/clutter/tests/interactive/test-content.c
+++ b/clutter/tests/interactive/test-content.c
@@ -17,7 +17,7 @@ typedef struct _ColorContentClass {
GObjectClass parent_class;
} ColorContentClass;
-static void clutter_content_iface_init (ClutterContentIface *iface);
+static void clutter_content_iface_init (ClutterContentInterface *iface);
G_DEFINE_TYPE_WITH_CODE (ColorContent, color_content, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTENT,
@@ -127,7 +127,7 @@ color_content_paint_content (ClutterContent *content,
}
static void
-clutter_content_iface_init (ClutterContentIface *iface)
+clutter_content_iface_init (ClutterContentInterface *iface)
{
iface->paint_content = color_content_paint_content;
}
diff --git a/clutter/tests/interactive/test-image.c b/clutter/tests/interactive/test-image.c
index e77108cb1..2da97f0d4 100644
--- a/clutter/tests/interactive/test-image.c
+++ b/clutter/tests/interactive/test-image.c
@@ -18,7 +18,7 @@ typedef struct _SolidContentClass {
GObjectClass parent_class;
} SolidContentClass;
-static void clutter_content_iface_init (ClutterContentIface *iface);
+static void clutter_content_iface_init (ClutterContentInterface *iface);
G_DEFINE_TYPE_WITH_CODE (SolidContent, solid_content, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTENT,
@@ -128,7 +128,7 @@ solid_content_paint_content (ClutterContent *content,
}
static void
-clutter_content_iface_init (ClutterContentIface *iface)
+clutter_content_iface_init (ClutterContentInterface *iface)
{
iface->paint_content = solid_content_paint_content;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]