Commit e5e1cfa3 authored by Mohammed Sadiq's avatar Mohammed Sadiq
Browse files

chat-view: Focus chat entry when mapped

Let's focus the entry when mapped and so we don't have to handle
this outside of chat-view.
parent 3eec20e7
......@@ -859,6 +859,16 @@ chat_view_sms_sent_cb (const char *sms_id,
chatty_message_set_status (message, sent_status, time_now);
}
static void
chatty_chat_view_map (GtkWidget *widget)
{
ChattyChatView *self = (ChattyChatView *)widget;
GTK_WIDGET_CLASS (chatty_chat_view_parent_class)->map (widget);
gtk_widget_grab_focus (self->message_input);
}
static void
chatty_chat_view_finalize (GObject *object)
{
......@@ -877,6 +887,8 @@ chatty_chat_view_class_init (ChattyChatViewClass *klass)
object_class->finalize = chatty_chat_view_finalize;
widget_class->map = chatty_chat_view_map;
gtk_widget_class_set_template_from_resource (widget_class,
"/sm/puri/chatty/"
"ui/chatty-chat-view.ui");
......@@ -1004,14 +1016,6 @@ chatty_chat_view_remove_footer (ChattyChatView *self)
self);
}
void
chatty_chat_view_focus_entry (ChattyChatView *self)
{
g_return_if_fail (CHATTY_IS_CHAT_VIEW (self));
gtk_widget_grab_focus (self->message_input);
}
void
chatty_chat_view_show_typing_indicator (ChattyChatView *self)
{
......
......@@ -46,7 +46,6 @@ ChattyChat *chatty_chat_view_get_chat (ChattyChatView *self);
void chatty_chat_view_load (ChattyChatView *self,
guint limit);
void chatty_chat_view_remove_footer (ChattyChatView *self);
void chatty_chat_view_focus_entry (ChattyChatView *self);
void chatty_chat_view_show_typing_indicator (ChattyChatView *self);
void chatty_chat_view_hide_typing_indicator (ChattyChatView *self);
......
......@@ -580,8 +580,6 @@ chatty_conv_switch_conv (ChattyConversation *chatty_conv)
g_debug ("chatty_conv_switch_conv active_conv: %s page_num %i",
purple_conversation_get_name (chatty_conv->conv), page_num);
chatty_chat_view_focus_entry (CHATTY_CHAT_VIEW (chatty_conv->chat_view));
}
......@@ -622,8 +620,6 @@ chatty_conv_stack_add_conv (ChattyConversation *chatty_conv)
g_free (text);
g_strfreev (name_split);
chatty_chat_view_focus_entry (CHATTY_CHAT_VIEW (chatty_conv->chat_view));
}
static void
......
Supports Markdown
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