[gnome-contacts] Add Utils.grid_insert_row_after



commit 2dd9888ca4022ea3eca42c64366fc828eee0eab6
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Jul 1 10:41:11 2011 +0200

    Add Utils.grid_insert_row_after
    
    This is needed to insert things in the middle of a grid

 src/contacts-utils.vala |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/contacts-utils.vala b/src/contacts-utils.vala
index f674010..faacbc1 100644
--- a/src/contacts-utils.vala
+++ b/src/contacts-utils.vala
@@ -56,4 +56,24 @@ public class Contacts.Utils : Object {
     mi.show ();
     return mi;
   }
+
+  public static void grid_insert_row_after (Grid grid, Widget widget, bool expand_intersecting) {
+    int y, h;
+    grid.child_get (widget,
+		    "top-attach", out y,
+		    "height", out h);
+    int start = y + h;
+    foreach (var child in grid.get_children ()) {
+      grid.child_get (child,
+		      "top-attach", out y,
+		      "height", out h);
+      if (y >= start) {
+	grid.child_set (child,
+			"top-attach", y + 1);
+      } else if (y + h > start && expand_intersecting) {
+	grid.child_set (child,
+			"height", h + 1);
+      }
+    }
+  }
 }



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