| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/gtk/importer/import_dialog_gtk.h" | 5 #include "chrome/browser/ui/gtk/importer/import_dialog_gtk.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/importer/importer_data_types.h" | 10 #include "chrome/browser/importer/importer_data_types.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 gtk_box_pack_start(GTK_BOX(content_area), vbox, FALSE, FALSE, 0); | 115 gtk_box_pack_start(GTK_BOX(content_area), vbox, FALSE, FALSE, 0); |
| 116 | 116 |
| 117 // Let the user know profiles are being loaded. | 117 // Let the user know profiles are being loaded. |
| 118 gtk_combo_box_append_text(GTK_COMBO_BOX(combo_), | 118 gtk_combo_box_append_text(GTK_COMBO_BOX(combo_), |
| 119 l10n_util::GetStringUTF8(IDS_IMPORT_LOADING_PROFILES).c_str()); | 119 l10n_util::GetStringUTF8(IDS_IMPORT_LOADING_PROFILES).c_str()); |
| 120 gtk_combo_box_set_active(GTK_COMBO_BOX(combo_), 0); | 120 gtk_combo_box_set_active(GTK_COMBO_BOX(combo_), 0); |
| 121 | 121 |
| 122 // Disable controls until source profiles are loaded. | 122 // Disable controls until source profiles are loaded. |
| 123 SetDialogControlsSensitive(false); | 123 SetDialogControlsSensitive(false); |
| 124 | 124 |
| 125 g_signal_connect(dialog_, "response", | 125 g_signal_connect(dialog_, "response", G_CALLBACK(OnResponseThunk), this); |
| 126 G_CALLBACK(OnDialogResponseThunk), this); | |
| 127 | 126 |
| 128 UpdateDialogButtons(); | 127 UpdateDialogButtons(); |
| 129 | 128 |
| 130 gtk_util::ShowDialogWithLocalizedSize(dialog_, | 129 gtk_util::ShowDialogWithLocalizedSize(dialog_, |
| 131 IDS_IMPORT_DIALOG_WIDTH_CHARS, | 130 IDS_IMPORT_DIALOG_WIDTH_CHARS, |
| 132 -1, // height | 131 -1, // height |
| 133 false); // resizable | 132 false); // resizable |
| 134 } | 133 } |
| 135 | 134 |
| 136 ImportDialogGtk::~ImportDialogGtk() { | 135 ImportDialogGtk::~ImportDialogGtk() { |
| 137 if (importer_list_) | 136 if (importer_list_) |
| 138 importer_list_->SetObserver(NULL); | 137 importer_list_->SetObserver(NULL); |
| 139 } | 138 } |
| 140 | 139 |
| 141 void ImportDialogGtk::OnDialogResponse(GtkWidget* widget, int response) { | 140 void ImportDialogGtk::OnResponse(GtkWidget* dialog, int response_id) { |
| 142 gtk_widget_hide_all(dialog_); | 141 gtk_widget_hide_all(dialog_); |
| 143 if (response == GTK_RESPONSE_ACCEPT) { | 142 if (response_id == GTK_RESPONSE_ACCEPT) { |
| 144 uint16 items = GetCheckedItems(); | 143 uint16 items = GetCheckedItems(); |
| 145 if (items == 0) { | 144 if (items == 0) { |
| 146 ImportCompleted(); | 145 ImportCompleted(); |
| 147 } else { | 146 } else { |
| 148 const importer::ProfileInfo& source_profile = | 147 const importer::ProfileInfo& source_profile = |
| 149 importer_list_->GetSourceProfileInfoAt( | 148 importer_list_->GetSourceProfileInfoAt( |
| 150 gtk_combo_box_get_active(GTK_COMBO_BOX(combo_))); | 149 gtk_combo_box_get_active(GTK_COMBO_BOX(combo_))); |
| 151 importer::ShowImportProgressDialog(parent_, items, importer_host_, this, | 150 importer::ShowImportProgressDialog(parent_, items, importer_host_, this, |
| 152 source_profile, profile_, false); | 151 source_profile, profile_, false); |
| 153 } | 152 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 } | 206 } |
| 208 | 207 |
| 209 void ImportDialogGtk::ImportCompleted() { | 208 void ImportDialogGtk::ImportCompleted() { |
| 210 gtk_widget_destroy(dialog_); | 209 gtk_widget_destroy(dialog_); |
| 211 delete this; | 210 delete this; |
| 212 } | 211 } |
| 213 | 212 |
| 214 void ImportDialogGtk::ImportCanceled() { | 213 void ImportDialogGtk::ImportCanceled() { |
| 215 ImportCompleted(); | 214 ImportCompleted(); |
| 216 } | 215 } |
| OLD | NEW |