[gitg] Small fixes to styling



commit 5dc978d5956ea88a7904b4d01cfb3c86552b6458
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Tue Aug 25 21:13:41 2015 +0200

    Small fixes to styling

 libgitg/gitg-diff-view-file.vala                   |    5 +-
 libgitg/gitg-diff-view-hunk.vala                   |  106 +++++++-
 libgitg/gitg-diff-view-lines-renderer.vala         |   30 +++
 libgitg/gitg-diff-view.vala                        |    2 +-
 .../resources/ui/gitg-diff-view-commit-details.ui  |  274 ++++++++++----------
 libgitg/resources/ui/gitg-diff-view-file.ui        |   28 ++-
 libgitg/resources/ui/gitg-diff-view-hunk.ui        |   61 ++---
 libgitg/resources/ui/gitg-diff-view.ui             |   27 +-
 libgitg/resources/ui/libgitg-style.css             |   34 ++-
 9 files changed, 347 insertions(+), 220 deletions(-)
---
diff --git a/libgitg/gitg-diff-view-file.vala b/libgitg/gitg-diff-view-file.vala
index cd72ec8..dbc94ce 100644
--- a/libgitg/gitg-diff-view-file.vala
+++ b/libgitg/gitg-diff-view-file.vala
@@ -32,8 +32,8 @@ class Gitg.DiffViewFile : Gtk.Grid
        [GtkChild( name = "diff_stat_file" )]
        private DiffStat d_diff_stat_file;
 
-       [GtkChild( name = "grid_file_header" )]
-       private Gtk.Grid d_grid_file_header;
+       [GtkChild( name = "revealer_hunks" )]
+       private Gtk.Revealer d_revealer_hunks;
 
        private bool d_expanded;
 
