[gnome-builder/wip/gtk4-port: 227/736] libide/gui: make IdePanelPosition a boxed type




commit 9379922b4ecd77edde033fbab5d7913b024db4e6
Author: Christian Hergert <chergert redhat com>
Date:   Wed Mar 30 15:14:16 2022 -0700

    libide/gui: make IdePanelPosition a boxed type

 src/libide/gui/ide-panel-position.c | 14 +++++++++++---
 src/libide/gui/ide-panel-position.h | 10 ++++++++--
 2 files changed, 19 insertions(+), 5 deletions(-)
---
diff --git a/src/libide/gui/ide-panel-position.c b/src/libide/gui/ide-panel-position.c
index 34f29b485..cdf53f167 100644
--- a/src/libide/gui/ide-panel-position.c
+++ b/src/libide/gui/ide-panel-position.c
@@ -36,16 +36,24 @@ struct _IdePanelPosition
   guint edge_set : 1;
 };
 
+G_DEFINE_BOXED_TYPE (IdePanelPosition, ide_panel_position, ide_panel_position_ref, ide_panel_position_unref)
+
 IdePanelPosition *
 ide_panel_position_new (void)
 {
-  return g_slice_new0 (IdePanelPosition);
+  return g_rc_box_alloc0 (sizeof (IdePanelPosition));
+}
+
+IdePanelPosition *
+ide_panel_position_ref (IdePanelPosition *self)
+{
+  return g_rc_box_acquire (self);
 }
 
 void
-ide_panel_position_free (IdePanelPosition *self)
+ide_panel_position_unref (IdePanelPosition *self)
 {
-  g_slice_free (IdePanelPosition, self);
+  g_rc_box_release (self);
 }
 
 gboolean
diff --git a/src/libide/gui/ide-panel-position.h b/src/libide/gui/ide-panel-position.h
index ab521617e..9b5012ab7 100644
--- a/src/libide/gui/ide-panel-position.h
+++ b/src/libide/gui/ide-panel-position.h
@@ -30,12 +30,18 @@
 
 G_BEGIN_DECLS
 
+#define IDE_TYPE_PANEL_POSITION (ide_panel_position_get_type())
+
 typedef struct _IdePanelPosition IdePanelPosition;
 
+IDE_AVAILABLE_IN_ALL
+GType             ide_panel_position_get_type   (void) G_GNUC_CONST;
 IDE_AVAILABLE_IN_ALL
 IdePanelPosition *ide_panel_position_new        (void);
 IDE_AVAILABLE_IN_ALL
-void              ide_panel_position_free       (IdePanelPosition  *self);
+IdePanelPosition *ide_panel_position_ref        (IdePanelPosition  *self);
+IDE_AVAILABLE_IN_ALL
+void              ide_panel_position_unref      (IdePanelPosition  *self);
 IDE_AVAILABLE_IN_ALL
 gboolean          ide_panel_position_get_edge   (IdePanelPosition  *self,
                                                  PanelDockPosition *edge);
@@ -61,6 +67,6 @@ IDE_AVAILABLE_IN_ALL
 void              ide_panel_position_set_depth  (IdePanelPosition  *self,
                                                  guint              depth);
 
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (IdePanelPosition, ide_panel_position_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IdePanelPosition, ide_panel_position_unref)
 
 G_END_DECLS


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]