[gtk/wip/dboles/overlay-docs-3: 2/2] Overlay: Use documented parameter name @ reorder()
- From: Daniel Boles <dboles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/dboles/overlay-docs-3: 2/2] Overlay: Use documented parameter name @ reorder()
- Date: Wed, 12 Jun 2019 17:00:22 +0000 (UTC)
commit e1d1ee4ba777638f384aebac87710543fb997804
Author: Daniel Boles <dboles src gmail com>
Date: Wed Jun 12 17:55:08 2019 +0100
Overlay: Use documented parameter name @ reorder()
We named the argument `position` in the code and doc arguments, but the
rest of the documentation referred to `index` instead. That was maybe
meant to hint at the child property named :index, but we can simply be
fully clear here. We can call the argument index, replacing the local
variable with that name, thus avoiding any possible confusion with the
unrelated ::get-child-position, and refer users to :index for completion
gtk/gtkoverlay.c | 13 ++++++-------
gtk/gtkoverlay.h | 6 +++---
2 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkoverlay.c b/gtk/gtkoverlay.c
index 5cf956d144..fdcb423e86 100644
--- a/gtk/gtkoverlay.c
+++ b/gtk/gtkoverlay.c
@@ -531,13 +531,13 @@ gtk_overlay_remove (GtkContainer *container,
* 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
+ * @index: 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.
+ * added to @overlay by default. See also #GtkOverlay:index.
*
* 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
@@ -548,7 +548,7 @@ gtk_overlay_remove (GtkContainer *container,
void
gtk_overlay_reorder_overlay (GtkOverlay *overlay,
GtkWidget *child,
- gint position)
+ int index)
{
GtkOverlayPrivate *priv;
GSList *old_link;
@@ -556,7 +556,6 @@ gtk_overlay_reorder_overlay (GtkOverlay *overlay,
GSList *l;
GtkOverlayChild *child_info = NULL;
gint old_index, i;
- gint index;
g_return_if_fail (GTK_IS_OVERLAY (overlay));
g_return_if_fail (GTK_IS_WIDGET (child));
@@ -577,15 +576,15 @@ gtk_overlay_reorder_overlay (GtkOverlay *overlay,
g_return_if_fail (old_link != NULL);
- if (position < 0)
+ if (index < 0)
{
new_link = NULL;
index = g_slist_length (priv->children) - 1;
}
else
{
- new_link = g_slist_nth (priv->children, position);
- index = MIN (position, g_slist_length (priv->children) - 1);
+ new_link = g_slist_nth (priv->children, index);
+ index = MIN (index, g_slist_length (priv->children) - 1);
}
if (index == old_index)
diff --git a/gtk/gtkoverlay.h b/gtk/gtkoverlay.h
index bf9fc62761..71dbeb504b 100644
--- a/gtk/gtkoverlay.h
+++ b/gtk/gtkoverlay.h
@@ -84,9 +84,9 @@ GDK_AVAILABLE_IN_3_2
void gtk_overlay_add_overlay (GtkOverlay *overlay,
GtkWidget *widget);
GDK_AVAILABLE_IN_3_18
-void gtk_overlay_reorder_overlay (GtkOverlay *overlay,
- GtkWidget *child,
- gint position);
+void gtk_overlay_reorder_overlay (GtkOverlay *overlay,
+ GtkWidget *child,
+ int index);
GDK_AVAILABLE_IN_3_18
gboolean gtk_overlay_get_overlay_pass_through (GtkOverlay *overlay,
GtkWidget *widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]