| 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_shelf_gtk.h" | 5 #include "chrome/browser/gtk/download_shelf_gtk.h" |
| 6 | 6 |
| 7 #include "app/gfx/gtk_util.h" | 7 #include "app/gfx/gtk_util.h" |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
| 10 #include "chrome/browser/browser.h" | 10 #include "chrome/browser/browser.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // To make things pretty, we have to add a few more widgets. To get padding | 55 // To make things pretty, we have to add a few more widgets. To get padding |
| 56 // right, we stick the hbox in an alignment. We put that alignment in an | 56 // right, we stick the hbox in an alignment. We put that alignment in an |
| 57 // event box so we can color the background. | 57 // event box so we can color the background. |
| 58 | 58 |
| 59 // Create the top border. | 59 // Create the top border. |
| 60 top_border_ = gtk_event_box_new(); | 60 top_border_ = gtk_event_box_new(); |
| 61 gtk_widget_set_size_request(GTK_WIDGET(top_border_), 0, 1); | 61 gtk_widget_set_size_request(GTK_WIDGET(top_border_), 0, 1); |
| 62 | 62 |
| 63 // Create |hbox_|. | 63 // Create |hbox_|. |
| 64 hbox_.Own(gtk_hbox_new(FALSE, kDownloadItemPadding)); | 64 hbox_.Own(gtk_hbox_new(FALSE, kDownloadItemPadding)); |
| 65 // We want the download shelf to be horizontally shrinkable, so that the | 65 gtk_widget_set_size_request(hbox_.get(), -1, kDownloadItemHeight); |
| 66 // Chrome window can be resized freely even with many download items. | |
| 67 gtk_widget_set_size_request(hbox_.get(), 0, kDownloadItemHeight); | |
| 68 | 66 |
| 69 // Get the padding and background color for |hbox_| right. | 67 // Get the padding and background color for |hbox_| right. |
| 70 GtkWidget* padding = gtk_alignment_new(0, 0, 1, 1); | 68 GtkWidget* padding = gtk_alignment_new(0, 0, 1, 1); |
| 71 // Subtract 1 from top spacing to account for top border. | 69 // Subtract 1 from top spacing to account for top border. |
| 72 gtk_alignment_set_padding(GTK_ALIGNMENT(padding), | 70 gtk_alignment_set_padding(GTK_ALIGNMENT(padding), |
| 73 kTopBottomPadding - 1, kTopBottomPadding, kLeftPadding, kRightPadding); | 71 kTopBottomPadding - 1, kTopBottomPadding, kLeftPadding, kRightPadding); |
| 74 padding_bg_ = gtk_event_box_new(); | 72 padding_bg_ = gtk_event_box_new(); |
| 75 gtk_container_add(GTK_CONTAINER(padding_bg_), padding); | 73 gtk_container_add(GTK_CONTAINER(padding_bg_), padding); |
| 76 gtk_container_add(GTK_CONTAINER(padding), hbox_.get()); | 74 gtk_container_add(GTK_CONTAINER(padding), hbox_.get()); |
| 77 | 75 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 // static | 245 // static |
| 248 void DownloadShelfGtk::OnButtonClick(GtkWidget* button, | 246 void DownloadShelfGtk::OnButtonClick(GtkWidget* button, |
| 249 DownloadShelfGtk* shelf) { | 247 DownloadShelfGtk* shelf) { |
| 250 if (button == shelf->close_button_->widget()) { | 248 if (button == shelf->close_button_->widget()) { |
| 251 shelf->Close(); | 249 shelf->Close(); |
| 252 } else { | 250 } else { |
| 253 // The link button was clicked. | 251 // The link button was clicked. |
| 254 shelf->browser_->ShowDownloadsTab(); | 252 shelf->browser_->ShowDownloadsTab(); |
| 255 } | 253 } |
| 256 } | 254 } |
| OLD | NEW |