summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/find_bar_gtk.cc
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-12 22:16:57 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-12 22:16:57 +0000
commitc924d1ba4c65d8fbb382cc03c81f2d2ef1d21d2d (patch)
treec00816fc2661caee73d114ed6a8945ec36daa2f1 /chrome/browser/gtk/find_bar_gtk.cc
parent15e302df0152a3c3330dd54fd58d941f41d238b9 (diff)
downloadchromium_src-c924d1ba4c65d8fbb382cc03c81f2d2ef1d21d2d.zip
chromium_src-c924d1ba4c65d8fbb382cc03c81f2d2ef1d21d2d.tar.gz
chromium_src-c924d1ba4c65d8fbb382cc03c81f2d2ef1d21d2d.tar.bz2
Use a bool instead of disconnecting/reconnecting the changed
signal handler. I don't really care one way or the other :) Review URL: http://codereview.chromium.org/118518 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18327 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/find_bar_gtk.cc')
-rw-r--r--chrome/browser/gtk/find_bar_gtk.cc17
1 files changed, 9 insertions, 8 deletions
diff --git a/chrome/browser/gtk/find_bar_gtk.cc b/chrome/browser/gtk/find_bar_gtk.cc
index 42ddcaa..be174b5 100644
--- a/chrome/browser/gtk/find_bar_gtk.cc
+++ b/chrome/browser/gtk/find_bar_gtk.cc
@@ -69,7 +69,8 @@ gboolean OnExpose(GtkWidget* widget, GdkEventExpose* e, gpointer userdata) {
} // namespace
FindBarGtk::FindBarGtk(BrowserWindowGtk* browser)
- : container_shaped_(false) {
+ : container_shaped_(false),
+ ignore_changed_signal_(false) {
InitWidgets();
// Insert the widget into the browser gtk hierarchy.
@@ -77,8 +78,8 @@ FindBarGtk::FindBarGtk(BrowserWindowGtk* browser)
// Hook up signals after the widget has been added to the hierarchy so the
// widget will be realized.
- changed_handler_id_ = g_signal_connect(text_entry_, "changed",
- G_CALLBACK(OnChanged), this);
+ g_signal_connect(text_entry_, "changed",
+ G_CALLBACK(OnChanged), this);
g_signal_connect(text_entry_, "key-press-event",
G_CALLBACK(OnKeyPressEvent), this);
g_signal_connect(text_entry_, "key-release-event",
@@ -233,12 +234,11 @@ void FindBarGtk::MoveWindowIfNecessary(const gfx::Rect& selection_rect,
void FindBarGtk::SetFindText(const string16& find_text) {
std::string text_entry_utf8 = UTF16ToUTF8(find_text);
- // Unhook the "changed" signal handler because programatically setting the
+ // Ignore the "changed" signal handler because programatically setting the
// text should not fire a "changed" event.
- g_signal_handler_disconnect(text_entry_, changed_handler_id_);
+ ignore_changed_signal_ = true;
gtk_entry_set_text(GTK_ENTRY(text_entry_), text_entry_utf8.c_str());
- changed_handler_id_ = g_signal_connect(text_entry_, "changed",
- G_CALLBACK(OnChanged), this);
+ ignore_changed_signal_ = false;
}
void FindBarGtk::UpdateUIForFindResult(const FindNotificationDetails& result,
@@ -385,7 +385,8 @@ bool FindBarGtk::MaybeForwardKeyEventToRenderer(GdkEventKey* event) {
// static
gboolean FindBarGtk::OnChanged(GtkWindow* window, FindBarGtk* find_bar) {
- find_bar->FindEntryTextInContents(true);
+ if (!find_bar->ignore_changed_signal_)
+ find_bar->FindEntryTextInContents(true);
return FALSE;
}