[gnome-contacts/new-design] Split out row to its own file



commit 6f87cb1a9a2fcfe807bf428c8bfcbe63b4e21920
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Dec 8 11:17:56 2011 +0100

    Split out row to its own file

 src/Makefile.am                |    1 +
 src/contacts-contact-pane.vala |   66 ------------------------------
 src/contacts-row.vala          |   86 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 87 insertions(+), 66 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index b18d9bd..b38c8c4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -26,6 +26,7 @@ vala_sources = \
 	contacts-link-dialog.vala \
 	contacts-linking.vala \
 	contacts-menu-button.vala \
+	contacts-row.vala \
 	contacts-store.vala \
 	contacts-view.vala \
 	contacts-utils.vala \
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index b8b2b9b..1b45ad0 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -413,72 +413,6 @@ public class Contacts.AvatarMenu : Menu {
   }
 }
 
-public class Contacts.ContactRow : Grid {
-  public Alignment left;
-  public Grid content;
-  public Alignment right;
-  int start;
-
-  public ContactRow (ContactPane pane) {
-    this.set_orientation (Orientation.HORIZONTAL);
-    this.set_column_spacing (8);
-
-    this.set_hexpand (true);
-    this.set_vexpand (false);
-
-    left = new Alignment (1,0,0,0);
-    left.set_hexpand (true);
-    pane.border_size_group.add_widget (left);
-
-    content = new Grid ();
-    content.set_size_request (450, -1);
-
-    right = new Alignment (0,0,0,0);
-    right.set_hexpand (true);
-    pane.border_size_group.add_widget (right);
-
-    this.attach (left, 0, 0, 1, 1);
-    this.attach (content, 1, 0, 1, 1);
-    this.attach (right, 2, 0, 1, 1);
-    this.show_all ();
-  }
-
-  public void pack_start (Widget w, Align align = Align.START) {
-    content.attach (w, 0, start++, 1, 1);
-    w.set_hexpand (true);
-    w.set_halign (align);
-  }
-
-  public void pack_end (Widget w) {
-    content.attach (w, 1, 0, 1, 1);
-    w.set_hexpand (false);
-    w.set_halign (Align.END);
-  }
-
-  public void label (string s) {
-    var l = new Label (s);
-    l.get_style_context ().add_class ("dim-label");
-    pack_start (l);
-  }
-
-  public void text (string s, bool wrap = false) {
-    var l = new Label (s);
-    if (wrap) {
-      l.set_line_wrap (true);
-      l.set_line_wrap_mode (Pango.WrapMode.WORD_CHAR);
-    } else {
-      l.set_ellipsize (Pango.EllipsizeMode.END);
-    }
-    pack_start (l);
-  }
-
-  public void detail (string s) {
-    var l = new Label (s);
-    l.get_style_context ().add_class ("dim-label");
-    pack_end (l);
-  }
-}
-
 public class Contacts.PersonaSheet : Grid {
   ContactPane pane;
   Persona persona;
diff --git a/src/contacts-row.vala b/src/contacts-row.vala
new file mode 100644
index 0000000..ac51dc4
--- /dev/null
+++ b/src/contacts-row.vala
@@ -0,0 +1,86 @@
+/* -*- Mode: vala; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 8 -*- */
+/*
+ * Copyright (C) 2011 Alexander Larsson <alexl redhat com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+using Gtk;
+
+public class Contacts.ContactRow : Grid {
+  public Alignment left;
+  public Grid content;
+  public Alignment right;
+  int start;
+
+  public ContactRow (ContactPane pane) {
+    this.set_orientation (Orientation.HORIZONTAL);
+    this.set_column_spacing (8);
+
+    this.set_hexpand (true);
+    this.set_vexpand (false);
+
+    left = new Alignment (1,0,0,0);
+    left.set_hexpand (true);
+    pane.border_size_group.add_widget (left);
+
+    content = new Grid ();
+    content.set_size_request (450, -1);
+
+    right = new Alignment (0,0,0,0);
+    right.set_hexpand (true);
+    pane.border_size_group.add_widget (right);
+
+    this.attach (left, 0, 0, 1, 1);
+    this.attach (content, 1, 0, 1, 1);
+    this.attach (right, 2, 0, 1, 1);
+    this.show_all ();
+  }
+
+  public void pack_start (Widget w, Align align = Align.START) {
+    content.attach (w, 0, start++, 1, 1);
+    w.set_hexpand (true);
+    w.set_halign (align);
+  }
+
+  public void pack_end (Widget w) {
+    content.attach (w, 1, 0, 1, 1);
+    w.set_hexpand (false);
+    w.set_halign (Align.END);
+  }
+
+  public void label (string s) {
+    var l = new Label (s);
+    l.get_style_context ().add_class ("dim-label");
+    pack_start (l);
+  }
+
+  public void text (string s, bool wrap = false) {
+    var l = new Label (s);
+    if (wrap) {
+      l.set_line_wrap (true);
+      l.set_line_wrap_mode (Pango.WrapMode.WORD_CHAR);
+    } else {
+      l.set_ellipsize (Pango.EllipsizeMode.END);
+    }
+    pack_start (l);
+  }
+
+  public void detail (string s) {
+    var l = new Label (s);
+    l.get_style_context ().add_class ("dim-label");
+    pack_end (l);
+  }
+}
+



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