Display second phone number if the first one is not available
authorPhilipp Zabel <philipp.zabel@gmail.com>
Fri, 2 Jul 2010 16:22:42 +0000 (18:22 +0200)
committerPhilipp Zabel <philipp.zabel@gmail.com>
Fri, 2 Jul 2010 16:22:42 +0000 (18:22 +0200)
src/beifahrer-cli.vala
src/lift-detail-window.vala

index aefa372..5ee78c8 100644 (file)
@@ -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 ();
index b621417..a61231c 100644 (file)
@@ -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) {