[gtk+] flowbox: Always return a NULL iter when we are at the end



commit bcc6979f8900dabe4646b22fe58c8d0bba0e1acf
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Oct 21 16:32:49 2013 +0200

    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.

 gtk/gtkflowbox.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c
index 0bac89b..f0ef7cc 100644
--- a/gtk/gtkflowbox.c
+++ b/gtk/gtkflowbox.c
@@ -1198,7 +1198,7 @@ gtk_flow_box_get_next_focusable (GtkFlowBox    *box,
     {
       iter = g_sequence_iter_next (iter);
       if (g_sequence_iter_is_end (iter))
-        return iter;
+        return NULL;
       child = g_sequence_get (iter);
       if (child_is_visible (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);
           if (g_sequence_iter_is_end (iter))
-            return iter;
+            return NULL;
           child = g_sequence_get (iter);
           if (child_is_visible (GTK_WIDGET (child)))
             i++;
@@ -3200,7 +3200,7 @@ gtk_flow_box_focus (GtkWidget        *widget,
       else if (direction == GTK_DIR_DOWN)
         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);
     }
   else
@@ -3214,7 +3214,7 @@ gtk_flow_box_focus (GtkWidget        *widget,
           else
             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);
         }
     }
@@ -3366,7 +3366,7 @@ gtk_flow_box_move_cursor (GtkFlowBox      *box,
         iter = gtk_flow_box_get_first_focusable (box);
       else
         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);
       break;
 
@@ -3386,7 +3386,7 @@ gtk_flow_box_move_cursor (GtkFlowBox      *box,
               count = count - 1;
             }
 
-          if (iter != NULL && !g_sequence_iter_is_end (iter))
+          if (iter != NULL)
             child = g_sequence_get (iter);
         }
       break;


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