[gnome-contacts] misc: moved Center helper container to utilsc
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] misc: moved Center helper container to utilsc
- Date: Sat, 5 Apr 2014 17:43:35 +0000 (UTC)
commit 0dddb6e2764678eb78b6f9f155fa35ee82602ab8
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Fri Apr 4 22:56:40 2014 -0400
misc: moved Center helper container to utilsc
src/contacts-contact-pane.vala | 51 ----------------------------------------
src/contacts-utils.vala | 50 +++++++++++++++++++++++++++++++++++++++
2 files changed, 50 insertions(+), 51 deletions(-)
---
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index 97697d7..0b17cc5 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -43,57 +43,6 @@ namespace Contacts {
}
}
-public class Center : Bin {
- public int max_width { get; set; }
- public double xalign { get; set; }
-
- public Center () {
- this.xalign = 0.5;
- }
-
- public override void get_preferred_height (out int minimum_height, out int natural_height) {
- var child = get_child ();
- if (child != null) {
- int min;
- int nat;
- child.get_preferred_height (out min, out nat);
- minimum_height = min;
- natural_height = nat;
- } else {
- minimum_height = -1;
- natural_height = -1;
- }
- }
-
- public override void get_preferred_width (out int minimum_width, out int natural_width) {
- var child = get_child ();
- if (child != null) {
- int min;
- int nat;
- child.get_preferred_width (out min, out nat);
- minimum_width = min;
- natural_width = nat;
- } else {
- minimum_width = -1;
- natural_width = -1;
- }
- }
-
- public override void size_allocate (Gtk.Allocation allocation) {
- Gtk.Allocation new_alloc;
-
- set_allocation (allocation);
- new_alloc = allocation;
- if (allocation.width > this.max_width) {
- new_alloc.width = this.max_width;
- new_alloc.x = (int) ((allocation.width - this.max_width) * this.xalign) + allocation.x;
- }
-
- var child = get_child ();
- child.size_allocate (new_alloc);
- }
-}
-
public class Contacts.ContactPane : Notebook {
private Store contacts_store;
public Contact? contact;
diff --git a/src/contacts-utils.vala b/src/contacts-utils.vala
index defb81d..dad6139 100644
--- a/src/contacts-utils.vala
+++ b/src/contacts-utils.vala
@@ -37,6 +37,56 @@ namespace Contacts {
}
}
+public class Center : Bin {
+ public int max_width { get; set; }
+ public double xalign { get; set; }
+
+ public Center () {
+ this.xalign = 0.5;
+ }
+
+ public override void get_preferred_height (out int minimum_height, out int natural_height) {
+ var child = get_child ();
+ if (child != null) {
+ int min;
+ int nat;
+ child.get_preferred_height (out min, out nat);
+ minimum_height = min;
+ natural_height = nat;
+ } else {
+ minimum_height = -1;
+ natural_height = -1;
+ }
+ }
+
+ public override void get_preferred_width (out int minimum_width, out int natural_width) {
+ var child = get_child ();
+ if (child != null) {
+ int min;
+ int nat;
+ child.get_preferred_width (out min, out nat);
+ minimum_width = min;
+ natural_width = nat;
+ } else {
+ minimum_width = -1;
+ natural_width = -1;
+ }
+ }
+
+ public override void size_allocate (Gtk.Allocation allocation) {
+ Gtk.Allocation new_alloc;
+
+ set_allocation (allocation);
+ new_alloc = allocation;
+ if (allocation.width > this.max_width) {
+ new_alloc.width = this.max_width;
+ new_alloc.x = (int) ((allocation.width - this.max_width) * this.xalign) + allocation.x;
+ }
+
+ var child = get_child ();
+ child.size_allocate (new_alloc);
+ }
+}
public class Contacts.Utils : Object {
public static void compose_mail (string email) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]