Chromium Code Reviews| Index: chrome/browser/gtk/download_item_gtk.cc |
| =================================================================== |
| --- chrome/browser/gtk/download_item_gtk.cc (revision 20424) |
| +++ chrome/browser/gtk/download_item_gtk.cc (working copy) |
| @@ -42,6 +42,9 @@ |
| // it will be elided. |
| const int kTextWidth = 140; |
| +// Showing width of the dangerous file warning, in pixels. |
|
Evan Martin
2009/07/13 21:22:33
"Showing width" is a bit of strange wording (?)
|
| +const int kDangerousTextWidth = 350; |
| + |
| // The minimum width we will ever draw the download item. Used as a lower bound |
| // during animation. This number comes from the width of the images used to |
| // make the download item. |
| @@ -281,11 +284,12 @@ |
| gtk_box_pack_start(GTK_BOX(dangerous_hbox_), dangerous_image, |
| FALSE, FALSE, 0); |
| - // Create the warning text. |
| - // TODO(estade): the encoding might not be UTF8. |
| + std::wstring elided_filename = gfx::ElideFilename( |
| + get_download()->original_name(), |
| + gfx::Font(), kTextWidth); |
| std::string dangerous_warning = |
| l10n_util::GetStringFUTF8(IDS_PROMPT_DANGEROUS_DOWNLOAD, |
| - UTF8ToUTF16(get_download()->original_name().value())); |
| + WideToUTF16(elided_filename)); |
| gchar* label_markup = |
| g_markup_printf_escaped(kLabelColorMarkup, kFilenameColor, |
| dangerous_warning.c_str()); |
| @@ -299,6 +303,7 @@ |
| // request when the animation is going on. |
| gtk_box_pack_start(GTK_BOX(dangerous_hbox_), dangerous_label, |
| TRUE, TRUE, 0); |
| + gtk_widget_set_size_request(dangerous_label, kDangerousTextWidth, -1); |
| g_free(label_markup); |
| // Create the ok button. |