[gtk/overlay-cleanup] overlay: Drop the index child property



commit f57e66cf376ac70db0f66ff01c8e6d3d87632375
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Feb 21 19:43:33 2019 -0500

    overlay: Drop the index child property
    
    And don't allow reordering children.

 docs/reference/gtk/gtk4-sections.txt |   1 -
 gtk/gtkoverlay.c                     | 105 -----------------------------------
 gtk/gtkoverlay.h                     |   4 --
 3 files changed, 110 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 3381b8d070..176d25325d 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -6247,7 +6247,6 @@ GtkOverlayClass
 
 gtk_overlay_new
 gtk_overlay_add_overlay
-gtk_overlay_reorder_overlay
 gtk_overlay_get_overlay_pass_through
 gtk_overlay_set_overlay_pass_through
 gtk_overlay_get_measure_overlay
diff --git a/gtk/gtkoverlay.c b/gtk/gtkoverlay.c
index 4876f14df6..cf52534f97 100644
--- a/gtk/gtkoverlay.c
+++ b/gtk/gtkoverlay.c
@@ -79,7 +79,6 @@ enum
   CHILD_PROP_0,
   CHILD_PROP_PASS_THROUGH,
   CHILD_PROP_MEASURE,
-  CHILD_PROP_INDEX,
   CHILD_PROP_CLIP_OVERLAY
 };
 
@@ -373,83 +372,10 @@ gtk_overlay_remove (GtkContainer *container,
     }
   else
     {
-      GtkWidget *w;
-
       gtk_widget_unparent (widget);
-
-      for (w = gtk_widget_get_first_child (GTK_WIDGET (container));
-           w != NULL;
-           w = gtk_widget_get_next_sibling (w))
-        {
-          gtk_widget_child_notify (w, "index");
-        }
     }
 }
 
-/**
- * gtk_overlay_reorder_overlay:
- * @overlay: a #GtkOverlay
- * @child: the overlaid #GtkWidget to move
- * @position: the new index for @child in the list of overlay children
- *   of @overlay, starting from 0. If negative, indicates the end of
- *   the list
- *
- * Moves @child to a new @index in the list of @overlay children.
- * The list contains overlays in the order that these were
- * added to @overlay.
- *
- * A widget’s index in the @overlay children list determines which order
- * the children are drawn if they overlap. The first child is drawn at
- * the bottom. It also affects the focus order.
- */
-void
-gtk_overlay_reorder_overlay (GtkOverlay *overlay,
-                             GtkWidget  *child,
-                             gint        position)
-{
-  GtkWidget *w;
-
-  g_return_if_fail (GTK_IS_OVERLAY (overlay));
-  g_return_if_fail (GTK_IS_WIDGET (child));
-  g_return_if_fail (gtk_widget_get_parent (child) == GTK_WIDGET (overlay));
-
-  if (child == gtk_bin_get_child (GTK_BIN (overlay)))
-    return;
-
-  if (position < 0)
-    {
-      /* Just move it to the end */
-      gtk_widget_insert_before (child, GTK_WIDGET (overlay), NULL);
-    }
-  else
-    {
-      int pos = 0;
-      for (w = gtk_widget_get_first_child (GTK_WIDGET (overlay));
-           w != NULL;
-           w = gtk_widget_get_next_sibling (w))
-        {
-          if (pos == position)
-            break;
-
-          pos ++;
-        }
-
-      if (w == child)
-        return;
-
-      gtk_widget_insert_after (child, GTK_WIDGET (overlay), w);
-    }
-
-  /* Not all indices changed, but notify for all of them, for simplicity. */
-  for (w = gtk_widget_get_first_child (GTK_WIDGET (overlay));
-       w != NULL;
-       w = gtk_widget_get_next_sibling (w))
-    {
-      gtk_widget_child_notify (w, "index");
-    }
-}
-
-
 static void
 gtk_overlay_forall (GtkContainer *overlay,
                     GtkCallback   callback,
@@ -518,12 +444,6 @@ gtk_overlay_set_child_property (GtkContainer *container,
            }
        }
       break;
-    case CHILD_PROP_INDEX:
-      if (child_info != NULL)
-       gtk_overlay_reorder_overlay (GTK_OVERLAY (container),
-                                    child,
-                                    g_value_get_int (value));
-      break;
     case CHILD_PROP_CLIP_OVERLAY:
       if (child_info)
        {
@@ -552,8 +472,6 @@ gtk_overlay_get_child_property (GtkContainer *container,
   GtkOverlay *overlay = GTK_OVERLAY (container);
   GtkOverlayChild *child_info;
   GtkWidget *main_widget;
-  GtkWidget *w;
-  int pos = 0;
 
   main_widget = gtk_bin_get_child (GTK_BIN (overlay));
   if (child == main_widget)
@@ -582,16 +500,6 @@ gtk_overlay_get_child_property (GtkContainer *container,
       else
        g_value_set_boolean (value, TRUE);
       break;
-    case CHILD_PROP_INDEX:
-      for (w = _gtk_widget_get_first_child (GTK_WIDGET (container));
-           w != child;
-           w = _gtk_widget_get_next_sibling (w))
-        {
-          pos ++;
-        }
-
-      g_value_set_int (value, pos);
-      break;
     case CHILD_PROP_CLIP_OVERLAY:
       if (child_info)
        g_value_set_boolean (value, child_info->clip_overlay);
@@ -684,17 +592,6 @@ gtk_overlay_class_init (GtkOverlayClass *klass)
                             FALSE,
                             GTK_PARAM_READWRITE));
 
-  /**
-   * GtkOverlay:index:
-   *
-   * The index of the overlay in the parent, -1 for the main child.
-   */
-  gtk_container_class_install_child_property (container_class, CHILD_PROP_INDEX,
-                                             g_param_spec_int ("index",
-                                                               P_("Index"),
-                                                               P_("The index of the overlay in the parent, 
-1 for the main child"),
-                                                               -1, G_MAXINT, 0,
-                                                               GTK_PARAM_READWRITE));
   /**
    * GtkOverlay:clip-overlay:
    *
@@ -827,8 +724,6 @@ gtk_overlay_add_overlay (GtkOverlay *overlay,
 
   gtk_widget_insert_before (widget, GTK_WIDGET (overlay), NULL);
   gtk_overlay_set_overlay_child (widget, child);
-
-  gtk_widget_child_notify (widget, "index");
 }
 
 /**
diff --git a/gtk/gtkoverlay.h b/gtk/gtkoverlay.h
index bf5bf7fead..b0ff60d4ad 100644
--- a/gtk/gtkoverlay.h
+++ b/gtk/gtkoverlay.h
@@ -82,10 +82,6 @@ GDK_AVAILABLE_IN_ALL
 void       gtk_overlay_add_overlay (GtkOverlay *overlay,
                                     GtkWidget  *widget);
 GDK_AVAILABLE_IN_ALL
-void       gtk_overlay_reorder_overlay (GtkOverlay     *overlay,
-                                       GtkWidget      *child,
-                                       gint            position);
-GDK_AVAILABLE_IN_ALL
 gboolean   gtk_overlay_get_overlay_pass_through (GtkOverlay *overlay,
                                                 GtkWidget  *widget);
 GDK_AVAILABLE_IN_ALL


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