| 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_progress_dialog_gtk.h" | 5 #include "chrome/browser/ui/gtk/importer/import_progress_dialog_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/browser/importer/importer_host.h" | 12 #include "chrome/browser/importer/importer_host.h" |
| 13 #include "chrome/browser/importer/importer_observer.h" | 13 #include "chrome/browser/importer/importer_observer.h" |
| 14 #include "chrome/browser/ui/gtk/gtk_util.h" | 14 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 15 #include "grit/chromium_strings.h" | 15 #include "grit/chromium_strings.h" |
| 16 #include "grit/generated_resources.h" | 16 #include "grit/generated_resources.h" |
| 17 #include "ui/base/gtk/gtk_hig_constants.h" |
| 17 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 void SetItemImportStatus(GtkWidget* label, int res_id, bool is_done) { | 22 void SetItemImportStatus(GtkWidget* label, int res_id, bool is_done) { |
| 22 std::string status = l10n_util::GetStringUTF8(res_id); | 23 std::string status = l10n_util::GetStringUTF8(res_id); |
| 23 // Windows version of this has fancy throbbers to indicate progress. Here | 24 // Windows version of this has fancy throbbers to indicate progress. Here |
| 24 // we rely on text until we can have something equivalent on Linux. | 25 // we rely on text until we can have something equivalent on Linux. |
| 25 if (is_done) | 26 if (is_done) |
| 26 status = "\xE2\x9C\x94 " + status; // U+2714 HEAVY CHECK MARK | 27 status = "\xE2\x9C\x94 " + status; // U+2714 HEAVY CHECK MARK |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 dialog_ = gtk_dialog_new_with_buttons( | 76 dialog_ = gtk_dialog_new_with_buttons( |
| 76 l10n_util::GetStringUTF8(IDS_IMPORT_PROGRESS_TITLE).c_str(), | 77 l10n_util::GetStringUTF8(IDS_IMPORT_PROGRESS_TITLE).c_str(), |
| 77 parent_, | 78 parent_, |
| 78 (GtkDialogFlags) (GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR), | 79 (GtkDialogFlags) (GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR), |
| 79 GTK_STOCK_CANCEL, | 80 GTK_STOCK_CANCEL, |
| 80 GTK_RESPONSE_REJECT, | 81 GTK_RESPONSE_REJECT, |
| 81 NULL); | 82 NULL); |
| 82 importer_host_->set_parent_window(GTK_WINDOW(dialog_)); | 83 importer_host_->set_parent_window(GTK_WINDOW(dialog_)); |
| 83 | 84 |
| 84 GtkWidget* content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog_)); | 85 GtkWidget* content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog_)); |
| 85 gtk_box_set_spacing(GTK_BOX(content_area), gtk_util::kContentAreaSpacing); | 86 gtk_box_set_spacing(GTK_BOX(content_area), ui::kContentAreaSpacing); |
| 86 | 87 |
| 87 GtkWidget* control_group = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); | 88 GtkWidget* control_group = gtk_vbox_new(FALSE, ui::kControlSpacing); |
| 88 | 89 |
| 89 GtkWidget* import_info = gtk_label_new( | 90 GtkWidget* import_info = gtk_label_new( |
| 90 l10n_util::GetStringFUTF8(IDS_IMPORT_PROGRESS_INFO, | 91 l10n_util::GetStringFUTF8(IDS_IMPORT_PROGRESS_INFO, |
| 91 importer_name).c_str()); | 92 importer_name).c_str()); |
| 92 gtk_util::SetLabelWidth(import_info, 400); | 93 gtk_util::SetLabelWidth(import_info, 400); |
| 93 gtk_box_pack_start(GTK_BOX(control_group), import_info, FALSE, FALSE, 0); | 94 gtk_box_pack_start(GTK_BOX(control_group), import_info, FALSE, FALSE, 0); |
| 94 | 95 |
| 95 GtkWidget* item_box = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); | 96 GtkWidget* item_box = gtk_vbox_new(FALSE, ui::kControlSpacing); |
| 96 | 97 |
| 97 if (items_ & importer::HISTORY) { | 98 if (items_ & importer::HISTORY) { |
| 98 history_ = gtk_label_new( | 99 history_ = gtk_label_new( |
| 99 l10n_util::GetStringUTF8(IDS_IMPORT_PROGRESS_STATUS_HISTORY).c_str()); | 100 l10n_util::GetStringUTF8(IDS_IMPORT_PROGRESS_STATUS_HISTORY).c_str()); |
| 100 gtk_misc_set_alignment(GTK_MISC(history_), 0, 0.5); | 101 gtk_misc_set_alignment(GTK_MISC(history_), 0, 0.5); |
| 101 gtk_box_pack_start(GTK_BOX(item_box), history_, FALSE, FALSE, 0); | 102 gtk_box_pack_start(GTK_BOX(item_box), history_, FALSE, FALSE, 0); |
| 102 } | 103 } |
| 103 | 104 |
| 104 if (items_ & importer::FAVORITES) { | 105 if (items_ & importer::FAVORITES) { |
| 105 bookmarks_ = gtk_label_new( | 106 bookmarks_ = gtk_label_new( |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 const SourceProfile& source_profile, | 225 const SourceProfile& source_profile, |
| 225 Profile* profile, | 226 Profile* profile, |
| 226 bool first_run) { | 227 bool first_run) { |
| 227 DCHECK_NE(0, items); | 228 DCHECK_NE(0, items); |
| 228 ImportProgressDialogGtk::StartImport( | 229 ImportProgressDialogGtk::StartImport( |
| 229 parent, items, importer_host, importer_observer, source_profile, profile, | 230 parent, items, importer_host, importer_observer, source_profile, profile, |
| 230 first_run); | 231 first_run); |
| 231 } | 232 } |
| 232 | 233 |
| 233 } // namespace importer | 234 } // namespace importer |
| OLD | NEW |