| OLD | NEW |
| 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/browser/gtk/options/fonts_page_gtk.h" |
| 13 #include "chrome/browser/gtk/options/languages_page_gtk.h" |
| 13 #include "chrome/common/gtk_util.h" | 14 #include "chrome/common/gtk_util.h" |
| 14 #include "grit/chromium_strings.h" | 15 #include "grit/chromium_strings.h" |
| 15 #include "grit/generated_resources.h" | 16 #include "grit/generated_resources.h" |
| 16 | 17 |
| 17 /////////////////////////////////////////////////////////////////////////////// | 18 /////////////////////////////////////////////////////////////////////////////// |
| 18 // FontsLanguagesWindowGtk | 19 // FontsLanguagesWindowGtk |
| 19 // | 20 // |
| 20 // The contents of the Options dialog window. | 21 // The contents of the Options dialog window. |
| 21 | 22 |
| 22 class FontsLanguagesWindowGtk { | 23 class FontsLanguagesWindowGtk { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 36 | 37 |
| 37 // The container of the option pages. | 38 // The container of the option pages. |
| 38 GtkWidget *notebook_; | 39 GtkWidget *notebook_; |
| 39 | 40 |
| 40 // The Profile associated with these options. | 41 // The Profile associated with these options. |
| 41 Profile* profile_; | 42 Profile* profile_; |
| 42 | 43 |
| 43 // The fonts page. | 44 // The fonts page. |
| 44 FontsPageGtk fonts_page_; | 45 FontsPageGtk fonts_page_; |
| 45 | 46 |
| 47 // The languages page. |
| 48 LanguagesPageGtk languages_page_; |
| 49 |
| 46 DISALLOW_COPY_AND_ASSIGN(FontsLanguagesWindowGtk); | 50 DISALLOW_COPY_AND_ASSIGN(FontsLanguagesWindowGtk); |
| 47 }; | 51 }; |
| 48 | 52 |
| 49 static FontsLanguagesWindowGtk* instance_ = NULL; | 53 static FontsLanguagesWindowGtk* instance_ = NULL; |
| 50 | 54 |
| 51 /////////////////////////////////////////////////////////////////////////////// | 55 /////////////////////////////////////////////////////////////////////////////// |
| 52 // FontsLanguagesWindowGtk, public: | 56 // FontsLanguagesWindowGtk, public: |
| 53 | 57 |
| 54 FontsLanguagesWindowGtk::FontsLanguagesWindowGtk(Profile* profile) | 58 FontsLanguagesWindowGtk::FontsLanguagesWindowGtk(Profile* profile) |
| 55 // Always show preferences for the original profile. Most state when off | 59 // Always show preferences for the original profile. Most state when off |
| 56 // the record comes from the original profile, but we explicitly use | 60 // the record comes from the original profile, but we explicitly use |
| 57 // the original profile to avoid potential problems. | 61 // the original profile to avoid potential problems. |
| 58 : profile_(profile->GetOriginalProfile()), | 62 : profile_(profile->GetOriginalProfile()), |
| 59 fonts_page_(profile_) { | 63 fonts_page_(profile_), |
| 64 languages_page_(profile_) { |
| 60 dialog_ = gtk_dialog_new_with_buttons( | 65 dialog_ = gtk_dialog_new_with_buttons( |
| 61 l10n_util::GetStringFUTF8(IDS_FONT_LANGUAGE_SETTING_WINDOWS_TITLE, | 66 l10n_util::GetStringFUTF8(IDS_FONT_LANGUAGE_SETTING_WINDOWS_TITLE, |
| 62 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)).c_str(), | 67 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)).c_str(), |
| 63 // Prefs window is shared between all browser windows. | 68 // Prefs window is shared between all browser windows. |
| 64 NULL, | 69 NULL, |
| 65 // Non-modal. | 70 // Non-modal. |
| 66 GTK_DIALOG_NO_SEPARATOR, | 71 GTK_DIALOG_NO_SEPARATOR, |
| 67 GTK_STOCK_CLOSE, | 72 GTK_STOCK_CLOSE, |
| 68 GTK_RESPONSE_CLOSE, | 73 GTK_RESPONSE_CLOSE, |
| 69 NULL); | 74 NULL); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 80 gtk_notebook_append_page( | 85 gtk_notebook_append_page( |
| 81 GTK_NOTEBOOK(notebook_), | 86 GTK_NOTEBOOK(notebook_), |
| 82 fonts_page_.get_page_widget(), | 87 fonts_page_.get_page_widget(), |
| 83 gtk_label_new( | 88 gtk_label_new( |
| 84 l10n_util::GetStringUTF8( | 89 l10n_util::GetStringUTF8( |
| 85 IDS_FONT_LANGUAGE_SETTING_FONT_TAB_TITLE).c_str())); | 90 IDS_FONT_LANGUAGE_SETTING_FONT_TAB_TITLE).c_str())); |
| 86 | 91 |
| 87 // Langauges tab. | 92 // Langauges tab. |
| 88 gtk_notebook_append_page( | 93 gtk_notebook_append_page( |
| 89 GTK_NOTEBOOK(notebook_), | 94 GTK_NOTEBOOK(notebook_), |
| 90 gtk_label_new("TODO content"), | 95 languages_page_.get_page_widget(), |
| 91 gtk_label_new( | 96 gtk_label_new( |
| 92 l10n_util::GetStringUTF8( | 97 l10n_util::GetStringUTF8( |
| 93 IDS_FONT_LANGUAGE_SETTING_LANGUAGES_TAB_TITLE).c_str())); | 98 IDS_FONT_LANGUAGE_SETTING_LANGUAGES_TAB_TITLE).c_str())); |
| 94 | 99 |
| 95 // Show the notebook. | 100 // Show the notebook. |
| 96 gtk_widget_show_all(dialog_); | 101 gtk_widget_show_all(dialog_); |
| 97 | 102 |
| 98 // We only have one button and don't do any special handling, so just hook it | 103 // We only have one button and don't do any special handling, so just hook it |
| 99 // directly to gtk_widget_destroy. | 104 // directly to gtk_widget_destroy. |
| 100 g_signal_connect_swapped(dialog_, "response", G_CALLBACK(gtk_widget_destroy), | 105 g_signal_connect_swapped(dialog_, "response", G_CALLBACK(gtk_widget_destroy), |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 FontsLanguagesPage page, | 138 FontsLanguagesPage page, |
| 134 Profile* profile) { | 139 Profile* profile) { |
| 135 DCHECK(profile); | 140 DCHECK(profile); |
| 136 // If there's already an existing fonts and language window, activate it and | 141 // If there's already an existing fonts and language window, activate it and |
| 137 // switch to the specified page. | 142 // switch to the specified page. |
| 138 if (!instance_) | 143 if (!instance_) |
| 139 instance_ = new FontsLanguagesWindowGtk(profile); | 144 instance_ = new FontsLanguagesWindowGtk(profile); |
| 140 | 145 |
| 141 instance_->ShowTabPage(page); | 146 instance_->ShowTabPage(page); |
| 142 } | 147 } |
| OLD | NEW |