@@ -49,6 +49,7 @@ class Gitg.DiffViewFile : Gtk.Grid
                        if (d_expanded != value)
                        {
                                d_expanded = value;
+                               d_revealer_hunks.reveal_child = d_expanded;
 
                                var ctx = get_style_context();
 
diff --git a/libgitg/gitg-diff-view-hunk.vala b/libgitg/gitg-diff-view-hunk.vala
index ea40121..c53465b 100644
--- a/libgitg/gitg-diff-view-hunk.vala
+++ b/libgitg/gitg-diff-view-hunk.vala
@@ -20,7 +20,6 @@
 [GtkTemplate (ui = "/org/gnome/gitg/ui/gitg-diff-view-hunk.ui")]
 class Gitg.DiffViewHunk : Gtk.Grid
 {
-       [GtkChild( name = "label_hunk" )]
        private Gtk.Label d_label_hunk;
 
        [GtkChild( name = "sourceview_hunk" )]
@@ -57,24 +56,65 @@ class Gitg.DiffViewHunk : Gtk.Grid
                get { return d_removed; }
        }
 
+       private DiffViewLinesRenderer d_old_lines;
+       private DiffViewLinesRenderer d_new_lines;
+       private DiffViewLinesRenderer d_sym_lines;
+
        construct
        {
                var gutter = d_sourceview_hunk.get_gutter(Gtk.TextWindowType.LEFT);
 
-               var old_lines = new DiffViewLinesRenderer(hunk, lines, DiffViewLinesRenderer.Style.OLD);
-               var new_lines = new DiffViewLinesRenderer(hunk, lines, DiffViewLinesRenderer.Style.NEW);
-               var sym_lines = new DiffViewLinesRenderer(hunk, lines, DiffViewLinesRenderer.Style.SYMBOL);
+               d_old_lines = new DiffViewLinesRenderer(hunk, lines, DiffViewLinesRenderer.Style.OLD);
+               d_new_lines = new DiffViewLinesRenderer(hunk, lines, DiffViewLinesRenderer.Style.NEW);
+               d_sym_lines = new DiffViewLinesRenderer(hunk, lines, DiffViewLinesRenderer.Style.SYMBOL);
+
+               d_old_lines.xpad = 8;
+               d_new_lines.xpad = 8;
+               d_sym_lines.xpad = 6;
 
-               old_lines.xpad = 8;
-               new_lines.xpad = 8;
-               sym_lines.xpad = 6;
+               gutter.insert(d_old_lines, 0);
+               gutter.insert(d_new_lines, 1);
+               gutter.insert(d_sym_lines, 2);
 
-               gutter.insert(old_lines, 0);
-               gutter.insert(new_lines, 1);
-               gutter.insert(sym_lines, 2);
+               d_old_lines.notify["size"].connect(update_top_window_size);
+               d_new_lines.notify["size"].connect(update_top_window_size);
+               d_sym_lines.notify["size"].connect(update_top_window_size);
 
                update_hunk_label();
                update_lines();
+
+               d_sourceview_hunk.set_border_window_size(Gtk.TextWindowType.TOP, 1);
+               d_sourceview_hunk.add_child_in_window(d_label_hunk, Gtk.TextWindowType.TOP, 0, 0);
+
+               d_label_hunk.style_updated.connect(update_top_window_size);
+               update_top_window_size();
+       }
+
+       private void update_top_window_size()
+       {
+               int minheight, natheight;
+               d_label_hunk.get_preferred_height(out minheight, out natheight);
+
+               if (natheight > 0)
+               {
+                       d_sourceview_hunk.set_border_window_size(Gtk.TextWindowType.TOP, natheight);
+               }
+
+               var wx = d_new_lines.size +
+                        d_new_lines.xpad * 2 +
+                        d_old_lines.size +
+                        d_old_lines.xpad * 2 +
+                        d_sym_lines.size +
+                        d_sym_lines.xpad * 2;
+
+               d_sourceview_hunk.move_child(d_label_hunk, -wx, 0);
+       }
+
+       protected override bool map_event(Gdk.EventAny event)
+       {
+               var ret = base.map_event(event);
+               update_top_window_size();
+               return ret;
        }
 
        private void update_hunk_label()
@@ -88,7 +128,14 @@ class Gitg.DiffViewHunk : Gtk.Grid
                }
 
                h = h.chomp();
-               d_label_hunk.label = @"@@ -$(hunk.get_old_start()),$(hunk.get_old_lines()) 
+$(hunk.get_new_start()),$(hunk.get_new_lines()) @@ $h";
+               d_label_hunk = new Gtk.Label(@"@@ -$(hunk.get_old_start()),$(hunk.get_old_lines()) 
+$(hunk.get_new_start()),$(hunk.get_new_lines()) @@ $h");
+               d_label_hunk.halign = Gtk.Align.START;
+               d_label_hunk.xalign = 0;
+               d_label_hunk.selectable = false;
+               d_label_hunk.can_focus = false;
+               d_label_hunk.margin_top = 6;
+               d_label_hunk.margin_bottom = 6;
+               d_label_hunk.show();
        }
 
        private void update_lines()
@@ -123,7 +170,42 @@ class Gitg.DiffViewHunk : Gtk.Grid
                        content.append(text);
                }
 
