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



commit 338ba59691baeb18f2a946f197d502370531f846
Author: Daniel GarcĂ­a Moreno <danigm wadobo com>
Date:   Fri Dec 28 13:21:31 2018 +0100

    Styling context in origin message bar
    
    See #29

 src/gtr-tab.c  |  9 +++------
 src/gtr-tab.ui | 23 +++++------------------
 src/styles.css |  5 +++++
 3 files changed, 13 insertions(+), 24 deletions(-)
---
diff --git a/src/gtr-tab.c b/src/gtr-tab.c
index fcd54c76..75e1a0a6 100644
--- a/src/gtr-tab.c
+++ b/src/gtr-tab.c
@@ -91,7 +91,6 @@ typedef struct
   GtkWidget *text_msgid_plural;
   GtkWidget *msgid_tags;
   GtkWidget *msgid_ctxt;
-  GtkWidget *msgid_ctxt_label;
 
   /*Translated text */
   GtkWidget *msgstr_label;
@@ -438,13 +437,12 @@ gtr_tab_show_message (GtrTab * tab, GtrMsg * msg)
   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);
+     gtk_label_set_text (GTK_LABEL (priv->msgid_ctxt), msgctxt);
+     gtk_widget_show (priv->msgid_ctxt);
    }
   else
    {
-    gtk_label_set_text (GTK_LABEL (priv->msgid_ctxt_label), "");
-    gtk_label_set_text (GTK_LABEL (priv->msgid_ctxt), "");
+     gtk_widget_hide (priv->msgid_ctxt);
    }
 
   po = priv->po;
@@ -840,7 +838,6 @@ gtr_tab_class_init (GtrTabClass * klass)
   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 47f0a26a..d1686f05 100644
--- a/src/gtr-tab.ui
+++ b/src/gtr-tab.ui
@@ -157,27 +157,17 @@
                             </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>
+                        <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>
+                            <property name="ellipsize">end</property>
+                            <style>
+                              <class name="msgcontext"/>
+                            </style>
                           </object>
                         </child>
                         <child>
@@ -185,7 +175,6 @@
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="xalign">0</property>
-                            <property name="ypad">5</property>
                             <property name="label"></property>
                             <attributes>
                               <attribute name="weight" value="bold"/>
@@ -310,5 +299,3 @@
     </child>
   </template>
 </interface>
-
-
diff --git a/src/styles.css b/src/styles.css
index b3c8f728..71b41651 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -15,6 +15,11 @@
   color: @warning_color;
 }
 
+.msgcontext {
+  margin-left: 10px;
+  color: @insensitive_fg_color;
+}
+
 .progress_trans {
   color: @theme_selected_bg_color;
 }


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