| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/gtk/options/content_exception_editor.h" | 5 #include "chrome/browser/gtk/options/content_exception_editor.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 entry_ = gtk_entry_new(); | 47 entry_ = gtk_entry_new(); |
| 48 gtk_entry_set_text(GTK_ENTRY(entry_), pattern_.AsString().c_str()); | 48 gtk_entry_set_text(GTK_ENTRY(entry_), pattern_.AsString().c_str()); |
| 49 g_signal_connect(entry_, "changed", G_CALLBACK(OnEntryChangedThunk), this); | 49 g_signal_connect(entry_, "changed", G_CALLBACK(OnEntryChangedThunk), this); |
| 50 gtk_entry_set_activates_default(GTK_ENTRY(entry_), TRUE); | 50 gtk_entry_set_activates_default(GTK_ENTRY(entry_), TRUE); |
| 51 | 51 |
| 52 pattern_image_ = gtk_image_new_from_pixbuf(NULL); | 52 pattern_image_ = gtk_image_new_from_pixbuf(NULL); |
| 53 | 53 |
| 54 action_combo_ = gtk_combo_box_new_text(); | 54 action_combo_ = gtk_combo_box_new_text(); |
| 55 for (int i = 0; i < cb_model_.GetItemCount(); ++i) { | 55 for (int i = 0; i < cb_model_.GetItemCount(); ++i) { |
| 56 gtk_combo_box_append_text(GTK_COMBO_BOX(action_combo_), | 56 gtk_combo_box_append_text(GTK_COMBO_BOX(action_combo_), |
| 57 WideToUTF8(cb_model_.GetItemAt(i)).c_str()); | 57 UTF16ToUTF8(cb_model_.GetItemAt(i)).c_str()); |
| 58 } | 58 } |
| 59 gtk_combo_box_set_active(GTK_COMBO_BOX(action_combo_), | 59 gtk_combo_box_set_active(GTK_COMBO_BOX(action_combo_), |
| 60 cb_model_.IndexForSetting(setting_)); | 60 cb_model_.IndexForSetting(setting_)); |
| 61 | 61 |
| 62 otr_checkbox_ = gtk_check_button_new_with_label( | 62 otr_checkbox_ = gtk_check_button_new_with_label( |
| 63 l10n_util::GetStringUTF8(IDS_EXCEPTION_EDITOR_OTR_TITLE).c_str()); | 63 l10n_util::GetStringUTF8(IDS_EXCEPTION_EDITOR_OTR_TITLE).c_str()); |
| 64 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(otr_checkbox_), | 64 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(otr_checkbox_), |
| 65 is_off_the_record); | 65 is_off_the_record); |
| 66 | 66 |
| 67 GtkWidget* table = gtk_util::CreateLabeledControlsGroup( | 67 GtkWidget* table = gtk_util::CreateLabeledControlsGroup( |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 delegate_->AcceptExceptionEdit( | 129 delegate_->AcceptExceptionEdit( |
| 130 new_pattern, setting, is_off_the_record, index_, is_new()); | 130 new_pattern, setting, is_off_the_record, index_, is_new()); |
| 131 } | 131 } |
| 132 | 132 |
| 133 gtk_widget_destroy(dialog_); | 133 gtk_widget_destroy(dialog_); |
| 134 } | 134 } |
| 135 | 135 |
| 136 void ContentExceptionEditor::OnWindowDestroy(GtkWidget* widget) { | 136 void ContentExceptionEditor::OnWindowDestroy(GtkWidget* widget) { |
| 137 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 137 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 138 } | 138 } |
| OLD | NEW |