Commit 74e10a6b authored by Mohammed Sadiq's avatar Mohammed Sadiq
Browse files

Reduce usage of chatty_conversation

We eventually want to remove this variable so that ui_data can
be reused for saving associated GObject
parent 19b181b7
......@@ -45,7 +45,7 @@ struct _ChattyChatView
GtkAdjustment *vadjustment;
ChattyChat *chat;
ChattyConversation *chatty_conv;
PurpleConversation *conv;
char *last_message_id; /* id of last sent message, currently used only for SMS */
guint message_type;
guint refresh_typing_id;
......@@ -246,8 +246,8 @@ chat_view_setup_file_upload (ChattyChatView *self)
gtk_widget_show (self->send_file_button);
gc = purple_conversation_get_gc (self->chatty_conv->conv);
node = chatty_utils_get_conv_blist_node (self->chatty_conv->conv);
gc = purple_conversation_get_gc (self->conv);
node = chatty_utils_get_conv_blist_node (self->conv);
prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO (gc->prpl);
if (prpl_info->blist_node_menu)
......@@ -278,8 +278,8 @@ chatty_chat_view_update (ChattyChatView *self)
g_assert (CHATTY_IS_CHAT_VIEW (self));
account = purple_conversation_get_account (self->chatty_conv->conv);
conv_type = purple_conversation_get_type (self->chatty_conv->conv);
account = purple_conversation_get_account (self->conv);
conv_type = purple_conversation_get_type (self->conv);
protocol_id = purple_account_get_protocol_id (account);
if (conv_type == PURPLE_CONV_TYPE_CHAT)
......@@ -331,7 +331,7 @@ chatty_update_typing_status (ChattyChatView *self)
g_assert (CHATTY_IS_CHAT_VIEW (self));
conv = self->chatty_conv->conv;
conv = self->conv;
type = purple_conversation_get_type (conv);
if (type != PURPLE_CONV_TYPE_IM)
......@@ -528,7 +528,7 @@ chatty_conv_check_for_command (ChattyChatView *self)
PurpleMessageFlags flags = 0;
flags |= PURPLE_MESSAGE_NO_LOG | PURPLE_MESSAGE_SYSTEM;
conv = self->chatty_conv->conv;
conv = self->conv;
gtk_text_buffer_get_bounds (self->message_input_buffer, &start, &end);
......@@ -658,7 +658,7 @@ chat_view_send_file_button_clicked_cb (ChattyChatView *self,
callback = g_object_get_data (G_OBJECT (button), "callback");
data = g_object_get_data (G_OBJECT (button), "callback-data");
node = chatty_utils_get_conv_blist_node (self->chatty_conv->conv);
node = chatty_utils_get_conv_blist_node (self->conv);
if (callback)
callback (node, data);
......@@ -677,7 +677,7 @@ chat_view_send_message_button_clicked_cb (ChattyChatView *self)
g_assert (CHATTY_IS_CHAT_VIEW (self));
conv = self->chatty_conv->conv;
conv = self->conv;
account = purple_conversation_get_account (conv);
gtk_text_buffer_get_bounds (self->message_input_buffer, &start, &end);
......@@ -761,7 +761,7 @@ chat_view_message_input_changed_cb (ChattyChatView *self)
g_assert (CHATTY_IS_CHAT_VIEW (self));
account = purple_conversation_get_account (self->chatty_conv->conv);
account = purple_conversation_get_account (self->conv);
protocol = purple_account_get_protocol_id (account);
has_text = gtk_text_buffer_get_char_count (self->message_input_buffer) > 0;
gtk_widget_set_visible (self->send_message_button, has_text);
......@@ -984,8 +984,6 @@ void
chatty_chat_view_set_chat (ChattyChatView *self,
ChattyChat *chat)
{
PurpleConversation *conv;
g_return_if_fail (CHATTY_IS_CHAT_VIEW (self));
g_return_if_fail (CHATTY_IS_CHAT (chat));
......@@ -995,8 +993,7 @@ chatty_chat_view_set_chat (ChattyChatView *self,
if (!chat)
return;
conv = chatty_chat_get_purple_conv (chat);
self->chatty_conv = CHATTY_CONVERSATION (conv);
self->conv = chatty_chat_get_purple_conv (chat);
gtk_list_box_bind_model (GTK_LIST_BOX (self->message_list),
chatty_chat_get_messages (self->chat),
......
......@@ -49,7 +49,7 @@ struct _ChattyMucInfoDialog
const char *new_topic;
ChattyChat *chat;
ChattyConversation *chatty_conv;
PurpleConversation *conv;
};
......@@ -86,14 +86,14 @@ button_invite_contact_clicked_cb (ChattyMucInfoDialog *self)
name = gtk_entry_get_text (GTK_ENTRY(self->entry_invite_name));
invite_msg = gtk_entry_get_text (GTK_ENTRY(self->entry_invite_msg));
if (name && *name && self->chatty_conv) {
if (name && *name && self->conv) {
PurpleConversationType conv_type;
conv_type = purple_conversation_get_type (self->chatty_conv->conv);
conv_type = purple_conversation_get_type (self->conv);
if (conv_type == PURPLE_CONV_TYPE_CHAT)
serv_chat_invite (purple_conversation_get_gc (self->chatty_conv->conv),
purple_conv_chat_get_id (PURPLE_CONV_CHAT (self->chatty_conv->conv)),
serv_chat_invite (purple_conversation_get_gc (self->conv),
purple_conv_chat_get_id (PURPLE_CONV_CHAT (self->conv)),
invite_msg,
name);
}
......@@ -167,8 +167,8 @@ switch_prefs_state_changed_cb (ChattyMucInfoDialog *self)
active = gtk_switch_get_active (GTK_SWITCH(self->switch_prefs_status));
node = PURPLE_BLIST_NODE(purple_blist_find_chat (self->chatty_conv->conv->account,
self->chatty_conv->conv->name));
node = PURPLE_BLIST_NODE(purple_blist_find_chat (self->conv->account,
self->conv->name));
purple_blist_node_set_bool (node, "chatty-status-msg", active);
}
......@@ -184,8 +184,8 @@ switch_prefs_notify_changed_cb (ChattyMucInfoDialog *self)
active = gtk_switch_get_active (GTK_SWITCH(self->switch_prefs_notifications));
node = PURPLE_BLIST_NODE(purple_blist_find_chat (self->chatty_conv->conv->account,
self->chatty_conv->conv->name));
node = PURPLE_BLIST_NODE(purple_blist_find_chat (self->conv->account,
self->conv->name));
purple_blist_node_set_bool (node, "chatty-notifications", active);
}
......@@ -246,7 +246,7 @@ chatty_muc_set_topic (ChattyMucInfoDialog *self)
g_assert (CHATTY_IS_MUC_INFO_DIALOG (self));
gc = purple_conversation_get_gc (self->chatty_conv->conv);
gc = purple_conversation_get_gc (self->conv);
prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
......@@ -258,7 +258,7 @@ chatty_muc_set_topic (ChattyMucInfoDialog *self)
return;
}
chat_id = purple_conv_chat_get_id (PURPLE_CONV_CHAT(self->chatty_conv->conv));
chat_id = purple_conv_chat_get_id (PURPLE_CONV_CHAT(self->conv));
prpl_info->set_chat_topic (gc, chat_id, self->new_topic);
}
......@@ -284,15 +284,15 @@ chatty_muc_info_dialog_update_chat (ChattyMucInfoDialog *self)
gtk_text_view_set_buffer (GTK_TEXT_VIEW(self->textview_topic),
self->msg_buffer_topic);
account = purple_conversation_get_account (self->chatty_conv->conv);
account = purple_conversation_get_account (self->conv);
chat = PURPLE_CONV_CHAT(self->chatty_conv->conv);
node = PURPLE_BLIST_NODE(purple_blist_find_chat (account, self->chatty_conv->conv->name));
chat_name = purple_conversation_get_title (self->chatty_conv->conv);
chat = PURPLE_CONV_CHAT(self->conv);
node = PURPLE_BLIST_NODE(purple_blist_find_chat (account, self->conv->name));
chat_name = purple_conversation_get_title (self->conv);
gtk_label_set_text (GTK_LABEL(self->label_chat_id), chat_name);
topic = purple_conv_chat_get_topic (PURPLE_CONV_CHAT(self->chatty_conv->conv));
topic = purple_conv_chat_get_topic (PURPLE_CONV_CHAT(self->conv));
flags = purple_conv_chat_user_get_flags (chat, chat->nick);
if (flags & PURPLE_CBFLAGS_FOUNDER) {
......@@ -315,7 +315,7 @@ chatty_muc_info_dialog_update_chat (ChattyMucInfoDialog *self)
gtk_switch_set_state (GTK_SWITCH(self->switch_prefs_status),
purple_blist_node_get_bool (node, "chatty-status-msg"));
chatty_chat = chatty_manager_find_purple_conv (chatty_manager_get_default (), self->chatty_conv->conv);
chatty_chat = chatty_manager_find_purple_conv (chatty_manager_get_default (), self->conv);
g_return_if_fail (chatty_chat);
user_list = chatty_chat_get_users (chatty_chat);
......@@ -396,14 +396,11 @@ void
chatty_muc_info_dialog_set_chat (ChattyMucInfoDialog *self,
ChattyChat *chat)
{
PurpleConversation *conv;
g_return_if_fail (CHATTY_IS_MUC_INFO_DIALOG (self));
g_return_if_fail (CHATTY_IS_CHAT (chat));
conv = chatty_chat_get_purple_conv (chat);
self->conv = chatty_chat_get_purple_conv (chat);
self->chat = chat;
self->chatty_conv = conv->ui_data;
chatty_muc_info_dialog_update_chat (self);
}
......@@ -42,7 +42,7 @@ struct _ChattyUserInfoDialog
GtkWidget *listbox_fps;
ChattyChat *chat;
ChattyConversation *chatty_conv;
PurpleConversation *conv;
PurpleBuddy *buddy;
const char *alias;
};
......@@ -199,9 +199,9 @@ chatty_user_info_dialog_request_fps (ChattyUserInfoDialog *self)
void * plugins_handle = purple_plugins_get_handle();
account = purple_conversation_get_account (self->chatty_conv->conv);
type = purple_conversation_get_type (self->chatty_conv->conv);
name = purple_conversation_get_name (self->chatty_conv->conv);
account = purple_conversation_get_account (self->conv);
type = purple_conversation_get_type (self->conv);
name = purple_conversation_get_name (self->conv);
if (type == PURPLE_CONV_TYPE_IM) {
g_autofree gchar *stripped = chatty_utils_jabber_id_strip (name);
......@@ -249,7 +249,7 @@ chatty_user_info_dialog_update_chat (ChattyUserInfoDialog *self)
chatty_user_info_dialog_request_fps (self);
}
self->buddy = purple_find_buddy (self->chatty_conv->conv->account, self->chatty_conv->conv->name);
self->buddy = purple_find_buddy (self->conv->account, self->conv->name);
self->alias = purple_buddy_get_alias (self->buddy);
if (protocol == CHATTY_PROTOCOL_SMS) {
......@@ -273,7 +273,7 @@ chatty_user_info_dialog_update_chat (ChattyUserInfoDialog *self)
alias = self->alias ? chatty_utils_jabber_id_strip (self->alias) : g_strdup ("");
gtk_label_set_text (GTK_LABEL(self->label_alias), alias);
gtk_label_set_text (GTK_LABEL(self->label_jid), self->chatty_conv->conv->name);
gtk_label_set_text (GTK_LABEL(self->label_jid), self->conv->name);
}
......@@ -336,14 +336,11 @@ void
chatty_user_info_dialog_set_chat (ChattyUserInfoDialog *self,
ChattyChat *chat)
{
PurpleConversation *conv;
g_return_if_fail (CHATTY_IS_USER_INFO_DIALOG (self));
g_return_if_fail (CHATTY_IS_CHAT (chat));
conv = chatty_chat_get_purple_conv (chat);
self->conv = chatty_chat_get_purple_conv (chat);
self->chat = chat;
self->chatty_conv = conv->ui_data;
chatty_user_info_dialog_update_chat (self);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment