Bug 32004 - TpAccount omits some properties, and doesn't notify for others
Summary: TpAccount omits some properties, and doesn't notify for others
Status: RESOLVED FIXED
Alias: None
Product: Telepathy
Classification: Unclassified
Component: tp-glib (show other bugs)
Version: git master
Hardware: Other All
: medium normal
Assignee: Simon McVittie
QA Contact: Telepathy bugs list
URL: http://git.collabora.co.uk/?p=user/sm...
Whiteboard: review+
Keywords: patch
Depends on:
Blocks:
 
Reported: 2010-11-30 10:15 UTC by Will Thompson
Modified: 2010-12-01 11:36 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Will Thompson 2010-11-30 10:15:03 UTC
I was just looking at mc-tool. It has some code to get NormalizedName and AutomaticPresence for accounts, because they're not exposed by TpAccount.

So then I looked at TpAccount. As far as I can tell, when RequestedPresence is updated, notify::requested-* is not emitted.
Comment 1 Simon McVittie 2010-12-01 05:21:09 UTC
This branch includes:

* a bugfix for the notification
* a set of getters/properties for AutomaticPresence, with notification
* a getter/property for NormalizedName, with notification
* an async setter for AutomaticPresence
* somewhat better (although still patchy) test coverage

It doesn't include a property or change notification for Parameters, which I notice only has a getter.
Comment 2 Simon McVittie 2010-12-01 05:22:13 UTC
For 0.12 I'm inclined to just change the documentation of requested-* to indicate that they don't actually have change notification, since this has been the case since before 0.10 and nobody noticed.
Comment 3 Will Thompson 2010-12-01 05:31:41 UTC
The unpacking would look nicer with tp_value_array_unpack... oh, that doesn't copy the values. Never mind.

+   * Since: 0.9.0
+   */
+  g_object_class_install_property (object_class, PROP_AUTOMATIC_PRESENCE_TYPE,
+      g_param_spec_uint ("automatic-presence-type",

The Since: annotation lies!

The rest of my comments are nitpicks; I don't mind if they're changed or not.

+  GSimpleAsyncResult *simple;
+
+  g_return_val_if_fail (TP_IS_ACCOUNT (account), FALSE);
+  g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (result), FALSE);
+
+  simple = G_SIMPLE_ASYNC_RESULT (result);
+
+  if (g_simple_async_result_propagate_error (simple, error))
+    return FALSE;
+
+  g_return_val_if_fail (g_simple_async_result_is_valid (result,
+          G_OBJECT (account), tp_account_set_automatic_presence_async), FALSE);
+
+  return TRUE;

_tp_implement_finish_void() ?

+  g_value_init (&value, TP_STRUCT_TYPE_SIMPLE_PRESENCE);
+  g_value_take_boxed (&value, dbus_g_type_specialized_construct (
+          TP_STRUCT_TYPE_SIMPLE_PRESENCE));
+  arr = (GValueArray *) g_value_get_boxed (&value);
+
+  g_value_set_uint (arr->values, type);
+  g_value_set_static_string (arr->values + 1, status);
+  g_value_set_static_string (arr->values + 2, message);

Might be nicer as tp_value_array_build(). No big deal though.
Comment 4 Simon McVittie 2010-12-01 06:13:52 UTC
All fixed. I didn't make the corresponding changes to TpAccount's existing async methods, since basically none of them are tested...
Comment 5 Simon McVittie 2010-12-01 11:36:17 UTC
Fixed in git for 0.13.8


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.