-               d_sourceview_hunk.buffer.set_text((string)content.data);
+               var buffer = d_sourceview_hunk.buffer as Gtk.SourceBuffer;
+
+               buffer.set_text((string)content.data);
+
+               var added_attributes = new Gtk.SourceMarkAttributes();
+               added_attributes.background = Gdk.RGBA() { red = 220.0 / 255.0, green = 1.0, blue = 220.0 / 
255.0, alpha = 1.0 };
+
+               var removed_attributes = new Gtk.SourceMarkAttributes();
+               removed_attributes.background = Gdk.RGBA() { red = 1.0, green = 220.0 / 255.0, blue = 220.0 / 
255.0, alpha = 1.0 };
+
+               d_sourceview_hunk.set_mark_attributes("added", added_attributes, 0);
+               d_sourceview_hunk.set_mark_attributes("removed", removed_attributes, 0);
+
+               for (var i = 0; i < lines.size; i++)
+               {
+                       var line = lines[i];
+                       string? category = null;
+
+                       switch (line.get_origin())
+                       {
+                               case Ggit.DiffLineType.ADDITION:
+                                       category = "added";
+                               break;
+                               case Ggit.DiffLineType.DELETION:
+                                       category = "removed";
+                               break;
+                       }
+
+                       if (category != null)
+                       {
+                               Gtk.TextIter iter;
+
+                               buffer.get_iter_at_line(out iter, i);
+                               buffer.create_source_mark(null, category, iter);
+                       }
+               }
 
                notify_property("added");
                notify_property("removed");
diff --git a/libgitg/gitg-diff-view-lines-renderer.vala b/libgitg/gitg-diff-view-lines-renderer.vala
index f878c9e..aa17c17 100644
--- a/libgitg/gitg-diff-view-lines-renderer.vala
+++ b/libgitg/gitg-diff-view-lines-renderer.vala
@@ -187,6 +187,36 @@ class Gitg.DiffViewLinesRenderer : Gtk.SourceGutterRendererText
                d_num_digits_fmts = @"%$(num_digits)d";
                d_num_digits_fill = string.nfill(num_digits, ' ');
        }
+
+       public override void begin(Cairo.Context cr,
+                                  Gdk.Rectangle background_area,
+                                  Gdk.Rectangle cell_area,
+                                  Gtk.TextIter  start,
+                                  Gtk.TextIter  end)
+       {
+               base.begin(cr, background_area, cell_area, start, end);
+
+               if (style == Style.OLD || style == Style.SYMBOL)
+               {
+                       var ctx = get_view().get_style_context();
+
+                       ctx.save();
+                       ctx.add_class("diff-lines-border");
+
+                       if (style == Style.SYMBOL)
+                       {
+                               ctx.add_class("symbol");
+                       }
+
+                       ctx.render_frame(cr,
+                                        background_area.x,
+                                        background_area.y,
+                                        background_area.width,
+                                        background_area.height);
+
+                       ctx.restore();
+               }
+       }
 }
 
 // ex:ts=4 noet
diff --git a/libgitg/gitg-diff-view.vala b/libgitg/gitg-diff-view.vala
index 390fe04..61a59c1 100644
--- a/libgitg/gitg-diff-view.vala
+++ b/libgitg/gitg-diff-view.vala
@@ -18,7 +18,7 @@
  */
 
 [GtkTemplate( ui = "/org/gnome/gitg/ui/gitg-diff-view.ui" )]
