telepathy-glib: add TpAccount:uri-schemes: property

Guillaume Desmottes gdesmott at kemper.freedesktop.org
Wed Jan 9 05:05:20 PST 2013


Module: telepathy-glib
Branch: master
Commit: 15b8eea5133e683ac14c79734dfbea6747af6e5f
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=15b8eea5133e683ac14c79734dfbea6747af6e5f

Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date:   Mon Jan  7 17:07:50 2013 +0100

add TpAccount:uri-schemes: property

The property was missing for some reason.

---

 telepathy-glib/account.c |   40 +++++++++++++++++++++++++++++-----------
 tests/dbus/account.c     |   31 ++++++++++++++++++++++++++-----
 2 files changed, 55 insertions(+), 16 deletions(-)

diff --git a/telepathy-glib/account.c b/telepathy-glib/account.c
index 026ad46..c49699c 100644
--- a/telepathy-glib/account.c
+++ b/telepathy-glib/account.c
@@ -181,6 +181,7 @@ enum {
   PROP_STORAGE_IDENTIFIER_VARIANT,
   PROP_STORAGE_RESTRICTIONS,
   PROP_SUPERSEDES,
+  PROP_URI_SCHEMES,
   N_PROPS
 };
 
@@ -1149,6 +1150,9 @@ _tp_account_get_property (GObject *object,
     case PROP_SUPERSEDES:
       g_value_set_boxed (value, self->priv->supersedes);
       break;
+    case PROP_URI_SCHEMES:
+      g_value_set_boxed (value, self->priv->uri_schemes);
+      break;
     case PROP_AUTOMATIC_PRESENCE_TYPE:
       g_value_set_uint (value, self->priv->auto_presence);
       break;
@@ -2030,6 +2034,29 @@ tp_account_class_init (TpAccountClass *klass)
         G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
 
   /**
+   * TpAccount:uri-schemes:
+   *
+   * If the %TP_ACCOUNT_FEATURE_ADDRESSING feature has been prepared
+   * successfully, a list of additional URI schemes for which this
+   * account should be used if possible. Otherwise %NULL.
+   *
+   * For instance, a SIP or Skype account might have "tel" in this list if the
+   * user would like to use that account to call phone numbers.
+   *
+   * This list should not contain the primary URI scheme(s) for the account's
+   * protocol (for instance, "xmpp" for XMPP, or "sip" or "sips" for SIP),
+   * since it should be assumed to be useful for those schemes in any case.
+   *
+   * Since: UNRELEASED
+   */
+  g_object_class_install_property (object_class, PROP_URI_SCHEMES,
+      g_param_spec_boxed ("uri-schemes",
+        "URISchemes",
+        "URISchemes",
+        G_TYPE_STRV,
+        G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
+
+  /**
    * TpAccount::status-changed:
    * @account: the #TpAccount
    * @old_status: old #TpAccount:connection-status
@@ -4225,18 +4252,9 @@ tp_account_prepare_addressing_async (TpProxy *proxy,
  * tp_account_get_uri_schemes:
  * @self: a #TpAccount
  *
- * If the %TP_ACCOUNT_FEATURE_ADDRESSING feature has been prepared
- * successfully, return a list of additional URI schemes for which this
- * account should be used if possible. Otherwise return %NULL.
- *
- * For instance, a SIP or Skype account might have "tel" in this list if the
- * user would like to use that account to call phone numbers.
- *
- * This list should not contain the primary URI scheme(s) for the account's
- * protocol (for instance, "xmpp" for XMPP, or "sip" or "sips" for SIP),
- * since it should be assumed to be useful for those schemes in any case.
+ * Return the #TpAccount:uri-schemes property
  *
- * Returns: (transfer none): a list of URI schemes, or %NULL
+ * Returns: (transfer none): the value of #TpAccount:uri_schemes property
  *
  * Since: 0.13.8
  */
diff --git a/tests/dbus/account.c b/tests/dbus/account.c
index 3fb54b4..dc27ac1 100644
--- a/tests/dbus/account.c
+++ b/tests/dbus/account.c
@@ -614,11 +614,29 @@ test_storage (Test *test,
 }
 
 static void
+check_uri_schemes (const gchar * const * schemes)
+{
+  g_assert (schemes != NULL);
+  g_assert (tp_strv_contains (schemes, "about"));
+  g_assert (tp_strv_contains (schemes, "telnet"));
+  g_assert (schemes[2] == NULL);
+}
+
+static void
+notify_cb (GObject *object,
+    GParamSpec *spec,
+    Test *test)
+{
+  g_main_loop_quit (test->mainloop);
+}
+
+static void
 test_addressing (Test *test,
     gconstpointer mode)
 {
   GQuark account_features[] = { TP_ACCOUNT_FEATURE_ADDRESSING, 0 };
   const gchar * const *schemes;
+  GStrv tmp;
 
   test->account = tp_account_new (test->dbus, ACCOUNT_PATH, NULL);
   g_assert (test->account != NULL);
@@ -645,10 +663,14 @@ test_addressing (Test *test,
   g_main_loop_run (test->mainloop);
 
   schemes = tp_account_get_uri_schemes (test->account);
-  g_assert (schemes != NULL);
-  g_assert (tp_strv_contains (schemes, "about"));
-  g_assert (tp_strv_contains (schemes, "telnet"));
-  g_assert (schemes[2] == NULL);
+  check_uri_schemes (schemes);
+
+  g_object_get (test->account,
+      "uri-schemes", &tmp,
+      NULL);
+
+  check_uri_schemes ((const gchar * const *) tmp);
+  g_strfreev (tmp);
 
   g_assert (tp_account_associated_with_uri_scheme (test->account,
         "about"));
@@ -656,7 +678,6 @@ test_addressing (Test *test,
         "telnet"));
   g_assert (!tp_account_associated_with_uri_scheme (test->account,
         "xmpp"));
-
 }
 
 static void



More information about the telepathy-commits mailing list