[gnome-builder/wip/gtk4-port] libide/gtk: use enums generation and final type
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port] libide/gtk: use enums generation and final type
- Date: Thu, 7 Apr 2022 00:25:59 +0000 (UTC)
commit 65fa90aafb660811586cef92896ecdb0f567184a
Author: Christian Hergert <chergert redhat com>
Date: Wed Apr 6 17:24:43 2022 -0700
libide/gtk: use enums generation and final type
src/libide/gtk/ide-three-grid.c | 34 ++++++----------------------------
src/libide/gtk/ide-three-grid.h | 17 +++++++----------
src/libide/gtk/meson.build | 1 +
3 files changed, 14 insertions(+), 38 deletions(-)
---
diff --git a/src/libide/gtk/ide-three-grid.c b/src/libide/gtk/ide-three-grid.c
index 82e850016..fba129883 100644
--- a/src/libide/gtk/ide-three-grid.c
+++ b/src/libide/gtk/ide-three-grid.c
@@ -23,6 +23,7 @@
#define _USE_MATH_DEFINES
#include <math.h>
+#include "ide-gtk-enums.h"
#include "ide-three-grid.h"
struct _IdeThreeGridChild
@@ -590,17 +591,15 @@ ide_three_grid_layout_init (IdeThreeGridLayout *self)
{
}
-typedef struct
+struct _IdeThreeGrid
{
- guint column_spacing;
- guint row_spacing;
-} IdeThreeGridPrivate;
+ GtkWidget parent_instance;
+};
static void buildable_iface_init (GtkBuildableIface *iface);
-G_DEFINE_TYPE_WITH_CODE (IdeThreeGrid, ide_three_grid, GTK_TYPE_WIDGET,
- G_ADD_PRIVATE (IdeThreeGrid)
- G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, buildable_iface_init))
+G_DEFINE_FINAL_TYPE_WITH_CODE (IdeThreeGrid, ide_three_grid, GTK_TYPE_WIDGET,
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, buildable_iface_init))
enum {
PROP_0,
@@ -741,27 +740,6 @@ ide_three_grid_new (void)
return g_object_new (IDE_TYPE_THREE_GRID, NULL);
}
-GType
-ide_three_grid_column_get_type (void)
-{
- static GType type_id;
-
- if (g_once_init_enter (&type_id))
- {
- GType _type_id;
- static const GEnumValue values[] = {
- { IDE_THREE_GRID_COLUMN_LEFT, "IDE_THREE_GRID_COLUMN_LEFT", "left" },
- { IDE_THREE_GRID_COLUMN_CENTER, "IDE_THREE_GRID_COLUMN_CENTER", "center" },
- { IDE_THREE_GRID_COLUMN_RIGHT, "IDE_THREE_GRID_COLUMN_RIGHT", "right" },
- { 0 }
- };
- _type_id = g_enum_register_static ("IdeThreeGridColumn", values);
- g_once_init_leave (&type_id, _type_id);
- }
-
- return type_id;
-}
-
static void
ide_three_grid_add_child (GtkBuildable *buildable,
GtkBuilder *builder,
diff --git a/src/libide/gtk/ide-three-grid.h b/src/libide/gtk/ide-three-grid.h
index 1bbd31c07..d30825455 100644
--- a/src/libide/gtk/ide-three-grid.h
+++ b/src/libide/gtk/ide-three-grid.h
@@ -28,15 +28,7 @@
G_BEGIN_DECLS
-#define IDE_TYPE_THREE_GRID (ide_three_grid_get_type())
-#define IDE_TYPE_THREE_GRID_COLUMN (ide_three_grid_column_get_type())
-
-G_DECLARE_DERIVABLE_TYPE (IdeThreeGrid, ide_three_grid, IDE, THREE_GRID, GtkWidget)
-
-struct _IdeThreeGridClass
-{
- GtkWidgetClass parent_class;
-};
+#define IDE_TYPE_THREE_GRID (ide_three_grid_get_type())
typedef enum
{
@@ -45,12 +37,17 @@ typedef enum
IDE_THREE_GRID_COLUMN_RIGHT
} IdeThreeGridColumn;
-GType ide_three_grid_column_get_type (void);
+IDE_AVAILABLE_IN_ALL
+G_DECLARE_FINAL_TYPE (IdeThreeGrid, ide_three_grid, IDE, THREE_GRID, GtkWidget)
+
+IDE_AVAILABLE_IN_ALL
GtkWidget *ide_three_grid_new (void);
+IDE_AVAILABLE_IN_ALL
void ide_three_grid_add (IdeThreeGrid *self,
GtkWidget *child,
guint row,
IdeThreeGridColumn column);
+IDE_AVAILABLE_IN_ALL
void ide_three_grid_remove (IdeThreeGrid *self,
GtkWidget *child);
diff --git a/src/libide/gtk/meson.build b/src/libide/gtk/meson.build
index 9e0a86acb..d14952186 100644
--- a/src/libide/gtk/meson.build
+++ b/src/libide/gtk/meson.build
@@ -25,6 +25,7 @@ libide_gtk_public_headers = [
libide_gtk_enum_headers = [
'ide-animation.h',
+ 'ide-three-grid.h',
]
install_headers(libide_gtk_public_headers, subdir: libide_gtk_header_subdir)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]