Codebase list telepathy-glib / 15b8eea
add TpAccount:uri-schemes: property The property was missing for some reason. Guillaume Desmottes 11 years ago
2 changed file(s) with 56 addition(s) and 17 deletion(s). Raw diff Collapse all Expand all
180180 PROP_STORAGE_IDENTIFIER_VARIANT,
181181 PROP_STORAGE_RESTRICTIONS,
182182 PROP_SUPERSEDES,
183 PROP_URI_SCHEMES,
183184 N_PROPS
184185 };
185186
11481149 case PROP_SUPERSEDES:
11491150 g_value_set_boxed (value, self->priv->supersedes);
11501151 break;
1152 case PROP_URI_SCHEMES:
1153 g_value_set_boxed (value, self->priv->uri_schemes);
1154 break;
11511155 case PROP_AUTOMATIC_PRESENCE_TYPE:
11521156 g_value_set_uint (value, self->priv->auto_presence);
11531157 break;
20292033 G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
20302034
20312035 /**
2036 * TpAccount:uri-schemes:
2037 *
2038 * If the %TP_ACCOUNT_FEATURE_ADDRESSING feature has been prepared
2039 * successfully, a list of additional URI schemes for which this
2040 * account should be used if possible. Otherwise %NULL.
2041 *
2042 * For instance, a SIP or Skype account might have "tel" in this list if the
2043 * user would like to use that account to call phone numbers.
2044 *
2045 * This list should not contain the primary URI scheme(s) for the account's
2046 * protocol (for instance, "xmpp" for XMPP, or "sip" or "sips" for SIP),
2047 * since it should be assumed to be useful for those schemes in any case.
2048 *
2049 * Since: UNRELEASED
2050 */
2051 g_object_class_install_property (object_class, PROP_URI_SCHEMES,
2052 g_param_spec_boxed ("uri-schemes",
2053 "URISchemes",
2054 "URISchemes",
2055 G_TYPE_STRV,
2056 G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
2057
2058 /**
20322059 * TpAccount::status-changed:
20332060 * @account: the #TpAccount
20342061 * @old_status: old #TpAccount:connection-status
42244251 * tp_account_get_uri_schemes:
42254252 * @self: a #TpAccount
42264253 *
4227 * If the %TP_ACCOUNT_FEATURE_ADDRESSING feature has been prepared
4228 * successfully, return a list of additional URI schemes for which this
4229 * account should be used if possible. Otherwise return %NULL.
4230 *
4231 * For instance, a SIP or Skype account might have "tel" in this list if the
4232 * user would like to use that account to call phone numbers.
4233 *
4234 * This list should not contain the primary URI scheme(s) for the account's
4235 * protocol (for instance, "xmpp" for XMPP, or "sip" or "sips" for SIP),
4236 * since it should be assumed to be useful for those schemes in any case.
4237 *
4238 * Returns: (transfer none): a list of URI schemes, or %NULL
4254 * Return the #TpAccount:uri-schemes property
4255 *
4256 * Returns: (transfer none): the value of #TpAccount:uri_schemes property
42394257 *
42404258 * Since: 0.13.8
42414259 */
613613 }
614614
615615 static void
616 check_uri_schemes (const gchar * const * schemes)
617 {
618 g_assert (schemes != NULL);
619 g_assert (tp_strv_contains (schemes, "about"));
620 g_assert (tp_strv_contains (schemes, "telnet"));
621 g_assert (schemes[2] == NULL);
622 }
623
624 static void
625 notify_cb (GObject *object,
626 GParamSpec *spec,
627 Test *test)
628 {
629 g_main_loop_quit (test->mainloop);
630 }
631
632 static void
616633 test_addressing (Test *test,
617634 gconstpointer mode)
618635 {
619636 GQuark account_features[] = { TP_ACCOUNT_FEATURE_ADDRESSING, 0 };
620637 const gchar * const *schemes;
638 GStrv tmp;
621639
622640 test->account = tp_account_new (test->dbus, ACCOUNT_PATH, NULL);
623641 g_assert (test->account != NULL);
644662 g_main_loop_run (test->mainloop);
645663
646664 schemes = tp_account_get_uri_schemes (test->account);
647 g_assert (schemes != NULL);
648 g_assert (tp_strv_contains (schemes, "about"));
649 g_assert (tp_strv_contains (schemes, "telnet"));
650 g_assert (schemes[2] == NULL);
665 check_uri_schemes (schemes);
666
667 g_object_get (test->account,
668 "uri-schemes", &tmp,
669 NULL);
670
671 check_uri_schemes ((const gchar * const *) tmp);
672 g_strfreev (tmp);
651673
652674 g_assert (tp_account_associated_with_uri_scheme (test->account,
653675 "about"));
655677 "telnet"));
656678 g_assert (!tp_account_associated_with_uri_scheme (test->account,
657679 "xmpp"));
658
659680 }
660681
661682 static void