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 "base/gfx/gtk_util.h" | 7 #include "base/gfx/gtk_util.h" |
8 #include "chrome/browser/download/download_item_model.h" | 8 #include "chrome/browser/download/download_item_model.h" |
9 #include "chrome/browser/gtk/custom_button.h" | 9 #include "chrome/browser/gtk/custom_button.h" |
10 #include "chrome/browser/gtk/download_item_gtk.h" | 10 #include "chrome/browser/gtk/download_item_gtk.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 // Create the "Show all downloads..." link and connect to the click event. | 89 // Create the "Show all downloads..." link and connect to the click event. |
90 std::string link_text = | 90 std::string link_text = |
91 l10n_util::GetStringUTF8(IDS_SHOW_ALL_DOWNLOADS); | 91 l10n_util::GetStringUTF8(IDS_SHOW_ALL_DOWNLOADS); |
92 link_button_.reset(new LinkButtonGtk(link_text.c_str())); | 92 link_button_.reset(new LinkButtonGtk(link_text.c_str())); |
93 g_signal_connect(link_button_->widget(), "clicked", | 93 g_signal_connect(link_button_->widget(), "clicked", |
94 G_CALLBACK(OnButtonClick), this); | 94 G_CALLBACK(OnButtonClick), this); |
95 | 95 |
96 // Make the download arrow icon. | 96 // Make the download arrow icon. |
97 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 97 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
98 GdkPixbuf* download_pixbuf = rb.LoadPixbuf(IDR_DOWNLOADS_FAVICON); | 98 GdkPixbuf* download_pixbuf = rb.GetPixbufNamed(IDR_DOWNLOADS_FAVICON); |
99 GtkWidget* download_image = gtk_image_new_from_pixbuf(download_pixbuf); | 99 GtkWidget* download_image = gtk_image_new_from_pixbuf(download_pixbuf); |
100 gdk_pixbuf_unref(download_pixbuf); | |
101 | 100 |
102 // Pack the link and the icon in an hbox. | 101 // Pack the link and the icon in an hbox. |
103 link_hbox_ = gtk_hbox_new(FALSE, 5); | 102 link_hbox_ = gtk_hbox_new(FALSE, 5); |
104 gtk_box_pack_start(GTK_BOX(link_hbox_), download_image, FALSE, FALSE, 0); | 103 gtk_box_pack_start(GTK_BOX(link_hbox_), download_image, FALSE, FALSE, 0); |
105 gtk_box_pack_start(GTK_BOX(link_hbox_), link_button_->widget(), | 104 gtk_box_pack_start(GTK_BOX(link_hbox_), link_button_->widget(), |
106 FALSE, FALSE, 0); | 105 FALSE, FALSE, 0); |
107 gtk_box_pack_end(GTK_BOX(hbox_), link_hbox_, FALSE, FALSE, 0); | 106 gtk_box_pack_end(GTK_BOX(hbox_), link_hbox_, FALSE, FALSE, 0); |
108 | 107 |
109 // Stick ourselves at the bottom of the parent tab contents. | 108 // Stick ourselves at the bottom of the parent tab contents. |
110 GtkWidget* parent_contents = tab_contents->GetNativeView(); | 109 GtkWidget* parent_contents = tab_contents->GetNativeView(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 // static | 145 // static |
147 void DownloadShelfGtk::OnButtonClick(GtkWidget* button, | 146 void DownloadShelfGtk::OnButtonClick(GtkWidget* button, |
148 DownloadShelfGtk* shelf) { | 147 DownloadShelfGtk* shelf) { |
149 if (button == shelf->close_button_->widget()) { | 148 if (button == shelf->close_button_->widget()) { |
150 shelf->Hide(); | 149 shelf->Hide(); |
151 } else { | 150 } else { |
152 // The link button was clicked. | 151 // The link button was clicked. |
153 shelf->ShowAllDownloads(); | 152 shelf->ShowAllDownloads(); |
154 } | 153 } |
155 } | 154 } |
OLD | NEW |