diff options
author | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-16 18:30:47 +0000 |
---|---|---|
committer | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-16 18:30:47 +0000 |
commit | c0b99038c58d79f7c1032f35dfb0eb62279a2d0d (patch) | |
tree | 92fbe908e564e72c45d206298a80236340a1034a /chrome/browser/gtk/find_bar_gtk.cc | |
parent | 027ec5f2dc1e9a26aea297623f1784592de7d562 (diff) | |
download | chromium_src-c0b99038c58d79f7c1032f35dfb0eb62279a2d0d.zip chromium_src-c0b99038c58d79f7c1032f35dfb0eb62279a2d0d.tar.gz chromium_src-c0b99038c58d79f7c1032f35dfb0eb62279a2d0d.tar.bz2 |
Move a bunch of our GTK code that was previous manually handling references (and often doing it incorrect / leaking) to use an OwnedWidgetGtk.
Review URL: http://codereview.chromium.org/48007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11750 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/find_bar_gtk.cc')
-rw-r--r-- | chrome/browser/gtk/find_bar_gtk.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/chrome/browser/gtk/find_bar_gtk.cc b/chrome/browser/gtk/find_bar_gtk.cc index 2398770..f4dc247 100644 --- a/chrome/browser/gtk/find_bar_gtk.cc +++ b/chrome/browser/gtk/find_bar_gtk.cc @@ -28,11 +28,12 @@ gboolean KeyPressEvent(GtkWindow* window, GdkEventKey* event, } FindBarGtk::FindBarGtk() { + // TODO(tc): Pull out widget creation into an Init() method. find_text_ = gtk_entry_new(); gtk_widget_show(find_text_); - container_ = gtk_hbox_new(false, 2); - gtk_box_pack_end(GTK_BOX(container_), find_text_, FALSE, FALSE, 0); + container_.Own(gtk_hbox_new(false, 2)); + gtk_box_pack_end(GTK_BOX(container_.get()), find_text_, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(find_text_), "changed", G_CALLBACK(EntryContentsChanged), this); @@ -40,15 +41,19 @@ FindBarGtk::FindBarGtk() { G_CALLBACK(KeyPressEvent), this); } +FindBarGtk::~FindBarGtk() { + container_.Destroy(); +} + void FindBarGtk::Show() { // TODO(tc): This should be an animated slide in. - gtk_widget_show(container_); + gtk_widget_show(container_.get()); gtk_widget_grab_focus(find_text_); } void FindBarGtk::Hide(bool animate) { // TODO(tc): Animated slide away. - gtk_widget_hide(container_); + gtk_widget_hide(container_.get()); } void FindBarGtk::SetFocusAndSelection() { @@ -76,7 +81,7 @@ void FindBarGtk::SetDialogPosition(const gfx::Rect& new_pos, bool no_redraw) { } bool FindBarGtk::IsFindBarVisible() { - return true; + return GTK_WIDGET_VISIBLE(container_.get()); } void FindBarGtk::RestoreSavedFocus() { |