Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(449)

Side by Side Diff: chrome/browser/ui/gtk/instant_confirm_dialog_gtk.cc

Issue 6627038: gtk: Rename OnDialogResponse() to OnResponse() to standardize on a consistent naming scheme. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/gtk/instant_confirm_dialog_gtk.h" 5 #include "chrome/browser/ui/gtk/instant_confirm_dialog_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "chrome/browser/instant/instant_confirm_dialog.h" 9 #include "chrome/browser/instant/instant_confirm_dialog.h"
10 #include "chrome/browser/instant/instant_controller.h" 10 #include "chrome/browser/instant/instant_controller.h"
(...skipping 16 matching lines...) Expand all
27 27
28 InstantConfirmDialogGtk::InstantConfirmDialogGtk( 28 InstantConfirmDialogGtk::InstantConfirmDialogGtk(
29 GtkWindow* parent, Profile* profile) : profile_(profile) { 29 GtkWindow* parent, Profile* profile) : profile_(profile) {
30 dialog_ = gtk_dialog_new_with_buttons( 30 dialog_ = gtk_dialog_new_with_buttons(
31 l10n_util::GetStringUTF8(IDS_INSTANT_OPT_IN_TITLE).c_str(), 31 l10n_util::GetStringUTF8(IDS_INSTANT_OPT_IN_TITLE).c_str(),
32 parent, 32 parent,
33 static_cast<GtkDialogFlags>(GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR), 33 static_cast<GtkDialogFlags>(GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR),
34 GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, 34 GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
35 GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, 35 GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
36 NULL); 36 NULL);
37 g_signal_connect(dialog_, "response", 37 g_signal_connect(dialog_, "response", G_CALLBACK(OnResponseThunk), this);
38 G_CALLBACK(OnDialogResponseThunk), this);
39 38
40 GtkBox* vbox = GTK_BOX(GTK_DIALOG(dialog_)->vbox); 39 GtkBox* vbox = GTK_BOX(GTK_DIALOG(dialog_)->vbox);
41 gtk_box_set_spacing(vbox, gtk_util::kControlSpacing); 40 gtk_box_set_spacing(vbox, gtk_util::kControlSpacing);
42 41
43 GtkWidget* label = gtk_label_new( 42 GtkWidget* label = gtk_label_new(
44 l10n_util::GetStringUTF8(IDS_INSTANT_OPT_IN_MESSAGE).c_str()); 43 l10n_util::GetStringUTF8(IDS_INSTANT_OPT_IN_MESSAGE).c_str());
45 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); 44 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
46 gtk_box_pack_start(vbox, label, FALSE, FALSE, 0); 45 gtk_box_pack_start(vbox, label, FALSE, FALSE, 0);
47 46
48 GtkWidget* link_button = gtk_chrome_link_button_new( 47 GtkWidget* link_button = gtk_chrome_link_button_new(
49 l10n_util::GetStringUTF8(IDS_OPTIONS_LEARN_MORE_LABEL).c_str()); 48 l10n_util::GetStringUTF8(IDS_OPTIONS_LEARN_MORE_LABEL).c_str());
50 g_signal_connect(link_button, "clicked", 49 g_signal_connect(link_button, "clicked",
51 G_CALLBACK(OnLinkButtonClickedThunk), this); 50 G_CALLBACK(OnLinkButtonClickedThunk), this);
52 51
53 GtkWidget* action_area = GTK_DIALOG(dialog_)->action_area; 52 GtkWidget* action_area = GTK_DIALOG(dialog_)->action_area;
54 gtk_container_add(GTK_CONTAINER(action_area), link_button); 53 gtk_container_add(GTK_CONTAINER(action_area), link_button);
55 gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(action_area), 54 gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(action_area),
56 link_button, 55 link_button,
57 TRUE); 56 TRUE);
58 57
59 gtk_dialog_set_default_response(GTK_DIALOG(dialog_), GTK_RESPONSE_ACCEPT); 58 gtk_dialog_set_default_response(GTK_DIALOG(dialog_), GTK_RESPONSE_ACCEPT);
60 gtk_widget_show_all(dialog_); 59 gtk_widget_show_all(dialog_);
61 } 60 }
62 61
63 InstantConfirmDialogGtk::~InstantConfirmDialogGtk() { 62 InstantConfirmDialogGtk::~InstantConfirmDialogGtk() {
64 gtk_widget_destroy(dialog_); 63 gtk_widget_destroy(dialog_);
65 } 64 }
66 65
67 void InstantConfirmDialogGtk::OnDialogResponse(GtkWidget* dialog, 66 void InstantConfirmDialogGtk::OnResponse(GtkWidget* dialog, int response_id) {
68 int response) { 67 if (response_id == GTK_RESPONSE_ACCEPT)
69 if (response == GTK_RESPONSE_ACCEPT)
70 InstantController::Enable(profile_); 68 InstantController::Enable(profile_);
71 69
72 delete this; 70 delete this;
73 } 71 }
74 72
75 void InstantConfirmDialogGtk::OnLinkButtonClicked(GtkWidget* button) { 73 void InstantConfirmDialogGtk::OnLinkButtonClicked(GtkWidget* button) {
76 browser::ShowOptionsURL(profile_, browser::InstantLearnMoreURL()); 74 browser::ShowOptionsURL(profile_, browser::InstantLearnMoreURL());
77 } 75 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698