[gnome-games/wip/exalm/spinner: 12/17] collection-icon-view: Only call model.get_n_items() once



commit d8f70c42519f492ae2c186774ee15979af622e55
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Sun Sep 30 13:17:22 2018 +0500

    collection-icon-view: Only call model.get_n_items() once
    
    This saves some time when binding model.

 src/ui/collection-icon-view.vala | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/src/ui/collection-icon-view.vala b/src/ui/collection-icon-view.vala
index 572a1784..686e2a01 100644
--- a/src/ui/collection-icon-view.vala
+++ b/src/ui/collection-icon-view.vala
@@ -45,7 +45,8 @@ private class Games.CollectionIconView : Gtk.Bin {
                        if (model == null)
                                return;
 
-                       for (int i = 0; i < model.get_n_items (); i++) {
+                       uint n_items = model.get_n_items ();
+                       for (uint i = 0; i < n_items; i++) {
                                var game = model.get_item (i) as Game;
                                add_game (game);
                        }


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