| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/gtk/download_item_gtk.h" | 5 #include "chrome/browser/gtk/download_item_gtk.h" |
| 6 | 6 |
| 7 #include "app/gfx/chrome_canvas.h" | 7 #include "app/gfx/chrome_canvas.h" |
| 8 #include "app/gfx/chrome_font.h" | 8 #include "app/gfx/chrome_font.h" |
| 9 #include "app/gfx/text_elider.h" | 9 #include "app/gfx/text_elider.h" |
| 10 #include "app/slide_animation.h" | 10 #include "app/slide_animation.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 // Remove internal padding on the button. | 158 // Remove internal padding on the button. |
| 159 GtkRcStyle* no_padding_style = gtk_rc_style_new(); | 159 GtkRcStyle* no_padding_style = gtk_rc_style_new(); |
| 160 no_padding_style->xthickness = 0; | 160 no_padding_style->xthickness = 0; |
| 161 no_padding_style->ythickness = 0; | 161 no_padding_style->ythickness = 0; |
| 162 gtk_widget_modify_style(body_, no_padding_style); | 162 gtk_widget_modify_style(body_, no_padding_style); |
| 163 g_object_unref(no_padding_style); | 163 g_object_unref(no_padding_style); |
| 164 | 164 |
| 165 name_label_ = gtk_label_new(NULL); | 165 name_label_ = gtk_label_new(NULL); |
| 166 | 166 |
| 167 // TODO(estade): This is at best an educated guess, since we don't actually | 167 // TODO(estade): This is at best an educated guess, since we don't actually |
| 168 // use ChromeFont() to draw the text. This is why we need to add so | 168 // use gfx::Font() to draw the text. This is why we need to add so |
| 169 // much padding when we set the size request. We need to either use ChromeFont | 169 // much padding when we set the size request. We need to either use gfx::Font |
| 170 // or somehow extend TextElider. | 170 // or somehow extend TextElider. |
| 171 std::wstring elided_filename = gfx::ElideFilename( | 171 std::wstring elided_filename = gfx::ElideFilename( |
| 172 download_model_->download()->GetFileName(), | 172 download_model_->download()->GetFileName(), |
| 173 ChromeFont(), kTextWidth); | 173 gfx::Font(), kTextWidth); |
| 174 gchar* label_markup = | 174 gchar* label_markup = |
| 175 g_markup_printf_escaped(kLabelColorMarkup, kFilenameColor, | 175 g_markup_printf_escaped(kLabelColorMarkup, kFilenameColor, |
| 176 WideToUTF8(elided_filename).c_str()); | 176 WideToUTF8(elided_filename).c_str()); |
| 177 gtk_label_set_markup(GTK_LABEL(name_label_), label_markup); | 177 gtk_label_set_markup(GTK_LABEL(name_label_), label_markup); |
| 178 g_free(label_markup); | 178 g_free(label_markup); |
| 179 | 179 |
| 180 status_label_ = gtk_label_new(NULL); | 180 status_label_ = gtk_label_new(NULL); |
| 181 // Left align and vertically center the labels. | 181 // Left align and vertically center the labels. |
| 182 gtk_misc_set_alignment(GTK_MISC(name_label_), 0, 0.5); | 182 gtk_misc_set_alignment(GTK_MISC(name_label_), 0, 0.5); |
| 183 gtk_misc_set_alignment(GTK_MISC(status_label_), 0, 0.5); | 183 gtk_misc_set_alignment(GTK_MISC(status_label_), 0, 0.5); |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 // static | 453 // static |
| 454 void DownloadItemGtk::OnShelfResized(GtkWidget *widget, | 454 void DownloadItemGtk::OnShelfResized(GtkWidget *widget, |
| 455 GtkAllocation *allocation, | 455 GtkAllocation *allocation, |
| 456 DownloadItemGtk* item) { | 456 DownloadItemGtk* item) { |
| 457 if (item->hbox_->allocation.x + item->hbox_->allocation.width > | 457 if (item->hbox_->allocation.x + item->hbox_->allocation.width > |
| 458 item->bounding_widget_->allocation.x) | 458 item->bounding_widget_->allocation.x) |
| 459 gtk_widget_hide(item->hbox_); | 459 gtk_widget_hide(item->hbox_); |
| 460 else | 460 else |
| 461 gtk_widget_show(item->hbox_); | 461 gtk_widget_show(item->hbox_); |
| 462 } | 462 } |
| OLD | NEW |