[gtranslator/29-show-context-in-the-original-message-bar] Show context in the original message bar



commit 407a5c1b9631ed1a440496eb570f90557b446a30
Author: Daniel Mustieles <daniel mustieles contractor bbva com>
Date:   Tue Oct 23 13:35:45 2018 +0200

    Show context in the original message bar

 src/gtr-tab.c  | 17 +++++++++++++++++
 src/gtr-tab.ui | 27 +++++++++++++++++++++++++--
 2 files changed, 42 insertions(+), 2 deletions(-)
---
diff --git a/src/gtr-tab.c b/src/gtr-tab.c
index 0fbbea21..fcd54c76 100644
--- a/src/gtr-tab.c
+++ b/src/gtr-tab.c
@@ -90,6 +90,8 @@ typedef struct
   GtkWidget *text_plural_scroll;
   GtkWidget *text_msgid_plural;
   GtkWidget *msgid_tags;
+  GtkWidget *msgid_ctxt;
+  GtkWidget *msgid_ctxt_label;
 
   /*Translated text */
   GtkWidget *msgstr_label;
@@ -426,12 +428,25 @@ gtr_tab_show_message (GtrTab * tab, GtrMsg * msg)
   GtkTextBuffer *buf;
   const gchar *msgid, *msgid_plural;
   const gchar *msgstr;
+  const gchar *msgctxt;
 
   g_return_if_fail (GTR_IS_TAB (tab));
 
   priv = gtr_tab_get_instance_private (tab);
   gtk_label_set_text (GTK_LABEL (priv->msgid_tags), "");
 
+  msgctxt = gtr_msg_get_msgctxt (msg);
+  if (msgctxt)
+   {
+    gtk_label_set_text (GTK_LABEL (priv->msgid_ctxt_label), _("Context: "));
+    gtk_label_set_text (GTK_LABEL (priv->msgid_ctxt), msgctxt);
+   }
+  else
+   {
+    gtk_label_set_text (GTK_LABEL (priv->msgid_ctxt_label), "");
+    gtk_label_set_text (GTK_LABEL (priv->msgid_ctxt), "");
+   }
+
   po = priv->po;
   gtr_po_update_current_message (po, msg);
   msgid = gtr_msg_get_msgid (msg);
@@ -824,6 +839,8 @@ gtr_tab_class_init (GtrTabClass * klass)
   gtk_widget_class_bind_template_child_private (widget_class, GtrTab, message_table);
   gtk_widget_class_bind_template_child_private (widget_class, GtrTab, text_msgid);
   gtk_widget_class_bind_template_child_private (widget_class, GtrTab, msgid_tags);
+  gtk_widget_class_bind_template_child_private (widget_class, GtrTab, msgid_ctxt);
+  gtk_widget_class_bind_template_child_private (widget_class, GtrTab, msgid_ctxt_label);
   gtk_widget_class_bind_template_child_private (widget_class, GtrTab, text_plural_scroll);
   gtk_widget_class_bind_template_child_private (widget_class, GtrTab, text_msgid_plural);
   gtk_widget_class_bind_template_child_private (widget_class, GtrTab, msgstr_label);
diff --git a/src/gtr-tab.ui b/src/gtr-tab.ui
index b87f828c..47f0a26a 100644
--- a/src/gtr-tab.ui
+++ b/src/gtr-tab.ui
@@ -150,13 +150,36 @@
                             <property name="can_focus">False</property>
                             <property name="xalign">0</property>
                             <property name="ypad">5</property>
-                            <property name="label" translatable="yes">_Original Message:</property>
+                            <property name="label" translatable="yes">_Original Message</property>
                             <property name="use_underline">True</property>
                             <attributes>
                               <attribute name="weight" value="bold"/>
                             </attributes>
                           </object>
                         </child>
+                       <child>
+                          <object class="GtkLabel" id="msgid_ctxt_label">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="ypad">5</property>
+                            <property name="label" translatable="yes">_Context</property>
+                            <property name="use_underline">True</property>
+                            <attributes>
+                              <attribute name="weight" value="bold"/>
+                            </attributes>
+                          </object>
+                        </child>
+                       <child>
+                          <object class="GtkLabel" id="msgid_ctxt">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="ypad">5</property>
+                            <property name="label" translatable="no"></property>
+                            <property name="use_underline">True</property>
+                          </object>
+                        </child>
                         <child>
                           <object class="GtkLabel" id="msgid_tags">
                             <property name="visible">True</property>
@@ -230,7 +253,7 @@
                     <property name="can_focus">False</property>
                     <property name="xalign">0</property>
                     <property name="ypad">5</property>
-                    <property name="label" translatable="yes">Translate_d Text:</property>
+                    <property name="label" translatable="yes">Translate_d Text</property>
                     <property name="use_underline">True</property>
                     <attributes>
                       <attribute name="weight" value="bold"/>


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