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 643295 - EmpathyChat shouldn't call empathy_chat_window_find_chat
EmpathyChat shouldn't call empathy_chat_window_find_chat
Status: RESOLVED FIXED
Product: empathy
Classification: Core
Component: Chat
unspecified
Other Linux
: Normal normal
: ---
Assigned To: empathy-maint
Depends on:
Blocks: 643755
 
 
Reported: 2011-02-25 14:22 UTC by Guillaume Desmottes
Modified: 2011-05-13 14:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Destroy password infobar on parting password protected chatrooms (4.43 KB, patch)
2011-05-06 08:19 UTC, Guillaume Desmottes
reviewed Details | Review

Description Guillaume Desmottes 2011-02-25 14:22:50 UTC
EmpathyChat lives in libempathy-gtk and so shouldn't use empathy_chat_window_find_chat() which is defined in src/.

A way to solve this would be to fire a signal in chat_command_part and let chat-window handle the command.
Comment 1 Chandni Verma 2011-02-27 23:51:00 UTC
1) Part command dealing function shifted to src/empathy-chat-window
2) Corrected the reason message being send for default chatroom and added a DEBUG    
   message.

branch: http://gitorious.org/glassrose-gnome/empathy/commits/moving-part-functionality-to-empathy-chat-window-643295
Comment 2 Guillaume Desmottes 2011-02-28 09:30:22 UTC
I think you should use G_TYPE_STRV instead of G_TYPE_POINTER in the signal definition.

Please remove the #include "src/..." in EmpathyChat.


		message = g_strconcat(strv[1], " ", strv[2], NULL);
