diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-07 02:55:16 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-07 02:55:16 +0000 |
commit | 65086eadd2a68f07bd15f888ac4cb9e6c0758d1e (patch) | |
tree | 6f52d3c48867039ffbf80e9ae7f0868f82acc4c9 | |
parent | f3d0174b68971b96dd2e8f518d81abee1fc87645 (diff) | |
download | chromium_src-65086eadd2a68f07bd15f888ac4cb9e6c0758d1e.zip chromium_src-65086eadd2a68f07bd15f888ac4cb9e6c0758d1e.tar.gz chromium_src-65086eadd2a68f07bd15f888ac4cb9e6c0758d1e.tar.bz2 |
gtk: Make use of gtk signal macros in SelectionChange events.
BUG=None
TEST=manually
Patch from Thiago Farina <thiag.farina@gmail.com>
Review URL: http://codereview.chromium.org/1999004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46655 0039d316-1c4b-4281-b951-d872f2087c98
9 files changed, 32 insertions, 50 deletions
diff --git a/chrome/browser/gtk/options/general_page_gtk.cc b/chrome/browser/gtk/options/general_page_gtk.cc index 3aaba5c..cccdcad 100644 --- a/chrome/browser/gtk/options/general_page_gtk.cc +++ b/chrome/browser/gtk/options/general_page_gtk.cc @@ -244,7 +244,7 @@ GtkWidget* GeneralPageGtk::InitStartupGroup() { gtk_tree_selection_set_mode(startup_custom_pages_selection_, GTK_SELECTION_MULTIPLE); g_signal_connect(startup_custom_pages_selection_, "changed", - G_CALLBACK(OnStartupPagesSelectionChanged), this); + G_CALLBACK(OnStartupPagesSelectionChangedThunk), this); favicon_loader_.reset(new ListStoreFavIconLoader(startup_custom_pages_model_, COL_FAVICON, COL_FAVICON_HANDLE, @@ -420,10 +420,9 @@ void GeneralPageGtk::OnStartupUseCurrentPageClicked(GtkWidget* button) { SetCustomUrlListFromCurrentPages(); } -// static void GeneralPageGtk::OnStartupPagesSelectionChanged( - GtkTreeSelection* selection, GeneralPageGtk* general_page) { - general_page->EnableCustomHomepagesControls(true); + GtkTreeSelection* selection) { + EnableCustomHomepagesControls(true); } void GeneralPageGtk::OnNewTabIsHomePageToggled(GtkWidget* toggle_button) { diff --git a/chrome/browser/gtk/options/general_page_gtk.h b/chrome/browser/gtk/options/general_page_gtk.h index b1f767c..22885c3 100644 --- a/chrome/browser/gtk/options/general_page_gtk.h +++ b/chrome/browser/gtk/options/general_page_gtk.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -29,9 +29,7 @@ class GeneralPageGtk : public OptionsPageBase, explicit GeneralPageGtk(Profile* profile); ~GeneralPageGtk(); - GtkWidget* get_page_widget() const { - return page_; - } + GtkWidget* get_page_widget() const { return page_; } private: // Overridden from OptionsPageBase @@ -98,8 +96,8 @@ class GeneralPageGtk : public OptionsPageBase, OnDefaultSearchManageEnginesClicked); CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnBrowserUseAsDefaultClicked); - static void OnStartupPagesSelectionChanged(GtkTreeSelection* selection, - GeneralPageGtk* general_page); + CHROMEG_CALLBACK_0(GeneralPageGtk, void, OnStartupPagesSelectionChanged, + GtkTreeSelection*); // Enables/Disables the controls associated with the custom start pages // option if that preference is not selected. diff --git a/chrome/browser/gtk/options/languages_page_gtk.cc b/chrome/browser/gtk/options/languages_page_gtk.cc index cae414a..f33a97c 100644 --- a/chrome/browser/gtk/options/languages_page_gtk.cc +++ b/chrome/browser/gtk/options/languages_page_gtk.cc @@ -166,7 +166,7 @@ void LanguagesPageGtk::Init() { gtk_tree_selection_set_mode(language_order_selection_, GTK_SELECTION_MULTIPLE); g_signal_connect(language_order_selection_, "changed", - G_CALLBACK(OnSelectionChanged), this); + G_CALLBACK(OnSelectionChangedThunk), this); GtkWidget* scroll_window = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll_window), GTK_POLICY_AUTOMATIC, @@ -356,10 +356,8 @@ void LanguagesPageGtk::OnAddLanguage(const std::string& new_language) { GTK_TREE_VIEW(language_order_tree_)); } -// static -void LanguagesPageGtk::OnSelectionChanged(GtkTreeSelection *selection, - LanguagesPageGtk* languages_page) { - languages_page->EnableControls(); +void LanguagesPageGtk::OnSelectionChanged(GtkTreeSelection* selection) { + EnableControls(); } void LanguagesPageGtk::OnAddButtonClicked(GtkWidget* button) { diff --git a/chrome/browser/gtk/options/languages_page_gtk.h b/chrome/browser/gtk/options/languages_page_gtk.h index b7140ae..69c72d6 100644 --- a/chrome/browser/gtk/options/languages_page_gtk.h +++ b/chrome/browser/gtk/options/languages_page_gtk.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -33,9 +33,7 @@ class LanguagesPageGtk explicit LanguagesPageGtk(Profile* profile); virtual ~LanguagesPageGtk(); - GtkWidget* get_page_widget() const { - return page_; - } + GtkWidget* get_page_widget() const { return page_; } // gtk_tree::TableAdapter::Delegate implementation. virtual void OnAnyModelUpdate(); @@ -63,8 +61,8 @@ class LanguagesPageGtk virtual void NotifyPrefChanged(const std::wstring* pref_name); // Callbacks for accept languages widgets. - static void OnSelectionChanged(GtkTreeSelection* selection, - LanguagesPageGtk* languages_page); + CHROMEG_CALLBACK_0(LanguagesPageGtk, void, OnSelectionChanged, + GtkTreeSelection*); CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void, OnAddButtonClicked); CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void, OnRemoveButtonClicked); CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void, OnMoveUpButtonClicked); diff --git a/chrome/browser/gtk/options/passwords_exceptions_page_gtk.cc b/chrome/browser/gtk/options/passwords_exceptions_page_gtk.cc index 8162610..9405fe1 100644 --- a/chrome/browser/gtk/options/passwords_exceptions_page_gtk.cc +++ b/chrome/browser/gtk/options/passwords_exceptions_page_gtk.cc @@ -90,7 +90,7 @@ void PasswordsExceptionsPageGtk::InitExceptionTree() { gtk_tree_selection_set_mode(exception_selection_, GTK_SELECTION_SINGLE); g_signal_connect(exception_selection_, "changed", - G_CALLBACK(OnExceptionSelectionChanged), this); + G_CALLBACK(OnExceptionSelectionChangedThunk), this); GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( l10n_util::GetStringUTF8(IDS_PASSWORDS_PAGE_VIEW_SITE_COLUMN).c_str(), @@ -162,16 +162,14 @@ void PasswordsExceptionsPageGtk::OnRemoveAllButtonClicked(GtkWidget* widget) { gtk_widget_set_sensitive(remove_all_button_, FALSE); } -// static void PasswordsExceptionsPageGtk::OnExceptionSelectionChanged( - GtkTreeSelection* selection, - PasswordsExceptionsPageGtk* page) { + GtkTreeSelection* selection) { GtkTreeIter iter; if (!gtk_tree_selection_get_selected(selection, NULL, &iter)) { - gtk_widget_set_sensitive(page->remove_button_, FALSE); + gtk_widget_set_sensitive(remove_button_, FALSE); return; } - gtk_widget_set_sensitive(page->remove_button_, TRUE); + gtk_widget_set_sensitive(remove_button_, TRUE); } // static diff --git a/chrome/browser/gtk/options/passwords_exceptions_page_gtk.h b/chrome/browser/gtk/options/passwords_exceptions_page_gtk.h index 0fd350a..3466412 100644 --- a/chrome/browser/gtk/options/passwords_exceptions_page_gtk.h +++ b/chrome/browser/gtk/options/passwords_exceptions_page_gtk.h @@ -21,9 +21,7 @@ class PasswordsExceptionsPageGtk { explicit PasswordsExceptionsPageGtk(Profile* profile); ~PasswordsExceptionsPageGtk(); - GtkWidget* get_page_widget() const { - return page_; - } + GtkWidget* get_page_widget() const { return page_; } private: // Initialize the exception tree widget, setting the member variables. @@ -39,9 +37,8 @@ class PasswordsExceptionsPageGtk { CHROMEGTK_CALLBACK_0(PasswordsExceptionsPageGtk, void, OnRemoveAllButtonClicked); - static void OnExceptionSelectionChanged( - GtkTreeSelection* selection, - PasswordsExceptionsPageGtk* page); + CHROMEG_CALLBACK_0(PasswordsExceptionsPageGtk, void, + OnExceptionSelectionChanged, GtkTreeSelection*); // Sorting function. static gint CompareSite(GtkTreeModel* model, diff --git a/chrome/browser/gtk/options/passwords_page_gtk.h b/chrome/browser/gtk/options/passwords_page_gtk.h index 9cf8e38..59de866 100644 --- a/chrome/browser/gtk/options/passwords_page_gtk.h +++ b/chrome/browser/gtk/options/passwords_page_gtk.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -18,9 +18,7 @@ class PasswordsPageGtk { explicit PasswordsPageGtk(Profile* profile); ~PasswordsPageGtk(); - GtkWidget* get_page_widget() const { - return page_; - } + GtkWidget* get_page_widget() const { return page_; } private: // Initialize the password tree widget, setting the member variables. @@ -37,11 +35,8 @@ class PasswordsPageGtk { CHROMEGTK_CALLBACK_1(PasswordsPageGtk, void, OnRemoveAllConfirmResponse, int); CHROMEGTK_CALLBACK_0(PasswordsPageGtk, void, OnShowPasswordButtonClicked); - static void OnPasswordSelectionChangedThunk(GtkTreeSelection* selection, - PasswordsPageGtk* page) { - page->OnPasswordSelectionChanged(selection); - } - void OnPasswordSelectionChanged(GtkTreeSelection* selection); + CHROMEG_CALLBACK_0(PasswordsPageGtk, void, OnPasswordSelectionChanged, + GtkTreeSelection*); // Sorting functions. static gint CompareSite(GtkTreeModel* model, diff --git a/chrome/browser/gtk/options/url_picker_dialog_gtk.cc b/chrome/browser/gtk/options/url_picker_dialog_gtk.cc index 11a50ea..860a33f 100644 --- a/chrome/browser/gtk/options/url_picker_dialog_gtk.cc +++ b/chrome/browser/gtk/options/url_picker_dialog_gtk.cc @@ -117,7 +117,7 @@ UrlPickerDialogGtk::UrlPickerDialogGtk(UrlPickerCallback* callback, gtk_tree_selection_set_mode(history_selection_, GTK_SELECTION_SINGLE); g_signal_connect(history_selection_, "changed", - G_CALLBACK(OnHistorySelectionChanged), this); + G_CALLBACK(OnHistorySelectionChangedThunk), this); // History list columns. GtkTreeViewColumn* column = gtk_tree_view_column_new(); @@ -245,18 +245,17 @@ void UrlPickerDialogGtk::OnUrlEntryChanged(GtkWidget* editable) { EnableControls(); } -// static void UrlPickerDialogGtk::OnHistorySelectionChanged( - GtkTreeSelection *selection, UrlPickerDialogGtk* window) { + GtkTreeSelection* selection) { GtkTreeIter iter; if (!gtk_tree_selection_get_selected(selection, NULL, &iter)) { // The user has unselected the history element, nothing to do. return; } GtkTreePath* path = gtk_tree_model_get_path( - GTK_TREE_MODEL(window->history_list_sort_), &iter); - gtk_entry_set_text(GTK_ENTRY(window->url_entry_), - window->GetURLForPath(path).c_str()); + GTK_TREE_MODEL(history_list_sort_), &iter); + gtk_entry_set_text(GTK_ENTRY(url_entry_), + GetURLForPath(path).c_str()); gtk_tree_path_free(path); } diff --git a/chrome/browser/gtk/options/url_picker_dialog_gtk.h b/chrome/browser/gtk/options/url_picker_dialog_gtk.h index a911cc7..ed2d4a0 100644 --- a/chrome/browser/gtk/options/url_picker_dialog_gtk.h +++ b/chrome/browser/gtk/options/url_picker_dialog_gtk.h @@ -54,8 +54,8 @@ class UrlPickerDialogGtk : public gtk_tree::TableAdapter::Delegate { CHROMEGTK_CALLBACK_0(UrlPickerDialogGtk, void, OnWindowDestroy); // Callback for user selecting rows in recent history list. - static void OnHistorySelectionChanged(GtkTreeSelection* selection, - UrlPickerDialogGtk* window); + CHROMEG_CALLBACK_0(UrlPickerDialogGtk, void, OnHistorySelectionChanged, + GtkTreeSelection*) // The dialog window. GtkWidget* dialog_; |