[meld] If no match found, set search entry background to red



commit e92ef10620dfbd90159a8b2a827cf463aa819594
Author: Robert Roth <robert roth off gmail com>
Date:   Sat Jun 28 01:31:37 2014 +0300

    If no match found, set search entry background to red

 data/meld.css      |    6 ++++++
 meld/ui/findbar.py |   12 ++----------
 2 files changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/data/meld.css b/data/meld.css
index 9108c3d..8f21083 100644
--- a/data/meld.css
+++ b/data/meld.css
@@ -42,3 +42,9 @@ LinkMap {
     border-style: solid;
     border-color: @borders;
 }
+
+.not-found {
+    color: white;
+    background-image: none;
+    background-color: rgb (237, 54, 54);
+}
diff --git a/meld/ui/findbar.py b/meld/ui/findbar.py
index f4f5887..25088fc 100644
--- a/meld/ui/findbar.py
+++ b/meld/ui/findbar.py
@@ -30,7 +30,6 @@ class FindBar(gnomeglade.Component):
                                       ["arrow_left", "arrow_right"])
         self.set_text_view(None)
         context = self.find_entry.get_style_context()
-        self.orig_base_color = context.get_background_color(Gtk.StateFlags.NORMAL)
         self.arrow_left.show()
         self.arrow_right.show()
         parent.connect('set-focus-child', self.on_focus_child)
@@ -127,8 +126,7 @@ class FindBar(gnomeglade.Component):
                 buf.get_insert(), 0.25, True, 0.5, 0.5)
 
     def on_find_entry_changed(self, entry):
-        entry.override_background_color(Gtk.StateType.NORMAL,
-                                        self.orig_base_color)
+        self.find_entry.get_style_context().remove_class("not-found")
         self._find_text(0)
 
     def _find_text(self, start_offset=1, backwards=False, wrap=True):
@@ -166,11 +164,5 @@ class FindBar(gnomeglade.Component):
             return True
         else:
             buf.place_cursor(buf.get_iter_at_mark(buf.get_insert()))
-            # FIXME: Even though docs suggest this should work, it does
-            # not. It just sets the selection colour on the text, without
-            # affecting the entry colour at all.
-            color = Gdk.RGBA()
-            color.parse("#ffdddd")
-            self.find_entry.override_background_color(
-                Gtk.StateType.NORMAL, color)
+            self.find_entry.get_style_context().add_class("not-found")
             self.wrap_box.set_visible(False)


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