a comment explaining the logic here would be good.
Comment 3 Chandni Verma 2011-02-28 18:47:00 UTC
Branch updated
Comment 4 Danielle Madeley 2011-03-07 03:48:50 UTC
EmpathyChatManager calls empathy_chat_window_find_chat() also.
Comment 5 Danielle Madeley 2011-03-07 03:57:11 UTC
Which is in src... ignore me.
Comment 6 Chandni Verma 2011-03-15 13:31:36 UTC
Master doesn't compile for me but I have re-based my branch for this bug
( http://gitorious.org/glassrose-gnome/empathy/commits/moving-part-functionality-to-empathy-chat-window-643295 ) to a branch-point close to the tip of master from where I guess it will be easier to merge this.

I have also added a check to prevent multiple instances of password info-bars which were getting popped up on re-joining protected rooms after parting.

Also, if no exception is needed then nothing should be stopping this from getting merged to master now.
Comment 7 Guillaume Desmottes 2011-03-17 11:45:33 UTC
		message = g_strconcat(strv[1], " ", strv[2], NULL);
missing space before '('

"make check" should catch this kind of coding style issue.


I think the infobar should be destroyed in EmpathyChat when the channel is invalidated. We shouldn't expose such details outside of EmpathyChat.
Comment 8 Chandni Verma 2011-03-18 05:31:14 UTC
(In reply to)
> I think the infobar should be destroyed in EmpathyChat when the channel is
> invalidated. We shouldn't expose such details outside of EmpathyChat.

but the parting code calling empathy_tp_chat_leave() which in turn starts an asynchronous call to tp_channel_leave_async() is placed in the chat window itself. I didn't see any channel invalidating code in EmpathyChat.
Comment 9 Chandni Verma 2011-03-21 22:43:54 UTC
The updated branch
http://gitorious.org/glassrose-gnome/empathy/commits/moving-part-functionality-to-empathy-chat-window-643295
handles infobar destruction details in EmpathyChat method:  empathy_chat_leave_chat(). This is the same method that will leave the tp_chat on Leave Chat menuitem selection in branch
http://gitorious.org/glassrose-gnome/empathy/commits/join-leave-chat-menuitems-643755 which also has been updated.
I hope this looks good.
Comment 10 Guillaume Desmottes 2011-05-06 08:19:33 UTC
Created attachment 187343 [details] [review]
Destroy password infobar on parting password protected chatrooms
Comment 11 Guillaume Desmottes 2011-05-06 08:28:43 UTC
Review of attachment 187343 [details] [review]:

The first 2 commits look good so I'm just commenting on this one.
Would be cool if you could rebase the branch and test it with master though.

::: libempathy-gtk/empathy-chat.c
@@ +761,3 @@
 
+void
+empathy_chat_leave_chat (EmpathyChat *chat,

I think that's the wrong approach. We should'n introduce this function doing all these scary things. the chat window should continue using tp_chat_leave() and display_password_info_bar() should just be modified to connect on the invalidated signal on the channel and destroy the infobar in the cb.

::: libempathy-gtk/empathy-chat.h
@@ +74,3 @@
 EmpathyContact *   empathy_chat_get_remote_contact   (EmpathyChat   *chat);
 GtkWidget *        empathy_chat_get_contact_menu     (EmpathyChat   *chat);
+GList *            empathy_chat_get_password_infobar_vbox_children (EmpathyChat *chat);

why adding this as API? It's not used outside of empathy-chat

::: src/empathy-chat-window.c
@@ +1487,3 @@
 			   GStrv        strv)
 {
+	EmpathyChat   *chat_to_be_parted;

you added an extra space here.
Comment 12 Chandni Verma 2011-05-09 00:12:56 UTC
Branch updated with reviews checked. I re-framed the comments in the last commit too so that they are more clear now.
Comment 13 Guillaume Desmottes 2011-05-09 08:47:01 UTC
Cool, looking much better !

Can you please add a comment in chat_invalidated_cb() explaining what you're doing, it's not that clear looking at the code.

I'd add a \n after tp_g_signal_connect_object().

	gtk_widget_set_sensitive (self->input_text_view, FALSE);
Didn't we need this before? When is it set back to TRUE?
Comment 14 Chandni Verma 2011-05-09 11:16:16 UTC
Branch updated.
(In reply to comment #13)
> Cool, looking much better !
> 
> Can you please add a comment in chat_invalidated_cb() explaining what you're
> doing, it's not that clear looking at the code.
> 
> I'd add a \n after tp_g_signal_connect_object().

Done.

> 
>     gtk_widget_set_sensitive (self->input_text_view, FALSE);
> Didn't we need this before? When is it set back to TRUE?

I don't remember whether I noticed this earlier or not, but the input_text_view is getting set to sensitive whenever the chat is connected: http://git.gnome.org/browse/empathy/tree/libempathy-gtk/empathy-chat.c#n3600
so I made a check here.

I added another patch to make /part attempt to leave_tp_chat only if tp_chat is not null.
Comment 15 Guillaume Desmottes 2011-05-10 14:27:57 UTC
> I added another patch to make /part attempt to leave_tp_chat only if tp_chat is
> not null.

Why is this needed?
Comment 16 Chandni Verma 2011-05-10 17:01:44 UTC
If not, it will crash if I use /part on a chat which is already disconnected. I had lost this check with the commit that was removed so re-introducing it here.
Comment 17 Guillaume Desmottes 2011-05-11 08:31:50 UTC
Yeah but if the chat has been disconnected, the entry should be insensitive and si we can't type /part.
Comment 18 Chandni Verma 2011-05-11 08:52:44 UTC
We can by entering "/part <chatroom1-id>" in any chatroom2 connected from the same account.
Comment 19 Guillaume Desmottes 2011-05-11 09:00:55 UTC
Oh, very good point!


I'm not fan of this syntax:
if ((tp_chat = empathy_chat_get_tp_chat (chat)))

assignation in test are pretty confusing (most people will read '==' instead of '='); I'd prefer if you split it.

After that I think we're good. :)
Comment 20 Chandni Verma 2011-05-11 09:48:04 UTC
Done! :)
Comment 21 Guillaume Desmottes 2011-05-13 14:27:39 UTC
Merged; thanks a lot !

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.
Comment 22 Chandni Verma 2011-05-13 14:46:28 UTC
yay! np :)