[folks] folks-inspect: handle Structured Names



commit 986cd0293f51aa47aa6c3af741d448b05769de1b
Author: Raul Gutierrez Segales <raul gutierrez segales collabora co uk>
Date:   Fri Mar 11 13:54:03 2011 -0800

    folks-inspect: handle Structured Names
    
    Fixes: bgo#644457 - Handle structured names

 NEWS                     |    1 +
 folks/name-details.vala  |   21 ++++++++++++++++++++-
 tools/inspect/utils.vala |    8 ++++++++
 3 files changed, 29 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index 55a0acd..265b44d 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,7 @@ Bugs fixed:
 * Bug 643954 â?? Add to_string () to PostalAddress class
 * Bug 643955 â?? Add to_string () to RoleOwner class
 * Bug 643957 â?? Deal handle birthday and postal-addresses.
+* Bug 644457 â?? Handle structured names
 
 API changes:
 * Add RoleDetails interface
diff --git a/folks/name-details.vala b/folks/name-details.vala
index f4a42ad..7e6ce76 100644
--- a/folks/name-details.vala
+++ b/folks/name-details.vala
@@ -15,7 +15,8 @@
  * along with this library.  If not, see <http://www.gnu.org/licenses/>.
  *
  * Authors:
- *       Marco Barisione <marco barisione collabora co u>
+ *       Marco Barisione <marco barisione collabora co uk>
+ *       Raul Gutierrez Segales <raul gutierrez segales collabora co uk>
  */
 
 using GLib;
@@ -162,6 +163,24 @@ public class Folks.StructuredName : Object
              this._prefixes         == "" &&
              this._suffixes         == "";
     }
+
+  /**
+   * Formatted version of the structured name.
+   *
+   * @since 0.3.UNRELEASED
+   */
+  public string to_string ()
+    {
+      /* Translators: format for the formatted structured name.
+       * Parameters (in order) are: prefixes (for the name), given name,
+       * family name, additional names and (name) suffixes */
+      var str = "%s, %s, %s, %s, %s";
+      return str.printf (this.prefixes,
+          this.given_name,
+          this.family_name,
+          this.additional_names,
+          this.suffixes);
+    }
 }
 
 /**
diff --git a/tools/inspect/utils.vala b/tools/inspect/utils.vala
index f974851..12e3b17 100644
--- a/tools/inspect/utils.vala
+++ b/tools/inspect/utils.vala
@@ -341,6 +341,14 @@ private class Folks.Inspect.Utils
 
             return output_string;
         }
+      else if (prop_name == "structured-name")
+        {
+          unowned StructuredName sn = (StructuredName) prop_value.get_object ();
+          string ret = null;
+          if (sn != null)
+            ret = sn.to_string ();
+          return ret;
+        }
 
       return Utils.transform_value_to_string (prop_value);
     }



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