[latexila] Revert "TabInfoBar: remove icon"



commit 899897dacb91c132ac281cf5fafa0895b13ab25b
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Tue Nov 1 14:04:09 2016 +0100

    Revert "TabInfoBar: remove icon"
    
    This reverts commit a94455e51e0455a3052616348f753f03fc69d713.
    
    I've changed my mind, it is actually better with the icon, even if it is
    slightly more code (but clearly not terribly complicated code).

 src/tab_info_bar.vala |   28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/src/tab_info_bar.vala b/src/tab_info_bar.vala
index 1794597..be5375e 100644
--- a/src/tab_info_bar.vala
+++ b/src/tab_info_bar.vala
@@ -23,10 +23,37 @@ public class TabInfoBar : Gtef.InfoBar
 {
     public TabInfoBar (string primary_msg, string secondary_msg, MessageType msg_type)
     {
+        Box content_area = get_content_area () as Box;
+
         set_message_type (msg_type);
 
+        // icon
+        string icon_name;
+        switch (msg_type)
+        {
+            case MessageType.ERROR:
+                icon_name = "dialog-error";
+                break;
+            case MessageType.QUESTION:
+                icon_name = "dialog-question";
+                break;
+            case MessageType.WARNING:
+                icon_name = "dialog-warning";
+                break;
+            case MessageType.INFO:
+            default:
+                icon_name = "dialog-information";
+                break;
+        }
+
+        Image image = new Image.from_icon_name (icon_name, IconSize.DIALOG);
+        image.set_valign (Align.START);
+        content_area.pack_start (image, false, false, 0);
+
+        // text
         Grid grid = new Grid ();
         grid.orientation = Orientation.VERTICAL;
+        grid.set_row_spacing (6);
 
         Label primary_label = Gtef.InfoBar.create_label ();
         primary_label.set_markup ("<b>" + primary_msg + "</b>");
@@ -36,7 +63,6 @@ public class TabInfoBar : Gtef.InfoBar
         secondary_label.set_markup ("<small>" + secondary_msg + "</small>");
         grid.add (secondary_label);
 
-        Box content_area = get_content_area () as Box;
         content_area.pack_start (grid);
 
         show_all ();


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