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