[gtranslator] tab: Give focus to the translation box



commit 9826047108c3f09ab48a6fab257946bc1269af50
Author: Daniel GarcĂ­a Moreno <danigm wadobo com>
Date:   Tue Sep 18 14:37:42 2018 +0200

    tab: Give focus to the translation box
    
    Fix #15

 src/gtr-tab.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
---
diff --git a/src/gtr-tab.c b/src/gtr-tab.c
index 8bf2adbc..96a3ab7a 100644
--- a/src/gtr-tab.c
+++ b/src/gtr-tab.c
@@ -124,6 +124,14 @@ static guint signals[LAST_SIGNAL];
 
 static gboolean gtr_tab_autosave (GtrTab * tab);
 
+static void
+msg_grab_focus (GtrTab *tab)
+{
+  GtrTabPrivate *priv;
+  priv = gtr_tab_get_instance_private (tab);
+  gtk_widget_grab_focus (priv->trans_msgstr[0]);
+}
+
 static void
 install_autosave_timeout (GtrTab * tab)
 {
@@ -1007,6 +1015,11 @@ gtr_tab_message_go_to (GtrTab * tab,
   else
     return;
 
+  // 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);
+
   /*
    * Emitting showed-message signal
    */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]