-public class Gitg.DiffView : Gtk.ScrolledWindow
+public class Gitg.DiffView : Gtk.Grid
 {
        [GtkChild( name = "commit_details" )]
        private Gitg.DiffViewCommitDetails d_commit_details;
diff --git a/libgitg/resources/ui/gitg-diff-view-commit-details.ui 
b/libgitg/resources/ui/gitg-diff-view-commit-details.ui
index f08c07b..d9cddc5 100644
--- a/libgitg/resources/ui/gitg-diff-view-commit-details.ui
+++ b/libgitg/resources/ui/gitg-diff-view-commit-details.ui
@@ -5,38 +5,21 @@
   <template class="GitgDiffViewCommitDetails" parent="GtkGrid">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="border_width">12</property>
-    <property name="row_spacing">6</property>
-    <property name="column_spacing">6</property>
     <child>
-      <object class="GtkImage" id="image_avatar">
+      <object class="GtkGrid" id="grid_inner">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="halign">start</property>
-        <property name="valign">start</property>
-        <property name="pixel_size">70</property>
-        <property name="icon_name">avatar-default-symbolic</property>
-      </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkGrid" id="grid_author_committer">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="hexpand">True</property>
+        <property name="border_width">12</property>
+        <property name="row_spacing">6</property>
+        <property name="column_spacing">6</property>
         <child>
-          <object class="GtkLabel" id="label_author">
+          <object class="GtkImage" id="image_avatar">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="halign">start</property>
             <property name="valign">start</property>
-            <property name="label">Author name &amp;lt;&lt;a href="email example com"&gt;email example 
com&lt;/a&gt;&amp;gt;</property>
-            <property name="selectable">True</property>
-            <property name="ellipsize">end</property>
-            <property name="use_markup">True</property>
+            <property name="pixel_size">70</property>
+            <property name="icon_name">avatar-default-symbolic</property>
           </object>
           <packing>
             <property name="left_attach">0</property>
@@ -44,50 +27,114 @@
           </packing>
         </child>
         <child>
-          <object class="GtkLabel" id="label_author_date">
+          <object class="GtkGrid" id="grid_author_committer">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="halign">start</property>
-            <property name="valign">start</property>
-            <property name="label">Author date</property>
-            <property name="selectable">True</property>
-            <property name="ellipsize">end</property>
-            <attributes>
-              <attribute name="scale" value="0.833333333333333"/>
-            </attributes>
-            <style>
-              <class name="dim-label"/>
-            </style>
+            <property name="hexpand">True</property>
+            <child>
+              <object class="GtkLabel" id="label_author">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">start</property>
+                <property name="valign">start</property>
+                <property name="label">Author name &amp;lt;&lt;a href="email example com"&gt;email example 
com&lt;/a&gt;&amp;gt;</property>
+                <property name="selectable">True</property>
+                <property name="ellipsize">end</property>
+                <property name="use_markup">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label_author_date">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">start</property>
+                <property name="valign">start</property>
+                <property name="label">Author date</property>
+                <property name="selectable">True</property>
+                <property name="ellipsize">end</property>
+                <attributes>
+                  <attribute name="scale" value="0.833333333333333"/>
+                </attributes>
+                <style>
+                  <class name="dim-label"/>
+                </style>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label_committer">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">start</property>
+                <property name="valign">start</property>
+                <property name="margin_top">6</property>
+                <property name="label">Committer name &amp;lt;&lt;a href="email example com"&gt;email 
example com&lt;/a&gt;&amp;gt;</property>
+                <property name="selectable">True</property>
+                <property name="ellipsize">end</property>
+                <property name="use_markup">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label_committer_date">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">start</property>
+                <property name="valign">start</property>
+                <property name="label">Committer date</property>
+                <property name="selectable">True</property>
+                <property name="ellipsize">end</property>
+                <style>
+                  <class name="dim-label"/>
+                </style>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">3</property>
+              </packing>
+            </child>
           </object>
           <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">1</property>
+            <property name="left_attach">1</property>
+            <property name="top_attach">0</property>
           </packing>
         </child>
         <child>
-          <object class="GtkLabel" id="label_committer">
+          <object class="GtkLabel" id="label_subject">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="halign">start</property>
             <property name="valign">start</property>
             <property name="margin_top">6</property>
-            <property name="label">Committer name &amp;lt;&lt;a href="email example com"&gt;email example 
com&lt;/a&gt;&amp;gt;</property>
+            <property name="margin_bottom">6</property>
+            <property name="label">Subject</property>
+            <property name="wrap">True</property>
             <property name="selectable">True</property>
             <property name="ellipsize">end</property>
-            <property name="use_markup">True</property>
           </object>
           <packing>
             <property name="left_attach">0</property>
-            <property name="top_attach">2</property>
+            <property name="top_attach">1</property>
+            <property name="width">2</property>
           </packing>
         </child>
         <child>
-          <object class="GtkLabel" id="label_committer_date">
+          <object class="GtkLabel" id="label_sha1">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="halign">start</property>
+            <property name="halign">end</property>
             <property name="valign">start</property>
-            <property name="label">Committer date</property>
+            <property name="label">0000000000000000000000000000000000000000</property>
             <property name="selectable">True</property>
             <property name="ellipsize">end</property>
             <style>
@@ -95,114 +142,73 @@
             </style>
           </object>
           <packing>
-            <property name="left_attach">0</property>
+            <property name="left_attach">1</property>
             <property name="top_attach">3</property>
           </packing>
         </child>
-      </object>
-      <packing>
-        <property name="left_attach">1</property>
-        <property name="top_attach">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkLabel" id="label_subject">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="halign">start</property>
-        <property name="valign">start</property>
-        <property name="margin_top">6</property>
-        <property name="margin_bottom">6</property>
-        <property name="label">Subject</property>
-        <property name="wrap">True</property>
-        <property name="selectable">True</property>
-        <property name="ellipsize">end</property>
-      </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">1</property>
-        <property name="width">2</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkLabel" id="label_sha1">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="halign">end</property>
-        <property name="valign">start</property>
-        <property name="label">0000000000000000000000000000000000000000</property>
-        <property name="selectable">True</property>
-        <property name="ellipsize">end</property>
-        <style>
-          <class name="dim-label"/>
-        </style>
-      </object>
-      <packing>
-        <property name="left_attach">1</property>
-        <property name="top_attach">3</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkGrid" id="grid_parents_container">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="margin_bottom">12</property>
-        <property name="row_spacing">6</property>
-        <property name="column_spacing">6</property>
         <child>
-          <object class="GtkLabel" id="label_parents">
+          <object class="GtkGrid" id="grid_parents_container">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="label" translatable="yes">Parents</property>
-            <property name="xalign">0</property>
-            <attributes>
-              <attribute name="weight" value="bold"/>
-            </attributes>
+            <property name="margin_bottom">12</property>
+            <property name="row_spacing">6</property>
+            <property name="column_spacing">6</property>
+            <child>
+              <object class="GtkLabel" id="label_parents">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Parents</property>
+                <property name="xalign">0</property>
+                <attributes>
+                  <attribute name="weight" value="bold"/>
+                </attributes>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkGrid" id="grid_parents">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="margin_start">12</property>
+                <property name="hexpand">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">1</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="left_attach">0</property>
-            <property name="top_attach">0</property>
+            <property name="top_attach">2</property>
+            <property name="width">2</property>
           </packing>
         </child>
         <child>
-          <object class="GtkGrid" id="grid_parents">
+          <object class="GtkExpander" id="expander_files">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="margin_start">12</property>
-            <property name="hexpand">True</property>
+            <property name="can_focus">True</property>
+            <property name="valign">baseline</property>
+            <child type="label">
+              <object class="GtkLabel" id="label_expand_collapse_files">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Collapse all</property>
+              </object>
+            </child>
+            <style>
+              <class name="dim-label"/>
+            </style>
           </object>
           <packing>
             <property name="left_attach">0</property>
-            <property name="top_attach">1</property>
+            <property name="top_attach">3</property>
           </packing>
         </child>
       </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">2</property>
-        <property name="width">2</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkExpander" id="expander_files">
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="valign">baseline</property>
-        <child type="label">
-          <object class="GtkLabel" id="label_expand_collapse_files">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="label" translatable="yes">Collapse all</property>
-          </object>
-        </child>
-        <style>
-          <class name="dim-label"/>
-        </style>
-      </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">3</property>
-      </packing>
     </child>
   </template>
 </interface>
diff --git a/libgitg/resources/ui/gitg-diff-view-file.ui b/libgitg/resources/ui/gitg-diff-view-file.ui
index 979317d..ba07b3d 100644
--- a/libgitg/resources/ui/gitg-diff-view-file.ui
+++ b/libgitg/resources/ui/gitg-diff-view-file.ui
@@ -6,6 +6,7 @@
     <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="hexpand">True</property>
+    <property name="orientation">vertical</property>
     <style>
       <class name="gitg-file-header"/>
     </style>
@@ -14,12 +15,6 @@
         <property name="visible">True</property>
         <property name="can_focus">True</property>
         <property name="hexpand">True</property>
-        <child>
-          <object class="GtkGrid" id="grid_hunks">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-          </object>
-        </child>
         <child type="label">
           <object class="GtkGrid" id="grid_file_header">
             <property name="visible">True</property>
@@ -34,8 +29,11 @@
                 <property name="can_focus">False</property>
                 <property name="vexpand">False</property>
                 <property name="valign">baseline</property>
-                <property name="margin_top">12</property>
-                <property name="margin_bottom">12</property>
+                <property name="margin_top">6</property>
+                <property name="margin_bottom">6</property>
+                <style>
+                  <class name="no-frame"/>
+                </style>
               </object>
             </child>
             <child>
@@ -51,5 +49,19 @@
         </child>
       </object>
     </child>
+    <child>
+      <object class="GtkRevealer" id="revealer_hunks">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="transition_type">slide-down</property>
+        <child>
+          <object class="GtkGrid" id="grid_hunks">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="orientation">vertical</property>
+          </object>
+        </child>
+      </object>
+    </child>
   </template>
 </interface>
diff --git a/libgitg/resources/ui/gitg-diff-view-hunk.ui b/libgitg/resources/ui/gitg-diff-view-hunk.ui
index 302b077..a58132e 100644
--- a/libgitg/resources/ui/gitg-diff-view-hunk.ui
+++ b/libgitg/resources/ui/gitg-diff-view-hunk.ui
@@ -6,54 +6,31 @@
     <property name="visible">True</property>
     <property name="can_focus">True</property>
     <property name="hexpand">True</property>
-    <property name="orientation">vertical</property>
+    <style>
+      <class name="gitg-hunk-frame"/>
+    </style>
     <child>
-      <object class="GtkEventBox" id="event_box_hunk">
+      <object class="GtkSourceView" id="sourceview_hunk">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
+        <property name="show_line_numbers">False</property>
+        <property name="editable">False</property>
+        <property name="cursor_visible">False</property>
+        <property name="monospace">True</property>
+        <property name="hexpand">True</property>
+        <property name="pixels_above_lines">1</property>
+        <property name="pixels_below_lines">1</property>
+        <property name="left_margin">6</property>
+        <property name="right_margin">6</property>
+        <property name="buffer">buffer</property>
         <style>
-          <class name="gitg-hunk-header"/>
+          <class name="gitg-hunk-source"/>
         </style>
-        <child>
-          <object class="GtkLabel" id="label_hunk">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="halign">start</property>
-            <property name="margin_top">12</property>
-            <property name="margin_bottom">12</property>
-            <property name="margin_start">6</property>
-            <property name="margin_end">6</property>
-            <property name="wrap">True</property>
-            <style>
-              <class name="dim-label"/>
-            </style>
-          </object>
-        </child>
-      </object>
-    </child>
-    <child>
-      <object class="GtkFrame" id="frame_hunk">
-        <property name="visible">True</property>
-        <style>
-          <class name="gitg-hunk-frame"/>
-        </style>
-        <child>
-          <object class="GtkSourceView" id="sourceview_hunk">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="show_line_numbers">False</property>
-            <property name="editable">False</property>
-            <property name="cursor_visible">False</property>
-            <property name="monospace">True</property>
-            <property name="hexpand">True</property>
-            <property name="pixels_above_lines">1</property>
-            <property name="pixels_below_lines">1</property>
-            <style>
-              <class name="gitg-hunk-source"/>
-            </style>
-          </object>
-        </child>
       </object>
     </child>
   </template>
+  <object class="GtkSourceBuffer" id="buffer">
+    <property name="highlight_matching_brackets">False</property>
+    <property name="implicit_trailing_newline">False</property>
+  </object>
 </interface>
diff --git a/libgitg/resources/ui/gitg-diff-view.ui b/libgitg/resources/ui/gitg-diff-view.ui
index 82b3bc9..b373912 100644
--- a/libgitg/resources/ui/gitg-diff-view.ui
+++ b/libgitg/resources/ui/gitg-diff-view.ui
@@ -2,26 +2,29 @@
 <!-- Generated with glade 3.19.0 -->
 <interface>
   <requires lib="gtk+" version="3.16"/>
-  <template class="GitgDiffView" parent="GtkScrolledWindow">
+  <template class="GitgDiffView" parent="GtkGrid">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
+    <property name="orientation">vertical</property>
+    <property name="hexpand">True</property>
+    <property name="vexpand">True</property>
     <child>
-      <object class="GtkViewport" id="viewport">
+      <object class="GitgDiffViewCommitDetails" id="commit_details">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
+        <property name="hexpand">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkScrolledWindow" id="scrolledwindow">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="hexpand">True</property>
+        <property name="vexpand">True</property>
         <child>
-          <object class="GtkGrid" id="grid_main">
+          <object class="GtkViewport" id="viewport">
             <property name="visible">True</property>
-            <property name="orientation">vertical</property>
             <property name="can_focus">False</property>
-            <property name="hexpand">True</property>
-            <child>
-              <object class="GitgDiffViewCommitDetails" id="commit_details">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="hexpand">True</property>
-              </object>
-            </child>
             <child>
               <object class="GtkGrid" id="grid_files">
                 <property name="visible">True</property>
diff --git a/libgitg/resources/ui/libgitg-style.css b/libgitg/resources/ui/libgitg-style.css
index 0a14c06..1a751fe 100644
--- a/libgitg/resources/ui/libgitg-style.css
+++ b/libgitg/resources/ui/libgitg-style.css
@@ -13,26 +13,42 @@
        background-color: shade(@theme_bg_color, 0.95);
 }
 
