OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/gtk/create_application_shortcuts_dialog_gtk.h" | 5 #include "chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/environment.h" | 9 #include "base/environment.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 NULL); | 93 NULL); |
94 gtk_widget_realize(create_dialog_); | 94 gtk_widget_realize(create_dialog_); |
95 gtk_window_set_resizable(GTK_WINDOW(create_dialog_), false); | 95 gtk_window_set_resizable(GTK_WINDOW(create_dialog_), false); |
96 gtk_util::AddButtonToDialog(create_dialog_, | 96 gtk_util::AddButtonToDialog(create_dialog_, |
97 l10n_util::GetStringUTF8(IDS_CANCEL).c_str(), | 97 l10n_util::GetStringUTF8(IDS_CANCEL).c_str(), |
98 GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT); | 98 GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT); |
99 gtk_util::AddButtonToDialog(create_dialog_, | 99 gtk_util::AddButtonToDialog(create_dialog_, |
100 l10n_util::GetStringUTF8(IDS_CREATE_SHORTCUTS_COMMIT).c_str(), | 100 l10n_util::GetStringUTF8(IDS_CREATE_SHORTCUTS_COMMIT).c_str(), |
101 GTK_STOCK_APPLY, GTK_RESPONSE_ACCEPT); | 101 GTK_STOCK_APPLY, GTK_RESPONSE_ACCEPT); |
102 | 102 |
103 GtkWidget* content_area = GTK_DIALOG(create_dialog_)->vbox; | 103 GtkWidget* content_area = |
| 104 gtk_dialog_get_content_area(GTK_DIALOG(create_dialog_)); |
104 gtk_box_set_spacing(GTK_BOX(content_area), gtk_util::kContentAreaSpacing); | 105 gtk_box_set_spacing(GTK_BOX(content_area), gtk_util::kContentAreaSpacing); |
105 | 106 |
106 GtkWidget* vbox = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); | 107 GtkWidget* vbox = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); |
107 gtk_container_add(GTK_CONTAINER(content_area), vbox); | 108 gtk_container_add(GTK_CONTAINER(content_area), vbox); |
108 | 109 |
109 // Create a box containing basic information about the new shortcut: an image | 110 // Create a box containing basic information about the new shortcut: an image |
110 // on the left, and a description on the right. | 111 // on the left, and a description on the right. |
111 GtkWidget* hbox = gtk_hbox_new(FALSE, gtk_util::kControlSpacing); | 112 GtkWidget* hbox = gtk_hbox_new(FALSE, gtk_util::kControlSpacing); |
112 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | 113 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
113 gtk_container_set_border_width(GTK_CONTAINER(hbox), | 114 gtk_container_set_border_width(GTK_CONTAINER(hbox), |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 (GtkDialogFlags) (GTK_DIALOG_NO_SEPARATOR), | 234 (GtkDialogFlags) (GTK_DIALOG_NO_SEPARATOR), |
234 GTK_STOCK_OK, | 235 GTK_STOCK_OK, |
235 GTK_RESPONSE_ACCEPT, | 236 GTK_RESPONSE_ACCEPT, |
236 NULL); | 237 NULL); |
237 gtk_widget_realize(error_dialog_); | 238 gtk_widget_realize(error_dialog_); |
238 gtk_util::SetWindowSizeFromResources( | 239 gtk_util::SetWindowSizeFromResources( |
239 GTK_WINDOW(error_dialog_), | 240 GTK_WINDOW(error_dialog_), |
240 IDS_CREATE_SHORTCUTS_ERROR_DIALOG_WIDTH_CHARS, | 241 IDS_CREATE_SHORTCUTS_ERROR_DIALOG_WIDTH_CHARS, |
241 IDS_CREATE_SHORTCUTS_ERROR_DIALOG_HEIGHT_LINES, | 242 IDS_CREATE_SHORTCUTS_ERROR_DIALOG_HEIGHT_LINES, |
242 false); // resizable | 243 false); // resizable |
243 GtkWidget* content_area = GTK_DIALOG(error_dialog_)->vbox; | 244 GtkWidget* content_area = |
| 245 gtk_dialog_get_content_area(GTK_DIALOG(error_dialog_)); |
244 gtk_box_set_spacing(GTK_BOX(content_area), gtk_util::kContentAreaSpacing); | 246 gtk_box_set_spacing(GTK_BOX(content_area), gtk_util::kContentAreaSpacing); |
245 | 247 |
246 GtkWidget* vbox = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); | 248 GtkWidget* vbox = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); |
247 gtk_container_add(GTK_CONTAINER(content_area), vbox); | 249 gtk_container_add(GTK_CONTAINER(content_area), vbox); |
248 | 250 |
249 // Label on top of the checkboxes. | 251 // Label on top of the checkboxes. |
250 GtkWidget* description = gtk_label_new( | 252 GtkWidget* description = gtk_label_new( |
251 l10n_util::GetStringFUTF8( | 253 l10n_util::GetStringFUTF8( |
252 IDS_CREATE_SHORTCUTS_ERROR_LABEL, | 254 IDS_CREATE_SHORTCUTS_ERROR_LABEL, |
253 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)).c_str()); | 255 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)).c_str()); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 void CreateChromeApplicationShortcutsDialogGtk::OnImageLoaded( | 329 void CreateChromeApplicationShortcutsDialogGtk::OnImageLoaded( |
328 SkBitmap* image, const ExtensionResource& resource, int index) { | 330 SkBitmap* image, const ExtensionResource& resource, int index) { |
329 if (!image || image->isNull()) | 331 if (!image || image->isNull()) |
330 image = ExtensionIconSource::LoadImageByResourceId(IDR_APP_DEFAULT_ICON); | 332 image = ExtensionIconSource::LoadImageByResourceId(IDR_APP_DEFAULT_ICON); |
331 | 333 |
332 shortcut_info_.favicon = *image; | 334 shortcut_info_.favicon = *image; |
333 | 335 |
334 CreateIconPixBuf(*image); | 336 CreateIconPixBuf(*image); |
335 CreateDialogBox(parent_); | 337 CreateDialogBox(parent_); |
336 } | 338 } |
OLD | NEW |