Skip to content

Commit e92ef10

Browse files
evfoolkaiw
authored andcommitted
If no match found, set search entry background to red
1 parent 433b7b3 commit e92ef10

2 files changed

Lines changed: 8 additions & 10 deletions

File tree

data/meld.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,9 @@ LinkMap {
4242
border-style: solid;
4343
border-color: @borders;
4444
}
45+
46+
.not-found {
47+
color: white;
48+
background-image: none;
49+
background-color: rgb (237, 54, 54);
50+
}

meld/ui/findbar.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ def __init__(self, parent):
3030
["arrow_left", "arrow_right"])
3131
self.set_text_view(None)
3232
context = self.find_entry.get_style_context()
33-
self.orig_base_color = context.get_background_color(Gtk.StateFlags.NORMAL)
3433
self.arrow_left.show()
3534
self.arrow_right.show()
3635
parent.connect('set-focus-child', self.on_focus_child)
@@ -127,8 +126,7 @@ def on_replace_all_button_clicked(self, entry):
127126
buf.get_insert(), 0.25, True, 0.5, 0.5)
128127

129128
def on_find_entry_changed(self, entry):
130-
entry.override_background_color(Gtk.StateType.NORMAL,
131-
self.orig_base_color)
129+
self.find_entry.get_style_context().remove_class("not-found")
132130
self._find_text(0)
133131

134132
def _find_text(self, start_offset=1, backwards=False, wrap=True):
@@ -166,11 +164,5 @@ def _find_text(self, start_offset=1, backwards=False, wrap=True):
166164
return True
167165
else:
168166
buf.place_cursor(buf.get_iter_at_mark(buf.get_insert()))
169-
# FIXME: Even though docs suggest this should work, it does
170-
# not. It just sets the selection colour on the text, without
171-
# affecting the entry colour at all.
172-
color = Gdk.RGBA()
173-
color.parse("#ffdddd")
174-
self.find_entry.override_background_color(
175-
Gtk.StateType.NORMAL, color)
167+
self.find_entry.get_style_context().add_class("not-found")
176168
self.wrap_box.set_visible(False)

0 commit comments

Comments
 (0)