From 979ba6ddc04b593a8e6275e04b88352e36c2d498 Mon Sep 17 00:00:00 2001 From: Philipp Zabel Date: Fri, 2 Jul 2010 18:22:42 +0200 Subject: [PATCH] Display second phone number if the first one is not available --- src/beifahrer-cli.vala | 11 ++++++++++- src/lift-detail-window.vala | 5 +++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/beifahrer-cli.vala b/src/beifahrer-cli.vala index aefa372..5ee78c8 100644 --- a/src/beifahrer-cli.vala +++ b/src/beifahrer-cli.vala @@ -66,7 +66,16 @@ async void get_details (string href) { print ("\tvia %s\n", via); } - print ("Driver: %s (%s)\n", lift.name, lift.phone); + string phone; + if (lift.cell != null) + phone = lift.cell; + else if (lift.phone != null) + phone = lift.phone; + else if (lift.phone2 == null) + phone = lift.phone2; + else + phone = ""; + print ("Driver: %s (%s)\n", lift.name, phone); print ("Description:\n%s\n", lift.description); loop.quit (); diff --git a/src/lift-detail-window.vala b/src/lift-detail-window.vala index b621417..a61231c 100644 --- a/src/lift-detail-window.vala +++ b/src/lift-detail-window.vala @@ -190,6 +190,11 @@ public class LiftDetailWindow : StackableWindow { string phone_number = E.normalize_phone_number (lift.phone); button_phone.value = phone_number; button_sms.value = phone_number; + } else if (lift.phone2 != null) { + button_phone.title = _("Phone"); + string phone_number = E.normalize_phone_number (lift.phone2); + button_phone.value = phone_number; + button_sms.value = phone_number; } if (lift.email_image_uri != null) { -- 1.7.9.5