After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 633481 - AccountChooser filters should be asynchronous
AccountChooser filters should be asynchronous
Status: RESOLVED FIXED
Product: empathy
Classification: Core
Component: Accounts
unspecified
Other Linux
: Normal normal
: ---
Assigned To: empathy-maint
Depends on:
Blocks:
 
 
Reported: 2010-10-29 16:24 UTC by Vitaly Minko
Modified: 2010-11-15 09:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed fix (19.75 KB, patch)
2010-10-29 16:48 UTC, Vitaly Minko
reviewed Details | Review
new diff (22.07 KB, patch)
2010-11-11 08:44 UTC, Guillaume Desmottes
reviewed Details | Review

Description Vitaly Minko 2010-10-29 16:24:09 UTC
Steps to reproduce:
1. Launch empathy.
2. Select 'Room->Join'.
3. Wait until all accounts are connected.

Expected result:
All accounts which support multiuser text conversations are enabled.

Actual result:
Only 'People nearby' is enabled. User has to close and reopen the dialog manually to make the remaining accounts enabled.

Same issue is reproducible with 'Chat->New Conversation' and 'Chat->New Call'.

Problem description:
The issue is caused by empathy_account_chooser_filter_supports_multichat
(src/empathy-new-chatroom-dialog.c):

Despite of the fact that account connection is established and this condition is satisfied:
   if (tp_account_get_connection_status (account, NULL) !=
       TP_CONNECTION_STATUS_CONNECTED)

empathy_dispatcher_find_requestable_channel_classes returns null, because the object representing connection is not ready yet. This call should be replaced with the async version.
Comment 1 Vitaly Minko 2010-10-29 16:47:41 UTC
Fixed in
repo: git://vminko.org/empathy
branch: fix-633481
Comment 2 Vitaly Minko 2010-10-29 16:48:06 UTC
Created attachment 173496 [details] [review]
proposed fix
Comment 3 Guillaume Desmottes 2010-11-02 13:25:26 UTC
Review of attachment 173496 [details] [review]:

Thanks for the patch. empathy_dispatcher_find_requestable_channel_classes_async() has been removed in master (bug #632550). You should prepareTP_CONNECTION_FEATURE_CAPABILITIES and then use tp_connection_get_capabilities().
Comment 4 Vitaly Minko 2010-11-10 17:24:54 UTC
Fixed in fix-633481-v2
Comment 5 Guillaume Desmottes 2010-11-11 08:44:08 UTC
Created attachment 174231 [details] [review]
new diff
Comment 6 Guillaume Desmottes 2010-11-11 09:03:29 UTC
Review of attachment 174231 [details] [review]:

Thanks! The general logic seems good to me. Just some tweaks here and there to make things simpler/clearer.

::: libempathy-gtk/empathy-account-chooser.c
@@ +767,2 @@
 	g_object_unref (account);
+	g_free (iter);

gtk_tree_iter_free()

@@ +793,3 @@
+		return;
+
+	data = g_slice_new0 (FilterResultCallbackData);

For such struct, I usually like to have a _new() and _free() function; that makes things clearer.

@@ +795,3 @@
+	data = g_slice_new0 (FilterResultCallbackData);
+	data->chooser = chooser;
+	data->account = account;

It's generally a good idea to ref objects stored in data structs.

@@ +796,3 @@
+	data->account = account;
+	data->iter = g_memdup (iter, sizeof (GtkTreeIter));
+	g_free (iter);

Use gtk_tree_iter_copy()

::: libempathy-gtk/empathy-new-message-dialog.c
@@ +98,3 @@
+
+  caps = tp_connection_get_capabilities (TP_CONNECTION (conn));
+  classes = tp_capabilities_get_channel_classes (caps);

You can just use tp_capabilities_supports_text_chats()

::: src/empathy-new-chatroom-dialog.c
@@ +154,3 @@
+
+	caps = tp_connection_get_capabilities (TP_CONNECTION (conn));
+	classes = tp_capabilities_get_channel_classes (caps);

You can just use tp_capabilities_supports_text_chatrooms()
Comment 7 Vitaly Minko 2010-11-12 14:50:14 UTC
Fixed in the same branch.
Comment 8 Guillaume Desmottes 2010-11-15 09:12:20 UTC
Great; merged. Thanks !

This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.