diff --git a/telepathy-glib.changes b/telepathy-glib.changes index 08e8ac0..7f81086 100644 --- a/telepathy-glib.changes +++ b/telepathy-glib.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Sun Jan 13 16:18:16 UTC 2013 - zaitor@opensuse.org + +- Add tg-add-TpAccount-uri-schemes-property.patch, + tg-implement-change-notification-on-uri-schemes-property.patch + and tg-tests-simple-account-add-uri.patch, needed to ensure + visual feedback on sip accounts changes (fdo#40393). + ------------------------------------------------------------------- Tue Nov 13 09:58:30 UTC 2012 - dimstar@opensuse.org diff --git a/telepathy-glib.spec b/telepathy-glib.spec index b07f89b..c3f945d 100644 --- a/telepathy-glib.spec +++ b/telepathy-glib.spec @@ -1,7 +1,7 @@ # # spec file for package telepathy-glib # -# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,6 +24,12 @@ License: LGPL-2.1+ Group: Development/Languages/C and C++ Url: http://telepathy.freedesktop.org/ Source: http://telepathy.freedesktop.org/releases/telepathy-glib/%{name}-%{version}.tar.gz +# PATCHFIX-UPSTREAM tg-tests-simple-account-add-uri.patch fdo#40393 -- Changes made to sipaccounts does not appear. +Patch0: tg-tests-simple-account-add-uri.patch +# PATCHFIX-UPSTREAM tg-add-TpAccount-uri-schemes-property.patch fdo#40393 -- Changes made to sipaccounts does not appear. +Patch1: tg-add-TpAccount-uri-schemes-property.patch +# PATCHFIX-UPSTREAM tg-implement-change-notification-on-uri-schemes-property.patch fdo#40393 -- Changes made to sipaccounts does not appear. +Patch2: tg-implement-change-notification-on-uri-schemes-property.patch BuildRequires: gtk-doc >= 1.17 BuildRequires: libxslt-devel BuildRequires: python-xml @@ -82,7 +88,9 @@ Telepathy D-Bus API. %prep %setup -q - +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 %build %configure --disable-static \ --enable-vala-bindings diff --git a/tg-add-TpAccount-uri-schemes-property.patch b/tg-add-TpAccount-uri-schemes-property.patch new file mode 100644 index 0000000..b2fa1fe --- /dev/null +++ b/tg-add-TpAccount-uri-schemes-property.patch @@ -0,0 +1,143 @@ +From 15b8eea5133e683ac14c79734dfbea6747af6e5f Mon Sep 17 00:00:00 2001 +From: Guillaume Desmottes +Date: Mon, 07 Jan 2013 16:07:50 +0000 +Subject: add TpAccount:uri-schemes: property + +The property was missing for some reason. +--- +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 +-- +cgit v0.9.0.2-2-gbebe diff --git a/tg-implement-change-notification-on-uri-schemes-property.patch b/tg-implement-change-notification-on-uri-schemes-property.patch new file mode 100644 index 0000000..d9fddc1 --- /dev/null +++ b/tg-implement-change-notification-on-uri-schemes-property.patch @@ -0,0 +1,120 @@ +From 18dd2cc616621f796bf1d1987e55b51eedca00b8 Mon Sep 17 00:00:00 2001 +From: Guillaume Desmottes +Date: Mon, 07 Jan 2013 16:29:45 +0000 +Subject: TpAccount: implement change notification on uri-schemes property + +--- +diff --git a/telepathy-glib/account.c b/telepathy-glib/account.c +index c49699c..3b4d44f 100644 +--- a/telepathy-glib/account.c ++++ b/telepathy-glib/account.c +@@ -1020,6 +1020,42 @@ _tp_account_got_all_cb (TpProxy *proxy, + } + + static void ++addressing_props_changed (TpAccount *self, ++ GHashTable *changed_properties) ++{ ++ const gchar * const * v; ++ ++ if (self->priv->uri_schemes == NULL) ++ /* We did not fetch the initial value yet, ignoring */ ++ return; ++ ++ v = tp_asv_get_strv (changed_properties, "URISchemes"); ++ if (v == NULL) ++ return; ++ ++ g_strfreev (self->priv->uri_schemes); ++ self->priv->uri_schemes = g_strdupv ((GStrv) v); ++ ++ g_object_notify (G_OBJECT (self), "uri-schemes"); ++} ++ ++static void ++dbus_properties_changed_cb (TpProxy *proxy, ++ const gchar *interface_name, ++ GHashTable *changed_properties, ++ const gchar **invalidated_properties, ++ gpointer user_data, ++ GObject *weak_object) ++{ ++ TpAccount *self = TP_ACCOUNT (weak_object); ++ ++ if (!tp_strdiff (interface_name, TP_IFACE_ACCOUNT_INTERFACE_ADDRESSING)) ++ { ++ addressing_props_changed (self, changed_properties); ++ } ++} ++ ++static void + _tp_account_constructed (GObject *object) + { + TpAccount *self = TP_ACCOUNT (object); +@@ -1059,6 +1095,9 @@ _tp_account_constructed (GObject *object) + tp_cli_account_connect_to_account_property_changed (self, + _tp_account_properties_changed, NULL, NULL, object, NULL); + ++ tp_cli_dbus_properties_connect_to_properties_changed (self, ++ dbus_properties_changed_cb, NULL, NULL, object, NULL); ++ + tp_cli_dbus_properties_call_get_all (self, -1, TP_IFACE_ACCOUNT, + _tp_account_got_all_cb, NULL, NULL, G_OBJECT (self)); + } +@@ -2047,6 +2086,9 @@ tp_account_class_init (TpAccountClass *klass) + * 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. + * ++ * The notify::uri-schemes signal cannot be relied on if the Account Manager ++ * is Mission Control version 5.14.0 or older. ++ * + * Since: UNRELEASED + */ + g_object_class_install_property (object_class, PROP_URI_SCHEMES, +diff --git a/tests/dbus/account.c b/tests/dbus/account.c +index dc27ac1..b921f40 100644 +--- a/tests/dbus/account.c ++++ b/tests/dbus/account.c +@@ -678,6 +678,15 @@ test_addressing (Test *test, + "telnet")); + g_assert (!tp_account_associated_with_uri_scheme (test->account, + "xmpp")); ++ ++ g_signal_connect (test->account, "notify::uri-schemes", ++ G_CALLBACK (notify_cb), test); ++ ++ tp_tests_simple_account_add_uri_scheme (test->account_service, "xmpp"); ++ g_main_loop_run (test->mainloop); ++ ++ g_assert (tp_account_associated_with_uri_scheme (test->account, ++ "xmpp")); + } + + static void +diff --git a/tests/lib/simple-account.c b/tests/lib/simple-account.c +index 892e0e5..dc09120 100644 +--- a/tests/lib/simple-account.c ++++ b/tests/lib/simple-account.c +@@ -603,5 +603,20 @@ void + tp_tests_simple_account_add_uri_scheme (TpTestsSimpleAccount *self, + const gchar *uri_scheme) + { ++ GHashTable *changed; ++ GStrv schemes; ++ + g_ptr_array_add (self->priv->uri_schemes, g_strdup (uri_scheme)); ++ ++ g_object_get (self, "uri-schemes", &schemes, NULL); ++ ++ changed = tp_asv_new ( ++ "URISchemes", G_TYPE_STRV, schemes, ++ NULL); ++ ++ tp_svc_dbus_properties_emit_properties_changed (self, ++ TP_IFACE_ACCOUNT_INTERFACE_ADDRESSING, changed, NULL); ++ ++ g_strfreev (schemes); ++ g_hash_table_unref (changed); + } +-- +cgit v0.9.0.2-2-gbebe diff --git a/tg-tests-simple-account-add-uri.patch b/tg-tests-simple-account-add-uri.patch new file mode 100644 index 0000000..b94a531 --- /dev/null +++ b/tg-tests-simple-account-add-uri.patch @@ -0,0 +1,105 @@ +From 16578d4864f04d26c05c94dbd4c6035ba728d55c Mon Sep 17 00:00:00 2001 +From: Guillaume Desmottes +Date: Mon, 07 Jan 2013 15:57:04 +0000 +Subject: simple-account: add tp_tests_simple_account_add_uri_scheme() + +--- +diff --git a/tests/lib/simple-account.c b/tests/lib/simple-account.c +index 6279d75..892e0e5 100644 +--- a/tests/lib/simple-account.c ++++ b/tests/lib/simple-account.c +@@ -80,6 +80,7 @@ struct _TpTestsSimpleAccountPrivate + gchar *presence_msg; + gchar *connection_path; + gboolean enabled; ++ GPtrArray *uri_schemes; + }; + + static void +@@ -122,10 +123,14 @@ account_iface_init (gpointer klass, + #undef IMPLEMENT + } + ++/* you may have noticed this is not entirely realistic */ ++static const gchar * const uri_schemes[] = { "about", "telnet", NULL }; + + static void + tp_tests_simple_account_init (TpTestsSimpleAccount *self) + { ++ guint i; ++ + self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, TP_TESTS_TYPE_SIMPLE_ACCOUNT, + TpTestsSimpleAccountPrivate); + +@@ -134,10 +139,11 @@ tp_tests_simple_account_init (TpTestsSimpleAccount *self) + self->priv->presence_msg = g_strdup ("this is my CurrentPresence"); + self->priv->connection_path = g_strdup ("/"); + self->priv->enabled = TRUE; +-} + +-/* you may have noticed this is not entirely realistic */ +-static const gchar * const uri_schemes[] = { "about", "telnet", NULL }; ++ self->priv->uri_schemes = g_ptr_array_new_with_free_func (g_free); ++ for (i = 0; uri_schemes[i] != NULL; i++) ++ g_ptr_array_add (self->priv->uri_schemes, g_strdup (uri_schemes[i])); ++} + + static void + tp_tests_simple_account_get_property (GObject *object, +@@ -231,7 +237,19 @@ tp_tests_simple_account_get_property (GObject *object, + TP_STORAGE_RESTRICTION_FLAG_CANNOT_SET_PARAMETERS); + break; + case PROP_URI_SCHEMES: +- g_value_set_boxed (value, uri_schemes); ++ { ++ GPtrArray *arr; ++ guint i; ++ ++ arr = g_ptr_array_sized_new (self->priv->uri_schemes->len + 1); ++ for (i = 0; i < self->priv->uri_schemes->len; i++) ++ g_ptr_array_add (arr, ++ g_ptr_array_index (self->priv->uri_schemes, i)); ++ g_ptr_array_add (arr, NULL); ++ ++ g_value_set_boxed (value, arr->pdata); ++ g_ptr_array_unref (arr); ++ } + break; + case PROP_AVATAR: + { +@@ -274,6 +292,8 @@ tp_tests_simple_account_finalize (GObject *object) + g_free (self->priv->presence_msg); + g_free (self->priv->connection_path); + ++ g_ptr_array_unref (self->priv->uri_schemes); ++ + G_OBJECT_CLASS (tp_tests_simple_account_parent_class)->finalize (object); + } + +@@ -578,3 +598,10 @@ tp_tests_simple_account_set_enabled (TpTestsSimpleAccount *self, + tp_svc_account_emit_account_property_changed (self, change); + g_hash_table_unref (change); + } ++ ++void ++tp_tests_simple_account_add_uri_scheme (TpTestsSimpleAccount *self, ++ const gchar *uri_scheme) ++{ ++ g_ptr_array_add (self->priv->uri_schemes, g_strdup (uri_scheme)); ++} +diff --git a/tests/lib/simple-account.h b/tests/lib/simple-account.h +index 2ce3efd..b8547bd 100644 +--- a/tests/lib/simple-account.h ++++ b/tests/lib/simple-account.h +@@ -64,6 +64,9 @@ void tp_tests_simple_account_removed (TpTestsSimpleAccount *self); + void tp_tests_simple_account_set_enabled (TpTestsSimpleAccount *self, + gboolean enabled); + ++void tp_tests_simple_account_add_uri_scheme (TpTestsSimpleAccount *self, ++ const gchar * uri_scheme); ++ + G_END_DECLS + + #endif /* #ifndef __TP_TESTS_SIMPLE_ACCOUNT_H__ */ +-- +cgit v0.9.0.2-2-gbebe