Dominique Leuenberger
821e049a86
This is needed for the bugfix in empathy 3.6.3 to have full effect. If we want or not for 12.3 is debateble. OBS-URL: https://build.opensuse.org/request/show/148311 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/telepathy-glib?expand=0&rev=142
121 lines
3.7 KiB
Diff
121 lines
3.7 KiB
Diff
From 18dd2cc616621f796bf1d1987e55b51eedca00b8 Mon Sep 17 00:00:00 2001
|
|
From: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
|
|
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
|