Commit ab01ab4c authored by Daniel Garcia Moreno's avatar Daniel Garcia Moreno
Browse files

Grab focus on msg just when clicking

Fix #158
parent e697c1b3
Pipeline #397007 passed with stages
in 3 minutes and 31 seconds
......@@ -204,7 +204,7 @@ find_in_list (GtrWindow * window,
found = run_search (GTR_VIEW (viewsaux->data), found);
if (found)
{
gtr_tab_message_go_to (tab, l->data, FALSE, GTR_TAB_MOVE_NONE);
gtr_tab_message_go_to (tab, l->data, TRUE, GTR_TAB_MOVE_NONE);
run_search (GTR_VIEW (viewsaux->data), aux);
return TRUE;
}
......@@ -303,7 +303,7 @@ do_find (GtrSearchBar * dialog, GtrWindow * window, gboolean search_backwards)
restore_last_searched_data (dialog, tab);
if (!found && current_msg)
gtr_tab_message_go_to (tab, current_msg->data, FALSE, GTR_TAB_MOVE_NONE);
gtr_tab_message_go_to (tab, current_msg->data, TRUE, GTR_TAB_MOVE_NONE);
gtr_search_bar_set_found (dialog, found);
}
......
......@@ -261,6 +261,15 @@ show_hide_revealer (GtkWidget *widget, GdkEvent *ev, GtrTab *tab)
return TRUE;
}
static gboolean
msg_grab_focus (GtrTab *tab)
{
GtrTabPrivate *priv;
priv = gtr_tab_get_instance_private (tab);
gtk_widget_grab_focus (priv->trans_msgstr[0]);
return FALSE;
}
static void
install_autosave_timeout (GtrTab * tab)
{
......@@ -1182,7 +1191,9 @@ gtr_tab_get_all_views (GtrTab * tab, gboolean original, gboolean translated)
**/
void
gtr_tab_message_go_to (GtrTab * tab,
GtrMsg * to_go, gboolean searching, GtrTabMove move)
GtrMsg * to_go,
gboolean searching,
GtrTabMove move)
{
static gboolean first_msg = TRUE;
GtrTabPrivate *priv;
......@@ -1254,8 +1265,15 @@ gtr_tab_message_go_to (GtrTab * tab,
* Emitting showed-message signal
*/
if (!searching)
g_signal_emit (G_OBJECT (tab), signals[SHOWED_MESSAGE], 0,
GTR_MSG (to_go));
{
g_signal_emit (G_OBJECT (tab), signals[SHOWED_MESSAGE], 0,
GTR_MSG (to_go));
// Grabbing the focus in the GtrView to edit the message
// This is done in the idle add to avoid the focus grab from the
// message-table
g_idle_add((GSourceFunc)msg_grab_focus, tab);
}
}
/**
......
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