[gnome-maps/wip/mattiasb/dont_forin_traverse_arrays: 3/3] fixup! PlaceBubble: Refactor content population



commit 2faae4019e430f067ecd4149a3221da6a5f868c6
Author: Mattias Bengtsson <mattias jc bengtsson gmail com>
Date:   Fri Feb 17 23:07:58 2017 +0100

    fixup! PlaceBubble: Refactor content population
    
    Make the attach-code easier to read.
    
    Run `git rebase -i --autosquash HEAD~3` before pushing.

 src/placeBubble.js |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/placeBubble.js b/src/placeBubble.js
index 6ff9a9a..5a1449b 100644
--- a/src/placeBubble.js
+++ b/src/placeBubble.js
@@ -179,7 +179,6 @@ const PlaceBubble = new Lang.Class({
 
         expandedContent.forEach((function({ label, linkUrl, linkText, info },
                                           row) {
-            let col = 0;
             let widget;
 
             if (label) {
@@ -188,7 +187,7 @@ const PlaceBubble = new Lang.Class({
                                          use_markup: true,
                                          yalign: 0,
                                          halign: Gtk.Align.START });
-                this._expandedContent.attach(widget, col++, row, 1, 1);
+                this._expandedContent.attach(widget, 0, row, 1, 1);
             }
 
             if (linkUrl) {
@@ -207,7 +206,11 @@ const PlaceBubble = new Lang.Class({
                                      wrap: true,
                                      halign: Gtk.Align.START });
 
-            this._expandedContent.attach(widget, col, row, col == 0 ? 2 : 1, 1);
+            if(label)
+                this._expandedContent.attach(widget, 1, row, 1, 1);
+            else
+                // Expand over both columns if this row has no label
+                this._expandedContent.attach(widget, 0, row, 2, 1);
         }).bind(this));
     },
 


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