[shotwell] Minor code clean-up



commit 1fcf02d85173efc5c58519bcf99ee22961547564
Author: Jens Georg <mail jensge org>
Date:   Sat Feb 23 19:25:09 2019 +0100

    Minor code clean-up

 src/MapWidget.vala | 40 +++++++++++++++++++++-------------------
 1 file changed, 21 insertions(+), 19 deletions(-)
---
diff --git a/src/MapWidget.vala b/src/MapWidget.vala
index 25fbb12c..3b41a5f5 100644
--- a/src/MapWidget.vala
+++ b/src/MapWidget.vala
@@ -503,32 +503,34 @@ private class MapWidget : Gtk.Bin {
 
         bool did_adjust_view = false;
         foreach (var m in ms) {
-            if (m.view is CheckerboardItem) {
-                CheckerboardItem item = (CheckerboardItem) m.view;
+            if (!(m.view is CheckerboardItem)) {
+                continue;
+            }
 
-                if (!did_adjust_view) {
-                    // if first item is in any way out of view, scroll to it
-                    Gtk.Adjustment vadj = page.get_vadjustment();
+            CheckerboardItem item = m.view as CheckerboardItem;
 
-                    if (!(get_adjustment_relation(vadj, item.allocation.y) == AdjustmentRelation.IN_RANGE
-                        && (get_adjustment_relation(vadj, item.allocation.y + item.allocation.height) == 
AdjustmentRelation.IN_RANGE))) {
+            if (!did_adjust_view) {
+                // if first item is in any way out of view, scroll to it
+                Gtk.Adjustment vadj = page.get_vadjustment();
 
-                        // scroll to see the new item
-                        int top = 0;
-                        if (item.allocation.y < vadj.get_value()) {
-                            top = item.allocation.y;
-                            top -= CheckerboardLayout.ROW_GUTTER_PADDING / 2;
-                        } else {
-                            top = item.allocation.y + item.allocation.height - (int) vadj.get_page_size();
-                            top += CheckerboardLayout.ROW_GUTTER_PADDING / 2;
-                        }
+                if (!(get_adjustment_relation(vadj, item.allocation.y) == AdjustmentRelation.IN_RANGE
+                      && (get_adjustment_relation(vadj, item.allocation.y + item.allocation.height) == 
AdjustmentRelation.IN_RANGE))) {
 
-                        vadj.set_value(top);
+                    // scroll to see the new item
+                    int top = 0;
+                    if (item.allocation.y < vadj.get_value()) {
+                        top = item.allocation.y;
+                        top -= CheckerboardLayout.ROW_GUTTER_PADDING / 2;
+                    } else {
+                        top = item.allocation.y + item.allocation.height - (int) vadj.get_page_size();
+                        top += CheckerboardLayout.ROW_GUTTER_PADDING / 2;
                     }
-                    did_adjust_view = true;
+
+                    vadj.set_value(top);
                 }
-                item.brighten();
+                did_adjust_view = true;
             }
+            item.brighten();
         }
     }
 


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