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/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/gfx/canvas.h" | 8 #include "app/gfx/canvas.h" |
9 #include "app/gfx/font.h" | 9 #include "app/gfx/font.h" |
10 #include "app/gfx/text_elider.h" | 10 #include "app/gfx/text_elider.h" |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 gtk_label_set_line_wrap(GTK_LABEL(dangerous_label), TRUE); | 303 gtk_label_set_line_wrap(GTK_LABEL(dangerous_label), TRUE); |
304 gtk_box_pack_start(GTK_BOX(dangerous_hbox_), dangerous_label, | 304 gtk_box_pack_start(GTK_BOX(dangerous_hbox_), dangerous_label, |
305 FALSE, FALSE, 0); | 305 FALSE, FALSE, 0); |
306 g_free(label_markup); | 306 g_free(label_markup); |
307 | 307 |
308 // Create the ok button. | 308 // Create the ok button. |
309 GtkWidget* dangerous_accept = gtk_button_new_with_label( | 309 GtkWidget* dangerous_accept = gtk_button_new_with_label( |
310 l10n_util::GetStringUTF8(IDS_SAVE_DOWNLOAD).c_str()); | 310 l10n_util::GetStringUTF8(IDS_SAVE_DOWNLOAD).c_str()); |
311 g_signal_connect(dangerous_accept, "clicked", | 311 g_signal_connect(dangerous_accept, "clicked", |
312 G_CALLBACK(OnDangerousAccept), this); | 312 G_CALLBACK(OnDangerousAccept), this); |
313 GtkWidget* dangerous_accept_vbox = gtk_vbox_new(FALSE, 0); | 313 gtk_util::CenterWidgetInHBox(dangerous_hbox_, dangerous_accept, false, 0); |
314 gtk_box_pack_start(GTK_BOX(dangerous_accept_vbox), dangerous_accept, | |
315 TRUE, FALSE, 0); | |
316 gtk_box_pack_start(GTK_BOX(dangerous_hbox_), dangerous_accept_vbox, | |
317 FALSE, FALSE, 0); | |
318 | 314 |
319 // Create the nevermind button. | 315 // Create the nevermind button. |
320 GtkWidget* dangerous_decline = gtk_button_new_with_label( | 316 GtkWidget* dangerous_decline = gtk_button_new_with_label( |
321 l10n_util::GetStringUTF8(IDS_DISCARD_DOWNLOAD).c_str()); | 317 l10n_util::GetStringUTF8(IDS_DISCARD_DOWNLOAD).c_str()); |
322 g_signal_connect(dangerous_decline, "clicked", | 318 g_signal_connect(dangerous_decline, "clicked", |
323 G_CALLBACK(OnDangerousDecline), this); | 319 G_CALLBACK(OnDangerousDecline), this); |
324 GtkWidget* dangerous_decline_vbox = gtk_vbox_new(FALSE, 0); | 320 gtk_util::CenterWidgetInHBox(dangerous_hbox_, dangerous_decline, false, 0); |
325 gtk_box_pack_start(GTK_BOX(dangerous_decline_vbox), dangerous_decline, | |
326 TRUE, FALSE, 0); | |
327 gtk_box_pack_start(GTK_BOX(dangerous_hbox_), dangerous_decline_vbox, | |
328 FALSE, FALSE, 0); | |
329 | 321 |
330 // Put it in an alignment so that padding will be added on the left and | 322 // Put it in an alignment so that padding will be added on the left and |
331 // right, and an event box so that drawing will be clipped correctly. | 323 // right, and an event box so that drawing will be clipped correctly. |
332 dangerous_prompt_ = gtk_util::CreateGtkBorderBin(dangerous_hbox_, NULL, | 324 dangerous_prompt_ = gtk_util::CreateGtkBorderBin(dangerous_hbox_, NULL, |
333 0, 0, kDangerousElementPadding, kDangerousElementPadding); | 325 0, 0, kDangerousElementPadding, kDangerousElementPadding); |
334 gtk_box_pack_start(GTK_BOX(hbox_), dangerous_prompt_, FALSE, FALSE, 0); | 326 gtk_box_pack_start(GTK_BOX(hbox_), dangerous_prompt_, FALSE, FALSE, 0); |
335 gtk_widget_set_app_paintable(dangerous_prompt_, TRUE); | 327 gtk_widget_set_app_paintable(dangerous_prompt_, TRUE); |
336 g_signal_connect(dangerous_prompt_, "expose-event", | 328 g_signal_connect(dangerous_prompt_, "expose-event", |
337 G_CALLBACK(OnDangerousPromptExpose), this); | 329 G_CALLBACK(OnDangerousPromptExpose), this); |
338 gtk_widget_show_all(dangerous_prompt_); | 330 gtk_widget_show_all(dangerous_prompt_); |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 item->get_download()); | 655 item->get_download()); |
664 } | 656 } |
665 | 657 |
666 // static | 658 // static |
667 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button, | 659 void DownloadItemGtk::OnDangerousDecline(GtkWidget* button, |
668 DownloadItemGtk* item) { | 660 DownloadItemGtk* item) { |
669 if (item->get_download()->state() == DownloadItem::IN_PROGRESS) | 661 if (item->get_download()->state() == DownloadItem::IN_PROGRESS) |
670 item->get_download()->Cancel(true); | 662 item->get_download()->Cancel(true); |
671 item->get_download()->Remove(true); | 663 item->get_download()->Remove(true); |
672 } | 664 } |
OLD | NEW |