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

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

Issue 113967: Add general options page. Options are working with the following exceptions: (Closed)
Patch Set: Created 11 years, 7 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
« no previous file with comments | « chrome/browser/gtk/options/options_layout_gtk.cc ('k') | chrome/browser/options_page_base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 <gtk/gtk.h> 5 #include <gtk/gtk.h>
6 6
7 #include "chrome/browser/options_window.h" 7 #include "chrome/browser/options_window.h"
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/gtk/options/general_page_gtk.h"
12 #include "chrome/browser/profile.h" 13 #include "chrome/browser/profile.h"
13 #include "chrome/common/pref_member.h" 14 #include "chrome/common/pref_member.h"
14 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
15 #include "chrome/common/pref_service.h" 16 #include "chrome/common/pref_service.h"
16 #ifdef CHROME_PERSONALIZATION 17 #ifdef CHROME_PERSONALIZATION
17 #include "chrome/personalization/personalization.h" 18 #include "chrome/personalization/personalization.h"
18 #endif 19 #endif
19 #include "grit/chromium_strings.h" 20 #include "grit/chromium_strings.h"
20 #include "grit/generated_resources.h" 21 #include "grit/generated_resources.h"
21 22
(...skipping 25 matching lines...) Expand all
47 48
48 // The options dialog 49 // The options dialog
49 GtkWidget *dialog_; 50 GtkWidget *dialog_;
50 51
51 // The container of the option pages 52 // The container of the option pages
52 GtkWidget *notebook_; 53 GtkWidget *notebook_;
53 54
54 // The Profile associated with these options. 55 // The Profile associated with these options.
55 Profile* profile_; 56 Profile* profile_;
56 57
58 // The options pages
59 GeneralPageGtk general_page_;
60
57 // The last page the user was on when they opened the Options window. 61 // The last page the user was on when they opened the Options window.
58 IntegerPrefMember last_selected_page_; 62 IntegerPrefMember last_selected_page_;
59 63
60 DISALLOW_COPY_AND_ASSIGN(OptionsWindowGtk); 64 DISALLOW_COPY_AND_ASSIGN(OptionsWindowGtk);
61 }; 65 };
62 66
63 static OptionsWindowGtk* instance_ = NULL; 67 static OptionsWindowGtk* instance_ = NULL;
64 68
65 /////////////////////////////////////////////////////////////////////////////// 69 ///////////////////////////////////////////////////////////////////////////////
66 // OptionsWindowGtk, public: 70 // OptionsWindowGtk, public:
67 71
68 OptionsWindowGtk::OptionsWindowGtk(Profile* profile) 72 OptionsWindowGtk::OptionsWindowGtk(Profile* profile)
69 // Always show preferences for the original profile. Most state when off 73 // Always show preferences for the original profile. Most state when off
70 // the record comes from the original profile, but we explicitly use 74 // the record comes from the original profile, but we explicitly use
71 // the original profile to avoid potential problems. 75 // the original profile to avoid potential problems.
72 : profile_(profile->GetOriginalProfile()) { 76 : profile_(profile->GetOriginalProfile()), general_page_(profile_) {
73 // The download manager needs to be initialized before the contents of the 77 // The download manager needs to be initialized before the contents of the
74 // Options Window are created. 78 // Options Window are created.
75 profile_->GetDownloadManager(); 79 profile_->GetDownloadManager();
76 // We don't need to observe changes in this value. 80 // We don't need to observe changes in this value.
77 last_selected_page_.Init(prefs::kOptionsWindowLastTabIndex, 81 last_selected_page_.Init(prefs::kOptionsWindowLastTabIndex,
78 g_browser_process->local_state(), NULL); 82 g_browser_process->local_state(), NULL);
79 83
80 dialog_ = gtk_dialog_new_with_buttons( 84 dialog_ = gtk_dialog_new_with_buttons(
81 l10n_util::GetStringFUTF8(IDS_OPTIONS_DIALOG_TITLE, 85 l10n_util::GetStringFUTF8(IDS_OPTIONS_DIALOG_TITLE,
82 WideToUTF16(l10n_util::GetString(IDS_PRODUCT_NAME))).c_str(), 86 WideToUTF16(l10n_util::GetString(IDS_PRODUCT_NAME))).c_str(),
83 // Prefs window is shared between all browser windows. 87 // Prefs window is shared between all browser windows.
84 NULL, 88 NULL,
85 // Non-modal. 89 // Non-modal.
86 GTK_DIALOG_NO_SEPARATOR, 90 GTK_DIALOG_NO_SEPARATOR,
87 GTK_STOCK_CLOSE, 91 GTK_STOCK_CLOSE,
88 GTK_RESPONSE_CLOSE, 92 GTK_RESPONSE_CLOSE,
89 NULL); 93 NULL);
90 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog_)->vbox), 18); 94 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog_)->vbox), 18);
91 95
92 notebook_ = gtk_notebook_new(); 96 notebook_ = gtk_notebook_new();
93 97
94 gtk_notebook_append_page( 98 gtk_notebook_append_page(
95 GTK_NOTEBOOK(notebook_), 99 GTK_NOTEBOOK(notebook_),
96 gtk_label_new("TODO general"), 100 general_page_.get_page_widget(),
97 gtk_label_new( 101 gtk_label_new(
98 l10n_util::GetStringUTF8(IDS_OPTIONS_GENERAL_TAB_LABEL).c_str())); 102 l10n_util::GetStringUTF8(IDS_OPTIONS_GENERAL_TAB_LABEL).c_str()));
99 103
100 gtk_notebook_append_page( 104 gtk_notebook_append_page(
101 GTK_NOTEBOOK(notebook_), 105 GTK_NOTEBOOK(notebook_),
102 gtk_label_new("TODO content"), 106 gtk_label_new("TODO content"),
103 gtk_label_new( 107 gtk_label_new(
104 l10n_util::GetStringUTF8(IDS_OPTIONS_CONTENT_TAB_LABEL).c_str())); 108 l10n_util::GetStringUTF8(IDS_OPTIONS_CONTENT_TAB_LABEL).c_str()));
105 109
106 #ifdef CHROME_PERSONALIZATION 110 #ifdef CHROME_PERSONALIZATION
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 OptionsGroup highlight_group, 220 OptionsGroup highlight_group,
217 Profile* profile) { 221 Profile* profile) {
218 DCHECK(profile); 222 DCHECK(profile);
219 // If there's already an existing options window, activate it and switch to 223 // If there's already an existing options window, activate it and switch to
220 // the specified page. 224 // the specified page.
221 if (!instance_) { 225 if (!instance_) {
222 instance_ = new OptionsWindowGtk(profile); 226 instance_ = new OptionsWindowGtk(profile);
223 } 227 }
224 instance_->ShowOptionsPage(page, highlight_group); 228 instance_->ShowOptionsPage(page, highlight_group);
225 } 229 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/options/options_layout_gtk.cc ('k') | chrome/browser/options_page_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698