diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-05 19:42:38 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-05 19:42:38 +0000 |
commit | 1ccbd41da6c7bae339c04c45ddd74596a2b8b9fe (patch) | |
tree | 32253272b095adc505c156559bcbee0c3b19b479 /chrome/browser | |
parent | 857426ccb3e0aa63433be5cf77b16e85b915281a (diff) | |
download | chromium_src-1ccbd41da6c7bae339c04c45ddd74596a2b8b9fe.zip chromium_src-1ccbd41da6c7bae339c04c45ddd74596a2b8b9fe.tar.gz chromium_src-1ccbd41da6c7bae339c04c45ddd74596a2b8b9fe.tar.bz2 |
linux: rearrange widget layout in importer dialog
I'm not especially happy with how it looks now, though I think it's
better than before.
Review URL: http://codereview.chromium.org/160661
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22512 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/gtk/import_progress_dialog_gtk.cc | 79 | ||||
-rw-r--r-- | chrome/browser/gtk/options/advanced_contents_gtk.cc | 12 | ||||
-rw-r--r-- | chrome/browser/gtk/options/options_layout_gtk.cc | 19 | ||||
-rw-r--r-- | chrome/browser/gtk/options/options_layout_gtk.h | 3 |
4 files changed, 55 insertions, 58 deletions
diff --git a/chrome/browser/gtk/import_progress_dialog_gtk.cc b/chrome/browser/gtk/import_progress_dialog_gtk.cc index d44aac4..28ec1d8 100644 --- a/chrome/browser/gtk/import_progress_dialog_gtk.cc +++ b/chrome/browser/gtk/import_progress_dialog_gtk.cc @@ -11,16 +11,18 @@ #include "grit/generated_resources.h" namespace { -void SetItemImportStatus(GtkWidget* chkbox, int res_id, bool is_done) { + +void SetItemImportStatus(GtkWidget* label, int res_id, bool is_done) { std::string status = l10n_util::GetStringUTF8(res_id); // Windows version of this has fancy throbbers to indicate progress. Here // we rely on text until we can have something equivalent on Linux. if (is_done) - status.append(" done."); + status = "\xE2\x9C\x94 " + status; // U+2714 HEAVY CHECK MARK else - status.append(" importing..."); - gtk_button_set_label(GTK_BUTTON(chkbox), status.c_str()); + status.append(" ..."); + gtk_label_set_text(GTK_LABEL(label), status.c_str()); } + } // namespace // static @@ -127,39 +129,48 @@ ImportProgressDialogGtk::ImportProgressDialogGtk(const string16& source_profile, GtkWidget* content_area = GTK_DIALOG(dialog_)->vbox; gtk_box_set_spacing(GTK_BOX(content_area), gtk_util::kContentAreaSpacing); + GtkWidget* control_group = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); + GtkWidget* import_info = gtk_label_new( l10n_util::GetStringFUTF8(IDS_IMPORT_PROGRESS_INFO, source_profile).c_str()); - gtk_label_set_single_line_mode(GTK_LABEL(import_info), FALSE); - gtk_box_pack_start(GTK_BOX(content_area), import_info, FALSE, FALSE, 0); - - bookmarks_ = gtk_check_button_new_with_label( - l10n_util::GetStringUTF8(IDS_IMPORT_PROGRESS_STATUS_BOOKMARKS).c_str()); - gtk_box_pack_start(GTK_BOX(content_area), bookmarks_, FALSE, FALSE, 0); - gtk_widget_set_sensitive(bookmarks_, FALSE); - if (items_ & FAVORITES) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(bookmarks_), TRUE); - - search_engines_ = gtk_check_button_new_with_label( - l10n_util::GetStringUTF8(IDS_IMPORT_PROGRESS_STATUS_SEARCH).c_str()); - gtk_box_pack_start(GTK_BOX(content_area), search_engines_, FALSE, FALSE, 0); - gtk_widget_set_sensitive(search_engines_, FALSE); - if (items_ & SEARCH_ENGINES) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(search_engines_), TRUE); - - passwords_ = gtk_check_button_new_with_label( - l10n_util::GetStringUTF8(IDS_IMPORT_PROGRESS_STATUS_PASSWORDS).c_str()); - gtk_box_pack_start(GTK_BOX(content_area), passwords_, FALSE, FALSE, 0); - gtk_widget_set_sensitive(passwords_, FALSE); - if (items_ & PASSWORDS) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(passwords_), TRUE); - - history_ = gtk_check_button_new_with_label( - l10n_util::GetStringUTF8(IDS_IMPORT_PROGRESS_STATUS_HISTORY).c_str()); - gtk_box_pack_start(GTK_BOX(content_area), history_, FALSE, FALSE, 0); - gtk_widget_set_sensitive(history_, FALSE); - if (items_ & HISTORY) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(history_), TRUE); + gtk_label_set_line_wrap(GTK_LABEL(import_info), TRUE); + gtk_widget_set_size_request(import_info, 350, -1); + gtk_box_pack_start(GTK_BOX(control_group), import_info, FALSE, FALSE, 0); + + GtkWidget* item_box = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); + + if (items_ & FAVORITES) { + bookmarks_ = gtk_label_new( + l10n_util::GetStringUTF8(IDS_IMPORT_PROGRESS_STATUS_BOOKMARKS).c_str()); + gtk_misc_set_alignment(GTK_MISC(bookmarks_), 0, 0.5); + gtk_box_pack_start(GTK_BOX(item_box), bookmarks_, FALSE, FALSE, 0); + } + + if (items_ & SEARCH_ENGINES) { + search_engines_ = gtk_label_new( + l10n_util::GetStringUTF8(IDS_IMPORT_PROGRESS_STATUS_SEARCH).c_str()); + gtk_misc_set_alignment(GTK_MISC(search_engines_), 0, 0.5); + gtk_box_pack_start(GTK_BOX(item_box), search_engines_, FALSE, FALSE, 0); + } + + if (items_ & PASSWORDS) { + passwords_ = gtk_label_new( + l10n_util::GetStringUTF8(IDS_IMPORT_PROGRESS_STATUS_PASSWORDS).c_str()); + gtk_misc_set_alignment(GTK_MISC(passwords_), 0, 0.5); + gtk_box_pack_start(GTK_BOX(item_box), passwords_, FALSE, FALSE, 0); + } + + if (items_ & HISTORY) { + history_ = gtk_label_new( + l10n_util::GetStringUTF8(IDS_IMPORT_PROGRESS_STATUS_HISTORY).c_str()); + gtk_misc_set_alignment(GTK_MISC(history_), 0, 0.5); + gtk_box_pack_start(GTK_BOX(item_box), history_, FALSE, FALSE, 0); + } + + gtk_box_pack_start(GTK_BOX(control_group), gtk_util::IndentWidget(item_box), + FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(content_area), control_group, FALSE, FALSE, 0); g_signal_connect(dialog_, "response", G_CALLBACK(HandleOnResponseDialog), this); diff --git a/chrome/browser/gtk/options/advanced_contents_gtk.cc b/chrome/browser/gtk/options/advanced_contents_gtk.cc index 4e615e5..a4dd27f 100644 --- a/chrome/browser/gtk/options/advanced_contents_gtk.cc +++ b/chrome/browser/gtk/options/advanced_contents_gtk.cc @@ -208,7 +208,7 @@ DownloadSection::DownloadSection(Profile* profile) reset_file_handlers_button_, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(page_), - OptionsLayoutBuilderGtk::IndentWidget(button_hbox), + gtk_util::IndentWidget(button_hbox), FALSE, FALSE, 0); // Init prefs watchers. @@ -332,7 +332,7 @@ NetworkSection::NetworkSection(Profile* profile) change_proxies_button, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(page_), - OptionsLayoutBuilderGtk::IndentWidget(button_hbox), + gtk_util::IndentWidget(button_hbox), FALSE, FALSE, 0); } @@ -535,7 +535,7 @@ PrivacySection::PrivacySection(Profile* profile) GtkWidget* cookie_controls = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); gtk_box_pack_start(GTK_BOX(page_), - OptionsLayoutBuilderGtk::IndentWidget(cookie_controls), + gtk_util::IndentWidget(cookie_controls), FALSE, FALSE, 0); cookie_behavior_combobox_ = gtk_combo_box_new_text(); @@ -808,8 +808,8 @@ SecuritySection::SecuritySection(Profile* profile) GtkWidget* manage_certificates_hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(manage_certificates_hbox), manage_certificates_link, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(page_), OptionsLayoutBuilderGtk::IndentWidget( - manage_certificates_hbox), + gtk_box_pack_start(GTK_BOX(page_), + gtk_util::IndentWidget(manage_certificates_hbox), FALSE, FALSE, 0); g_signal_connect(manage_certificates_link, "clicked", G_CALLBACK(OnManageCertificatesClicked), this); @@ -869,7 +869,7 @@ WebContentSection::WebContentSection(Profile* profile) fonts_and_languages_button, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(page_), - OptionsLayoutBuilderGtk::IndentWidget(button_hbox), + gtk_util::IndentWidget(button_hbox), FALSE, FALSE, 0); // TODO(mattm): gears options would go here if we supported gears diff --git a/chrome/browser/gtk/options/options_layout_gtk.cc b/chrome/browser/gtk/options/options_layout_gtk.cc index a2507fe..5c3827b 100644 --- a/chrome/browser/gtk/options/options_layout_gtk.cc +++ b/chrome/browser/gtk/options/options_layout_gtk.cc @@ -3,13 +3,13 @@ // found in the LICENSE file. #include "chrome/browser/gtk/options/options_layout_gtk.h" + #include "chrome/common/gtk_util.h" namespace { // Style for option group titles -const char kGroupTitleMarkup[] = - "<span weight='bold'>%s</span>"; +const char kOptionGroupTitleMarkup[] = "<span weight='bold'>%s</span>"; } @@ -23,7 +23,7 @@ void OptionsLayoutBuilderGtk::AddOptionGroup(const std::string& title, GtkWidget* content, bool expandable) { GtkWidget* title_label = gtk_label_new(NULL); - char* markup = g_markup_printf_escaped(kGroupTitleMarkup, + char* markup = g_markup_printf_escaped(kOptionGroupTitleMarkup, title.c_str()); gtk_label_set_markup(GTK_LABEL(title_label), markup); g_free(markup); @@ -31,20 +31,9 @@ void OptionsLayoutBuilderGtk::AddOptionGroup(const std::string& title, GtkWidget* title_alignment = gtk_alignment_new(0.0, 0.5, 0.0, 0.0); gtk_container_add(GTK_CONTAINER(title_alignment), title_label); - GtkWidget* content_alignment = IndentWidget(content); - GtkWidget* group = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); gtk_box_pack_start(GTK_BOX(group), title_alignment, FALSE, FALSE, 0); - gtk_container_add(GTK_CONTAINER(group), content_alignment); + gtk_container_add(GTK_CONTAINER(group), gtk_util::IndentWidget(content)); gtk_box_pack_start(GTK_BOX(page_), group, expandable, expandable, 0); } - -// static -GtkWidget* OptionsLayoutBuilderGtk::IndentWidget(GtkWidget* content) { - GtkWidget* content_alignment = gtk_alignment_new(0.0, 0.5, 1.0, 1.0); - gtk_alignment_set_padding(GTK_ALIGNMENT(content_alignment), 0, 0, - gtk_util::kGroupIndent, 0); - gtk_container_add(GTK_CONTAINER(content_alignment), content); - return content_alignment; -} diff --git a/chrome/browser/gtk/options/options_layout_gtk.h b/chrome/browser/gtk/options/options_layout_gtk.h index 0ef3174..c4fedc6 100644 --- a/chrome/browser/gtk/options/options_layout_gtk.h +++ b/chrome/browser/gtk/options/options_layout_gtk.h @@ -24,9 +24,6 @@ class OptionsLayoutBuilderGtk { void AddOptionGroup(const std::string& title, GtkWidget* content, bool expandable); - // Adds the given widget to an alignment identing it by |kGroupIndent|. - static GtkWidget* IndentWidget(GtkWidget* content); - private: // The parent widget GtkWidget* page_; |