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

Side by Side Diff: chrome/browser/gtk/options/advanced_page_gtk.cc

Issue 6251001: Move chrome/browser/gtk/ to chrome/browser/ui/gtk/... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/gtk/options/advanced_page_gtk.h"
6
7 #include "app/l10n_util.h"
8 #include "chrome/browser/gtk/gtk_util.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/options/options_util.h"
11 #include "grit/chromium_strings.h"
12 #include "grit/generated_resources.h"
13
14 AdvancedPageGtk::AdvancedPageGtk(Profile* profile)
15 : OptionsPageBase(profile),
16 advanced_contents_(profile),
17 managed_prefs_banner_(profile->GetPrefs(), OPTIONS_PAGE_ADVANCED) {
18 Init();
19 }
20
21 AdvancedPageGtk::~AdvancedPageGtk() {
22 }
23
24 void AdvancedPageGtk::Init() {
25 page_ = gtk_vbox_new(FALSE, gtk_util::kControlSpacing);
26 gtk_container_set_border_width(GTK_CONTAINER(page_),
27 gtk_util::kContentAreaBorder);
28
29 gtk_box_pack_start(GTK_BOX(page_), managed_prefs_banner_.banner_widget(),
30 false, false, 0);
31
32 GtkWidget* scroll_window = gtk_scrolled_window_new(NULL, NULL);
33 gtk_container_add(GTK_CONTAINER(page_), scroll_window);
34 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll_window),
35 GTK_POLICY_NEVER,
36 GTK_POLICY_AUTOMATIC);
37 // Note that typically we call gtk_scrolled_window_set_shadow_type right
38 // here, but the add_with_viewport method of GtkScrolledWindow already adds
39 // its own shadow.
40 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroll_window),
41 advanced_contents_.get_page_widget());
42
43 GtkWidget* button_box = gtk_hbutton_box_new();
44 gtk_button_box_set_layout(GTK_BUTTON_BOX(button_box), GTK_BUTTONBOX_END);
45 GtkWidget* reset_button = gtk_button_new_with_label(
46 l10n_util::GetStringUTF8(IDS_OPTIONS_RESET).c_str());
47 g_signal_connect(reset_button, "clicked",
48 G_CALLBACK(OnResetToDefaultsClickedThunk), this);
49 gtk_container_add(GTK_CONTAINER(button_box), reset_button);
50 gtk_box_pack_start(GTK_BOX(page_), button_box, FALSE, FALSE, 0);
51 }
52
53 void AdvancedPageGtk::OnResetToDefaultsClicked(GtkWidget* button) {
54 UserMetricsRecordAction(UserMetricsAction("Options_ResetToDefaults"), NULL);
55 GtkWidget* dialog_ = gtk_message_dialog_new(
56 GTK_WINDOW(gtk_widget_get_toplevel(page_)),
57 static_cast<GtkDialogFlags>(GTK_DIALOG_MODAL),
58 GTK_MESSAGE_QUESTION,
59 GTK_BUTTONS_NONE,
60 "%s",
61 l10n_util::GetStringUTF8(IDS_OPTIONS_RESET_MESSAGE).c_str());
62 gtk_util::ApplyMessageDialogQuirks(dialog_);
63 gtk_dialog_add_buttons(
64 GTK_DIALOG(dialog_),
65 l10n_util::GetStringUTF8(IDS_OPTIONS_RESET_CANCELLABEL).c_str(),
66 GTK_RESPONSE_CANCEL,
67 l10n_util::GetStringUTF8(IDS_OPTIONS_RESET_OKLABEL).c_str(),
68 GTK_RESPONSE_OK,
69 NULL);
70 gtk_window_set_title(GTK_WINDOW(dialog_),
71 l10n_util::GetStringUTF8(IDS_PRODUCT_NAME).c_str());
72 g_signal_connect(dialog_, "response",
73 G_CALLBACK(OnResetToDefaultsResponseThunk), this);
74
75 gtk_util::ShowDialog(dialog_);
76 }
77
78 void AdvancedPageGtk::OnResetToDefaultsResponse(GtkWidget* dialog,
79 int response_id) {
80 if (response_id == GTK_RESPONSE_OK) {
81 OptionsUtil::ResetToDefaults(profile());
82 }
83 gtk_widget_destroy(dialog);
84 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/options/advanced_page_gtk.h ('k') | chrome/browser/gtk/options/content_exception_editor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698