mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 21:21:21 +00:00
gail: Fix scrollbar index_in_parent() implementation
This commit is contained in:
parent
dee2e74736
commit
acaaca4c76
@ -59,9 +59,9 @@ gail_scrollbar_get_index_in_parent (AtkObject *accessible)
|
|||||||
{
|
{
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
GtkWidget *parent;
|
GtkWidget *parent;
|
||||||
|
GtkWidget *child;
|
||||||
GtkScrolledWindow *scrolled_window;
|
GtkScrolledWindow *scrolled_window;
|
||||||
gint n_children;
|
gint id;
|
||||||
GList *children;
|
|
||||||
|
|
||||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
|
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
|
||||||
|
|
||||||
@ -79,31 +79,28 @@ gail_scrollbar_get_index_in_parent (AtkObject *accessible)
|
|||||||
return ATK_OBJECT_CLASS (gail_scrollbar_parent_class)->get_index_in_parent (accessible);
|
return ATK_OBJECT_CLASS (gail_scrollbar_parent_class)->get_index_in_parent (accessible);
|
||||||
|
|
||||||
scrolled_window = GTK_SCROLLED_WINDOW (parent);
|
scrolled_window = GTK_SCROLLED_WINDOW (parent);
|
||||||
children = gtk_container_get_children (GTK_CONTAINER (scrolled_window));
|
id = 0;
|
||||||
n_children = g_list_length (children);
|
child = gtk_bin_get_child (GTK_BIN (scrolled_window));
|
||||||
g_list_free (children);
|
if (child)
|
||||||
|
{
|
||||||
|
if (widget == child)
|
||||||
|
return id;
|
||||||
|
id++;
|
||||||
|
}
|
||||||
|
|
||||||
if (GTK_IS_HSCROLLBAR (widget))
|
child = gtk_scrolled_window_get_hscrollbar (scrolled_window);
|
||||||
{
|
if (child)
|
||||||
if (!gtk_scrolled_window_get_hscrollbar (scrolled_window))
|
|
||||||
{
|
{
|
||||||
n_children = -1;
|
if (widget == child)
|
||||||
|
return id;
|
||||||
|
id++;
|
||||||
}
|
}
|
||||||
}
|
child = gtk_scrolled_window_get_vscrollbar (scrolled_window);
|
||||||
else if (GTK_IS_VSCROLLBAR (widget))
|
if (child)
|
||||||
{
|
|
||||||
if (!gtk_scrolled_window_get_vscrollbar (scrolled_window))
|
|
||||||
{
|
{
|
||||||
n_children = -1;
|
if (widget == child)
|
||||||
|
return id;
|
||||||
}
|
}
|
||||||
else if (gtk_scrolled_window_get_hscrollbar (scrolled_window))
|
|
||||||
{
|
return -1;
|
||||||
n_children++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
n_children = -1;
|
|
||||||
}
|
|
||||||
return n_children;
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user