-.gitg-hunk-frame {
+.gitg-diff-view-grid-files {
+       border-top: 1px solid @borders;
+}
+
+.diff-lines-border {
+       border-top: 0;
        border-left: 0;
-       border-right: 0;
+       border-bottom: 0;
+       border-right: 1px solid shade(@theme_bg_color, 0.95);
 }
 
-.gitg-diff-view-grid-files {
-       border-top: 1px solid @borders;
+.diff-lines-border.symbol {
+       border-right: 2px solid shade(@theme_bg_color, 0.95);
+}
+
+GitgDiffViewHunk GtkSourceView {
+       color: @insensitive_fg_color;
+}
+
+GitgDiffViewHunk GtkSourceView.view {
+       color: @theme_text_color;
+}
+
+GitgDiffView GitgDiffViewCommitDetails {
+       border-bottom: 1px outset lighter(@borders);
 }
 
 GitgDiffStat {
        border: 1px inset shade(@borders, 1.2);
        border-radius: 5px;
-       background-color: shade(@theme_bg_color, 1.2);
+       background-color: shade(@theme_base_color, 0.975);
        -GitgDiffStat-bar-height: 5px;
 }
 
 GitgDiffStat.no-frame {
        border: 0;
-       border-radius: 0;
-       background-color: inherit;
 }
 
 GitgDiffStat added,
@@ -44,7 +60,7 @@ GitgDiffStat.no-frame removed {
 
 GitgDiffStat added,
 GitgDiffStat.no-frame added {
-       background-color: #33cc33;
+       background-color: #ddffdd;
        border-radius: 3px 0px 0px 3px;
 }
 
@@ -55,7 +71,7 @@ GitgDiffStat.no-frame added:dir(rtl) {
 
 GitgDiffStat removed,
 GitgDiffStat.no-frame removed {
-       background-color: #cc3333;
+       background-color: #ffdddd;
        border-radius: 0px 3px 3px 0px;
 }
 


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