[gtk/matthiasc/for-master: 13/15] overlay: Drop the Private struct



commit 2356c9b5039c7fb879ffa1cb56db83909fefb9b1
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Apr 26 15:37:47 2020 -0400

    overlay: Drop the Private struct

 gtk/gtkoverlay.c | 30 +++++++++++++-----------------
 1 file changed, 13 insertions(+), 17 deletions(-)
---
diff --git a/gtk/gtkoverlay.c b/gtk/gtkoverlay.c
index f23982221e..8298411f7a 100644
--- a/gtk/gtkoverlay.c
+++ b/gtk/gtkoverlay.c
@@ -75,7 +75,7 @@ static guint signals[LAST_SIGNAL] = { 0 };
 
 static void gtk_overlay_buildable_init (GtkBuildableIface *iface);
 
-typedef struct _GtkOverlayClass    GtkOverlayClass;
+typedef struct _GtkOverlayClass GtkOverlayClass;
 
 struct _GtkOverlay
 {
@@ -91,12 +91,7 @@ struct _GtkOverlayClass
                                   GtkAllocation *allocation);
 };
 
-typedef struct {
-  GtkLayoutManager *layout;
-} GtkOverlayPrivate;
-
 G_DEFINE_TYPE_WITH_CODE (GtkOverlay, gtk_overlay, GTK_TYPE_BIN,
-                         G_ADD_PRIVATE (GtkOverlay)
                          G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
                                                 gtk_overlay_buildable_init))
 
@@ -331,9 +326,6 @@ gtk_overlay_class_init (GtkOverlayClass *klass)
 static void
 gtk_overlay_init (GtkOverlay *overlay)
 {
-  GtkOverlayPrivate *priv = gtk_overlay_get_instance_private (overlay);
-
-  priv->layout = gtk_widget_get_layout_manager (GTK_WIDGET (overlay));
 }
 
 static GtkBuildableIface *parent_buildable_iface;
@@ -424,13 +416,14 @@ gtk_overlay_set_measure_overlay (GtkOverlay *overlay,
                                 GtkWidget  *widget,
                                 gboolean    measure)
 {
-  GtkOverlayPrivate *priv = gtk_overlay_get_instance_private (overlay);
+  GtkLayoutManager *layout;
   GtkOverlayLayoutChild *child;
 
   g_return_if_fail (GTK_IS_OVERLAY (overlay));
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
-  child = GTK_OVERLAY_LAYOUT_CHILD (gtk_layout_manager_get_layout_child (priv->layout, widget));
+  layout = gtk_widget_get_layout_manager (GTK_WIDGET (overlay));
+  child = GTK_OVERLAY_LAYOUT_CHILD (gtk_layout_manager_get_layout_child (layout, widget));
   gtk_overlay_layout_child_set_measure (child, measure);
 }
 
@@ -448,13 +441,14 @@ gboolean
 gtk_overlay_get_measure_overlay (GtkOverlay *overlay,
                                 GtkWidget  *widget)
 {
-  GtkOverlayPrivate *priv = gtk_overlay_get_instance_private (overlay);
+  GtkLayoutManager *layout;
   GtkOverlayLayoutChild *child;
 
   g_return_val_if_fail (GTK_IS_OVERLAY (overlay), FALSE);
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  child = GTK_OVERLAY_LAYOUT_CHILD (gtk_layout_manager_get_layout_child (priv->layout, widget));
+  layout = gtk_widget_get_layout_manager (GTK_WIDGET (overlay));
+  child = GTK_OVERLAY_LAYOUT_CHILD (gtk_layout_manager_get_layout_child (layout, widget));
   return gtk_overlay_layout_child_get_measure (child);
 }
 
@@ -472,13 +466,14 @@ gtk_overlay_set_clip_overlay (GtkOverlay *overlay,
                               GtkWidget  *widget,
                               gboolean    clip_overlay)
 {
-  GtkOverlayPrivate *priv = gtk_overlay_get_instance_private (overlay);
+  GtkLayoutManager *layout;
   GtkOverlayLayoutChild *child;
 
   g_return_if_fail (GTK_IS_OVERLAY (overlay));
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
-  child = GTK_OVERLAY_LAYOUT_CHILD (gtk_layout_manager_get_layout_child (priv->layout, widget));
+  layout = gtk_widget_get_layout_manager (GTK_WIDGET (overlay));
+  child = GTK_OVERLAY_LAYOUT_CHILD (gtk_layout_manager_get_layout_child (layout, widget));
   gtk_overlay_layout_child_set_clip_overlay (child, clip_overlay);
 }
 
@@ -496,13 +491,14 @@ gboolean
 gtk_overlay_get_clip_overlay (GtkOverlay *overlay,
                               GtkWidget  *widget)
 {
-  GtkOverlayPrivate *priv = gtk_overlay_get_instance_private (overlay);
+  GtkLayoutManager *layout;
   GtkOverlayLayoutChild *child;
 
   g_return_val_if_fail (GTK_IS_OVERLAY (overlay), FALSE);
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  child = GTK_OVERLAY_LAYOUT_CHILD (gtk_layout_manager_get_layout_child (priv->layout, widget));
+  layout = gtk_widget_get_layout_manager (GTK_WIDGET (overlay));
+  child = GTK_OVERLAY_LAYOUT_CHILD (gtk_layout_manager_get_layout_child (layout, widget));
 
   return gtk_overlay_layout_child_get_clip_overlay (child);
 }


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