summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/gtk/find_bar_gtk.cc10
-rw-r--r--chrome/browser/gtk/find_bar_gtk.h4
2 files changed, 12 insertions, 2 deletions
diff --git a/chrome/browser/gtk/find_bar_gtk.cc b/chrome/browser/gtk/find_bar_gtk.cc
index ae285cb..95b33005 100644
--- a/chrome/browser/gtk/find_bar_gtk.cc
+++ b/chrome/browser/gtk/find_bar_gtk.cc
@@ -76,8 +76,8 @@ FindBarGtk::FindBarGtk(BrowserWindowGtk* browser)
// Hook up signals after the widget has been added to the hierarchy so the
// widget will be realized.
- g_signal_connect(text_entry_, "changed",
- G_CALLBACK(OnChanged), this);
+ changed_handler_id_ = g_signal_connect(text_entry_, "changed",
+ G_CALLBACK(OnChanged), this);
g_signal_connect(text_entry_, "key-press-event",
G_CALLBACK(OnKeyPressEvent), this);
// When the user tabs to us or clicks on us, save where the focus used to
@@ -229,7 +229,13 @@ 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
+ // text should not fire a "changed" event.
+ g_signal_handler_disconnect(text_entry_, changed_handler_id_);
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);
}
void FindBarGtk::UpdateUIForFindResult(const FindNotificationDetails& result,
diff --git a/chrome/browser/gtk/find_bar_gtk.h b/chrome/browser/gtk/find_bar_gtk.h
index 07171ed..6fab781 100644
--- a/chrome/browser/gtk/find_bar_gtk.h
+++ b/chrome/browser/gtk/find_bar_gtk.h
@@ -139,6 +139,10 @@ class FindBarGtk : public FindBar,
// Saves where the focus used to be whenever we get it.
FocusStoreGtk focus_store_;
+ // Keep track of the "changed" signal handler so we can unhook it when we
+ // don't need it.
+ unsigned int changed_handler_id_;
+
DISALLOW_COPY_AND_ASSIGN(FindBarGtk);
};