Commit e9958e51 authored by Kai Willadsen's avatar Kai Willadsen

Make FindBar close on focus loss and remove close button

parent a7a8b132
......@@ -84,25 +84,6 @@
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkButton" id="findbar_close">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="focus_on_click">False</property>
<child>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="stock">gtk-cancel</property>
<property name="icon_size">1</property>
</object>
</child>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="find_label">
<property name="visible">True</property>
......
......@@ -325,7 +325,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
self.set_num_panes(num_panes)
gobject.idle_add( lambda *args: self.load_font()) # hack around Bug 316730
gnomeglade.connect_signal_handlers(self)
self.findbar = findbar.FindBar()
self.findbar = findbar.FindBar(self.filediff)
self.filediff.pack_end(self.findbar.widget, False)
self.cursor = CursorDetails()
self.connect("current-diff-changed", self.on_current_diff_changed)
......
### Copyright (C) 2002-2009 Stephen Kennedy <stevek@gnome.org>
### Copyright (C) 2012 Kai Willadsen <kai.willadsen@gmail.com>
### This program is free software; you can redistribute it and/or modify
### it under the terms of the GNU General Public License as published by
......@@ -22,11 +23,18 @@ import re
from gettext import gettext as _
class FindBar(gnomeglade.Component):
def __init__(self):
def __init__(self, parent):
gnomeglade.Component.__init__(self, paths.ui_dir("findbar.ui"), "findbar")
gnomeglade.connect_signal_handlers(self)
self.textview = None
self.orig_base_color = self.find_entry.get_style().base[0]
parent.connect('set-focus-child', self.on_focus_child)
def on_focus_child(self, container, widget):
if widget is not None:
if widget is not self.widget and self.widget.get_visible():
self.hide()
return False
def hide(self):
self.textview = None
......@@ -64,9 +72,6 @@ class FindBar(gnomeglade.Component):
self.widget.show_all()
self.find_entry.grab_focus()
def on_findbar_close__clicked(self, button):
self.hide()
def on_find_entry__activate(self, entry):
self.find_next_button.activate()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment