diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-19 23:10:03 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-19 23:10:03 +0000 |
commit | bcf7b4cd481e500654cd6d50e74283c6c24e276f (patch) | |
tree | 3d3c431567762a3f41b5693d075743463c2f945c | |
parent | 8959bfdd84f02ec2e3cfe892248128f38cd4955d (diff) | |
download | chromium_src-bcf7b4cd481e500654cd6d50e74283c6c24e276f.zip chromium_src-bcf7b4cd481e500654cd6d50e74283c6c24e276f.tar.gz chromium_src-bcf7b4cd481e500654cd6d50e74283c6c24e276f.tar.bz2 |
Cleanup: Put signal handlers in alphabetical order. Group a couple other things in a way that seems better to me.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3135034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56767 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/gtk/reload_button_gtk.cc | 39 | ||||
-rw-r--r-- | chrome/browser/gtk/reload_button_gtk.h | 2 |
2 files changed, 20 insertions, 21 deletions
diff --git a/chrome/browser/gtk/reload_button_gtk.cc b/chrome/browser/gtk/reload_button_gtk.cc index bda9937..78b2c46 100644 --- a/chrome/browser/gtk/reload_button_gtk.cc +++ b/chrome/browser/gtk/reload_button_gtk.cc @@ -38,12 +38,12 @@ ReloadButtonGtk::ReloadButtonGtk(LocationBarViewGtk* location_bar, gtk_widget_set_app_paintable(widget_.get(), TRUE); + g_signal_connect(widget_.get(), "clicked", + G_CALLBACK(OnClickedThunk), this); g_signal_connect(widget_.get(), "expose-event", G_CALLBACK(OnExposeThunk), this); g_signal_connect(widget_.get(), "leave-notify-event", G_CALLBACK(OnLeaveNotifyThunk), this); - g_signal_connect(widget_.get(), "clicked", - G_CALLBACK(OnClickedThunk), this); GTK_WIDGET_UNSET_FLAGS(widget_.get(), GTK_CAN_FOCUS); gtk_widget_set_has_tooltip(widget_.get(), TRUE); @@ -76,9 +76,9 @@ void ReloadButtonGtk::ChangeMode(Mode mode, bool force) { !timer_running() : (visible_mode_ != MODE_STOP))) { timer_.Stop(); visible_mode_ = mode; - gtk_widget_queue_draw(widget_.get()); UpdateThemeButtons(); + gtk_widget_queue_draw(widget_.get()); } } @@ -98,20 +98,6 @@ void ReloadButtonGtk::OnButtonTimer() { ChangeMode(intended_mode_, true); } -gboolean ReloadButtonGtk::OnExpose(GtkWidget* widget, - GdkEventExpose* e) { - if (theme_provider_ && theme_provider_->UseGtkTheme()) - return FALSE; - return ((visible_mode_ == MODE_RELOAD) ? reload_ : stop_).OnExpose( - widget, e, hover_controller_.GetCurrentValue()); -} - -gboolean ReloadButtonGtk::OnLeaveNotify(GtkWidget* widget, - GdkEventCrossing* event) { - ChangeMode(intended_mode_, true); - return FALSE; -} - void ReloadButtonGtk::OnClicked(GtkWidget* sender) { if (visible_mode_ == MODE_STOP) { if (browser_) @@ -154,18 +140,31 @@ void ReloadButtonGtk::OnClicked(GtkWidget* sender) { NULL); } - // Stop the timer. - timer_.Stop(); - // Start a timer - while this timer is running, the reload button cannot be // changed to a stop button. We do not set |intended_mode_| to MODE_STOP // here as we want to wait for the browser to tell us that it has started // loading (and this may occur only after some delay). + timer_.Stop(); timer_.Start(base::TimeDelta::FromMilliseconds(button_delay_), this, &ReloadButtonGtk::OnButtonTimer); } } +gboolean ReloadButtonGtk::OnExpose(GtkWidget* widget, + GdkEventExpose* e) { + if (theme_provider_ && theme_provider_->UseGtkTheme()) + return FALSE; + return ((visible_mode_ == MODE_RELOAD) ? reload_ : stop_).OnExpose( + widget, e, hover_controller_.GetCurrentValue()); +} + +gboolean ReloadButtonGtk::OnLeaveNotify(GtkWidget* widget, + GdkEventCrossing* event) { + is_mouse_hovered_ = false; + ChangeMode(intended_mode_, false); + return FALSE; +} + gboolean ReloadButtonGtk::OnQueryTooltip(GtkWidget* sender, gint x, gint y, diff --git a/chrome/browser/gtk/reload_button_gtk.h b/chrome/browser/gtk/reload_button_gtk.h index 2de1c4c..2a152a4 100644 --- a/chrome/browser/gtk/reload_button_gtk.h +++ b/chrome/browser/gtk/reload_button_gtk.h @@ -42,10 +42,10 @@ class ReloadButtonGtk : public NotificationObserver { private: friend class ReloadButtonGtkPeer; + CHROMEGTK_CALLBACK_0(ReloadButtonGtk, void, OnClicked); CHROMEGTK_CALLBACK_1(ReloadButtonGtk, gboolean, OnExpose, GdkEventExpose*); CHROMEGTK_CALLBACK_1(ReloadButtonGtk, gboolean, OnLeaveNotify, GdkEventCrossing*); - CHROMEGTK_CALLBACK_0(ReloadButtonGtk, void, OnClicked); CHROMEGTK_CALLBACK_4(ReloadButtonGtk, gboolean, OnQueryTooltip, gint, gint, gboolean, GtkTooltip*); |