[gitg] Only update selection attributes/tag when handle_selection



commit 2d09ac2cf05f1c85bdc767e432ed5f4f6cb6c600
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Sun Dec 20 13:24:48 2015 +0100

    Only update selection attributes/tag when handle_selection

 libgitg/gitg-diff-view-file.vala |   29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)
---
diff --git a/libgitg/gitg-diff-view-file.vala b/libgitg/gitg-diff-view-file.vala
index 6a40326..5bbe4f1 100644
--- a/libgitg/gitg-diff-view-file.vala
+++ b/libgitg/gitg-diff-view-file.vala
@@ -194,7 +194,6 @@ class Gitg.DiffViewFile : Gtk.Grid
 
        private void update_theme()
        {
-               var selection_attributes = new Gtk.SourceMarkAttributes();
                var header_attributes = new Gtk.SourceMarkAttributes();
                var added_attributes = new Gtk.SourceMarkAttributes();
                var removed_attributes = new Gtk.SourceMarkAttributes();
@@ -214,21 +213,25 @@ class Gitg.DiffViewFile : Gtk.Grid
                        removed_attributes.background = Gdk.RGBA() { red = 1.0, green = 220.0 / 255.0, blue = 
220.0 / 255.0, alpha = 1.0 };
                }
 
-               var context = d_sourceview_hunks.get_style_context();
+               if (handle_selection)
+               {
+                       var selection_attributes = new Gtk.SourceMarkAttributes();
+                       var context = d_sourceview_hunks.get_style_context();
 
-               Gdk.RGBA theme_selected_bg_color, theme_selected_fg_color;
+                       Gdk.RGBA theme_selected_bg_color, theme_selected_fg_color;
 
-               if (context.lookup_color("theme_selected_bg_color", out theme_selected_bg_color))
-               {
-                       selection_attributes.background = theme_selected_bg_color;
-               }
-               
-               if (context.lookup_color("theme_selected_fg_color", out theme_selected_fg_color))
-               {
-                       d_selection_tag.foreground_rgba = theme_selected_fg_color;
-               }
+                       if (context.lookup_color("theme_selected_bg_color", out theme_selected_bg_color))
+                       {
+                               selection_attributes.background = theme_selected_bg_color;
+                       }
+                       
+                       if (context.lookup_color("theme_selected_fg_color", out theme_selected_fg_color))
+                       {
+                               d_selection_tag.foreground_rgba = theme_selected_fg_color;
+                       }
 
-               d_sourceview_hunks.set_mark_attributes(d_selection_category, selection_attributes, 0);
+                       d_sourceview_hunks.set_mark_attributes(d_selection_category, selection_attributes, 0);
+               }
 
                d_sourceview_hunks.set_mark_attributes("header", header_attributes, 0);
                d_sourceview_hunks.set_mark_attributes("added", added_attributes, 0);


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