flowbox: Always return a NULL iter when we are at the end

The objective is simplify the semantics of the code so that we don't
need to check for "(iter != NULL && !g_sequence_iter_is_end (iter))"
in the callers.
This commit is contained in:
Debarshi Ray 2013-10-21 16:32:49 +02:00
parent 65dd26d3f3
commit bcc6979f89

View File

@ -1198,7 +1198,7 @@ gtk_flow_box_get_next_focusable (GtkFlowBox *box,
{ {
iter = g_sequence_iter_next (iter); iter = g_sequence_iter_next (iter);
if (g_sequence_iter_is_end (iter)) if (g_sequence_iter_is_end (iter))
return iter; return NULL;
child = g_sequence_get (iter); child = g_sequence_get (iter);
if (child_is_visible (GTK_WIDGET (child)) && if (child_is_visible (GTK_WIDGET (child)) &&
gtk_widget_is_sensitive (GTK_WIDGET (child))) gtk_widget_is_sensitive (GTK_WIDGET (child)))
@ -1276,7 +1276,7 @@ gtk_flow_box_get_below_focusable (GtkFlowBox *box,
{ {
iter = g_sequence_iter_next (iter); iter = g_sequence_iter_next (iter);
if (g_sequence_iter_is_end (iter)) if (g_sequence_iter_is_end (iter))
return iter; return NULL;
child = g_sequence_get (iter); child = g_sequence_get (iter);
if (child_is_visible (GTK_WIDGET (child))) if (child_is_visible (GTK_WIDGET (child)))
i++; i++;
@ -3200,7 +3200,7 @@ gtk_flow_box_focus (GtkWidget *widget,
else if (direction == GTK_DIR_DOWN) else if (direction == GTK_DIR_DOWN)
iter = gtk_flow_box_get_below_focusable (box, iter); iter = gtk_flow_box_get_below_focusable (box, iter);
if (iter != NULL && !g_sequence_iter_is_end (iter)) if (iter != NULL)
next_focus_child = g_sequence_get (iter); next_focus_child = g_sequence_get (iter);
} }
else else
@ -3214,7 +3214,7 @@ gtk_flow_box_focus (GtkWidget *widget,
else else
iter = gtk_flow_box_get_first_focusable (box); iter = gtk_flow_box_get_first_focusable (box);
if (iter != NULL && !g_sequence_iter_is_end (iter)) if (iter != NULL)
next_focus_child = g_sequence_get (iter); next_focus_child = g_sequence_get (iter);
} }
} }
@ -3366,7 +3366,7 @@ gtk_flow_box_move_cursor (GtkFlowBox *box,
iter = gtk_flow_box_get_first_focusable (box); iter = gtk_flow_box_get_first_focusable (box);
else else
iter = gtk_flow_box_get_last_focusable (box); iter = gtk_flow_box_get_last_focusable (box);
if (iter != NULL && !g_sequence_iter_is_end (iter)) if (iter != NULL)
child = g_sequence_get (iter); child = g_sequence_get (iter);
break; break;
@ -3386,7 +3386,7 @@ gtk_flow_box_move_cursor (GtkFlowBox *box,
count = count - 1; count = count - 1;
} }
if (iter != NULL && !g_sequence_iter_is_end (iter)) if (iter != NULL)
child = g_sequence_get (iter); child = g_sequence_get (iter);
} }
break; break;