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

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

Issue 159458: Gtk: Implement font selection options. (Closed)
Patch Set: move the NotifyPrefChanged call into SetFontsFromButton Created 11 years, 4 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 | « no previous file | chrome/browser/gtk/options/fonts_page_gtk.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) 2009 The Chromium Authors. All rights reserved. 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 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/fonts_languages_window.h" 5 #include "chrome/browser/fonts_languages_window.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.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/profile.h" 11 #include "chrome/browser/profile.h"
12 #include "chrome/browser/gtk/options/fonts_page_gtk.h"
12 #include "chrome/common/gtk_util.h" 13 #include "chrome/common/gtk_util.h"
13 #include "grit/chromium_strings.h" 14 #include "grit/chromium_strings.h"
14 #include "grit/generated_resources.h" 15 #include "grit/generated_resources.h"
15 16
16 /////////////////////////////////////////////////////////////////////////////// 17 ///////////////////////////////////////////////////////////////////////////////
17 // FontsLanguagesWindowGtk 18 // FontsLanguagesWindowGtk
18 // 19 //
19 // The contents of the Options dialog window. 20 // The contents of the Options dialog window.
20 21
21 class FontsLanguagesWindowGtk { 22 class FontsLanguagesWindowGtk {
(...skipping 10 matching lines...) Expand all
32 33
33 // The fonts and languages dialog. 34 // The fonts and languages dialog.
34 GtkWidget *dialog_; 35 GtkWidget *dialog_;
35 36
36 // The container of the option pages. 37 // The container of the option pages.
37 GtkWidget *notebook_; 38 GtkWidget *notebook_;
38 39
39 // The Profile associated with these options. 40 // The Profile associated with these options.
40 Profile* profile_; 41 Profile* profile_;
41 42
43 // The fonts page.
44 FontsPageGtk fonts_page_;
45
42 DISALLOW_COPY_AND_ASSIGN(FontsLanguagesWindowGtk); 46 DISALLOW_COPY_AND_ASSIGN(FontsLanguagesWindowGtk);
43 }; 47 };
44 48
45 static FontsLanguagesWindowGtk* instance_ = NULL; 49 static FontsLanguagesWindowGtk* instance_ = NULL;
46 50
47 /////////////////////////////////////////////////////////////////////////////// 51 ///////////////////////////////////////////////////////////////////////////////
48 // FontsLanguagesWindowGtk, public: 52 // FontsLanguagesWindowGtk, public:
49 53
50 FontsLanguagesWindowGtk::FontsLanguagesWindowGtk(Profile* profile) 54 FontsLanguagesWindowGtk::FontsLanguagesWindowGtk(Profile* profile)
51 // Always show preferences for the original profile. Most state when off 55 // Always show preferences for the original profile. Most state when off
52 // the record comes from the original profile, but we explicitly use 56 // the record comes from the original profile, but we explicitly use
53 // the original profile to avoid potential problems. 57 // the original profile to avoid potential problems.
54 : profile_(profile->GetOriginalProfile()) { 58 : profile_(profile->GetOriginalProfile()),
59 fonts_page_(profile_) {
55 dialog_ = gtk_dialog_new_with_buttons( 60 dialog_ = gtk_dialog_new_with_buttons(
56 l10n_util::GetStringFUTF8(IDS_FONT_LANGUAGE_SETTING_WINDOWS_TITLE, 61 l10n_util::GetStringFUTF8(IDS_FONT_LANGUAGE_SETTING_WINDOWS_TITLE,
57 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)).c_str(), 62 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)).c_str(),
58 // Prefs window is shared between all browser windows. 63 // Prefs window is shared between all browser windows.
59 NULL, 64 NULL,
60 // Non-modal. 65 // Non-modal.
61 GTK_DIALOG_NO_SEPARATOR, 66 GTK_DIALOG_NO_SEPARATOR,
62 GTK_STOCK_CLOSE, 67 GTK_STOCK_CLOSE,
63 GTK_RESPONSE_CLOSE, 68 GTK_RESPONSE_CLOSE,
64 NULL); 69 NULL);
65 gtk_window_set_default_size(GTK_WINDOW(dialog_), 500, -1); 70 gtk_window_set_default_size(GTK_WINDOW(dialog_), 500, -1);
66 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog_)->vbox), 71 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog_)->vbox),
67 gtk_util::kContentAreaSpacing); 72 gtk_util::kContentAreaSpacing);
68 73
69 notebook_ = gtk_notebook_new(); 74 notebook_ = gtk_notebook_new();
75 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog_)->vbox), notebook_);
70 76
71 // Fonts and Encoding tab. 77 // Fonts and Encoding tab.
72 gtk_notebook_append_page( 78 gtk_notebook_append_page(
73 GTK_NOTEBOOK(notebook_), 79 GTK_NOTEBOOK(notebook_),
74 gtk_label_new("TODO content"), 80 fonts_page_.get_page_widget(),
75 gtk_label_new( 81 gtk_label_new(
76 l10n_util::GetStringUTF8( 82 l10n_util::GetStringUTF8(
77 IDS_FONT_LANGUAGE_SETTING_FONT_TAB_TITLE).c_str())); 83 IDS_FONT_LANGUAGE_SETTING_FONT_TAB_TITLE).c_str()));
78 84
79 // Langauges tab. 85 // Langauges tab.
80 gtk_notebook_append_page( 86 gtk_notebook_append_page(
81 GTK_NOTEBOOK(notebook_), 87 GTK_NOTEBOOK(notebook_),
82 gtk_label_new("TODO content"), 88 gtk_label_new("TODO content"),
83 gtk_label_new( 89 gtk_label_new(
84 l10n_util::GetStringUTF8( 90 l10n_util::GetStringUTF8(
85 IDS_FONT_LANGUAGE_SETTING_LANGUAGES_TAB_TITLE).c_str())); 91 IDS_FONT_LANGUAGE_SETTING_LANGUAGES_TAB_TITLE).c_str()));
86 92
87 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog_)->vbox), notebook_);
88
89 // Show the notebook. 93 // Show the notebook.
90 gtk_widget_show_all(dialog_); 94 gtk_widget_show_all(dialog_);
91 95
92 // We only have one button and don't do any special handling, so just hook it 96 // We only have one button and don't do any special handling, so just hook it
93 // directly to gtk_widget_destroy. 97 // directly to gtk_widget_destroy.
94 g_signal_connect_swapped(dialog_, "response", G_CALLBACK(gtk_widget_destroy), 98 g_signal_connect_swapped(dialog_, "response", G_CALLBACK(gtk_widget_destroy),
95 dialog_); 99 dialog_);
96 100
97 g_signal_connect(dialog_, "destroy", G_CALLBACK(OnWindowDestroy), this); 101 g_signal_connect(dialog_, "destroy", G_CALLBACK(OnWindowDestroy), this);
98 } 102 }
(...skipping 28 matching lines...) Expand all
127 FontsLanguagesPage page, 131 FontsLanguagesPage page,
128 Profile* profile) { 132 Profile* profile) {
129 DCHECK(profile); 133 DCHECK(profile);
130 // If there's already an existing fonts and language window, activate it and 134 // If there's already an existing fonts and language window, activate it and
131 // switch to the specified page. 135 // switch to the specified page.
132 if (!instance_) 136 if (!instance_)
133 instance_ = new FontsLanguagesWindowGtk(profile); 137 instance_ = new FontsLanguagesWindowGtk(profile);
134 138
135 instance_->ShowTabPage(page); 139 instance_->ShowTabPage(page);
136 } 140 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/gtk/options/fonts_page_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698