| 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/about_chrome_dialog.h" | 5 #include "chrome/browser/gtk/about_chrome_dialog.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| 11 #include "base/file_version_info.h" | 11 #include "base/file_version_info.h" |
| 12 #include "base/gfx/gtk_util.h" | 12 #include "base/gfx/gtk_util.h" |
| 13 #include "chrome/browser/browser_list.h" | 13 #include "chrome/browser/browser_list.h" |
| 14 #include "chrome/browser/gtk/gtk_chrome_link_button.h" | 14 #include "chrome/browser/gtk/gtk_chrome_link_button.h" |
| 15 #include "chrome/browser/profile.h" | 15 #include "chrome/browser/profile.h" |
| 16 #include "chrome/common/chrome_constants.h" | 16 #include "chrome/common/chrome_constants.h" |
| 17 #include "chrome/common/gtk_util.h" | 17 #include "chrome/common/gtk_util.h" |
| 18 #include "chrome/common/url_constants.h" |
| 18 #include "grit/chromium_strings.h" | 19 #include "grit/chromium_strings.h" |
| 19 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
| 20 #include "grit/locale_settings.h" | 21 #include "grit/locale_settings.h" |
| 21 #include "grit/theme_resources.h" | 22 #include "grit/theme_resources.h" |
| 22 #include "webkit/glue/webkit_glue.h" | 23 #include "webkit/glue/webkit_glue.h" |
| 23 | 24 |
| 24 namespace { | 25 namespace { |
| 25 | 26 |
| 26 // The URLs that you navigate to when clicking the links in the About dialog. | |
| 27 const char* const kAcknowledgements = "about:credits"; | |
| 28 const char* const kTOS = "about:terms"; | |
| 29 | |
| 30 // Left or right margin. | 27 // Left or right margin. |
| 31 const int kPanelHorizMargin = 13; | 28 const int kPanelHorizMargin = 13; |
| 32 | 29 |
| 33 // Top or bottom margin. | 30 // Top or bottom margin. |
| 34 const int kPanelVertMargin = 20; | 31 const int kPanelVertMargin = 20; |
| 35 | 32 |
| 36 // Extra spacing between product name and version number. | 33 // Extra spacing between product name and version number. |
| 37 const int kExtraLineSpacing = 5; | 34 const int kExtraLineSpacing = 5; |
| 38 | 35 |
| 39 // These are used as placeholder text around the links in the text in the about | 36 // These are used as placeholder text around the links in the text in the about |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 GtkWidget* swap = second_link; | 195 GtkWidget* swap = second_link; |
| 199 second_link = first_link; | 196 second_link = first_link; |
| 200 first_link = swap; | 197 first_link = swap; |
| 201 } | 198 } |
| 202 | 199 |
| 203 g_signal_connect(chromium_url_appears_first ? first_link : second_link, | 200 g_signal_connect(chromium_url_appears_first ? first_link : second_link, |
| 204 "clicked", G_CALLBACK(OnLinkButtonClick), | 201 "clicked", G_CALLBACK(OnLinkButtonClick), |
| 205 const_cast<char*>(GetChromiumUrl())); | 202 const_cast<char*>(GetChromiumUrl())); |
| 206 g_signal_connect(chromium_url_appears_first ? second_link : first_link, | 203 g_signal_connect(chromium_url_appears_first ? second_link : first_link, |
| 207 "clicked", G_CALLBACK(OnLinkButtonClick), | 204 "clicked", G_CALLBACK(OnLinkButtonClick), |
| 208 const_cast<char*>(kAcknowledgements)); | 205 const_cast<char*>(chrome::kAboutCreditsURL)); |
| 209 | 206 |
| 210 GtkWidget* license_hbox = gtk_hbox_new(FALSE, 0); | 207 GtkWidget* license_hbox = gtk_hbox_new(FALSE, 0); |
| 211 gtk_box_pack_start(GTK_BOX(license_hbox), license_chunk1, | 208 gtk_box_pack_start(GTK_BOX(license_hbox), license_chunk1, |
| 212 FALSE, FALSE, 0); | 209 FALSE, FALSE, 0); |
| 213 gtk_box_pack_start(GTK_BOX(license_hbox), first_link, | 210 gtk_box_pack_start(GTK_BOX(license_hbox), first_link, |
| 214 FALSE, FALSE, 0); | 211 FALSE, FALSE, 0); |
| 215 gtk_box_pack_start(GTK_BOX(license_hbox), license_chunk2, | 212 gtk_box_pack_start(GTK_BOX(license_hbox), license_chunk2, |
| 216 FALSE, FALSE, 0); | 213 FALSE, FALSE, 0); |
| 217 | 214 |
| 218 // Since there's no good way to dynamically wrap the license block, force | 215 // Since there's no good way to dynamically wrap the license block, force |
| (...skipping 25 matching lines...) Expand all Loading... |
| 244 gtk_chrome_link_button_new_with_markup(tos_link_text.c_str()); | 241 gtk_chrome_link_button_new_with_markup(tos_link_text.c_str()); |
| 245 GtkWidget* tos_chunk2 = MakeMarkupLabel( | 242 GtkWidget* tos_chunk2 = MakeMarkupLabel( |
| 246 kSmaller, WideToUTF8(text.substr(url_offsets[0])).c_str()); | 243 kSmaller, WideToUTF8(text.substr(url_offsets[0])).c_str()); |
| 247 | 244 |
| 248 GtkWidget* tos_hbox = gtk_hbox_new(FALSE, 0); | 245 GtkWidget* tos_hbox = gtk_hbox_new(FALSE, 0); |
| 249 gtk_box_pack_start(GTK_BOX(tos_hbox), tos_chunk1, FALSE, FALSE, 0); | 246 gtk_box_pack_start(GTK_BOX(tos_hbox), tos_chunk1, FALSE, FALSE, 0); |
| 250 gtk_box_pack_start(GTK_BOX(tos_hbox), tos_link, FALSE, FALSE, 0); | 247 gtk_box_pack_start(GTK_BOX(tos_hbox), tos_link, FALSE, FALSE, 0); |
| 251 gtk_box_pack_start(GTK_BOX(tos_hbox), tos_chunk2, FALSE, FALSE, 0); | 248 gtk_box_pack_start(GTK_BOX(tos_hbox), tos_chunk2, FALSE, FALSE, 0); |
| 252 | 249 |
| 253 g_signal_connect(tos_link, "clicked", G_CALLBACK(OnLinkButtonClick), | 250 g_signal_connect(tos_link, "clicked", G_CALLBACK(OnLinkButtonClick), |
| 254 const_cast<char*>(kTOS)); | 251 const_cast<char*>(chrome::kAboutTermsURL)); |
| 255 gtk_box_pack_start(GTK_BOX(vbox), tos_hbox, TRUE, TRUE, 0); | 252 gtk_box_pack_start(GTK_BOX(vbox), tos_hbox, TRUE, TRUE, 0); |
| 256 #endif | 253 #endif |
| 257 | 254 |
| 258 gtk_box_pack_start(GTK_BOX(content_area), vbox, TRUE, TRUE, 0); | 255 gtk_box_pack_start(GTK_BOX(content_area), vbox, TRUE, TRUE, 0); |
| 259 | 256 |
| 260 g_signal_connect(dialog, "response", G_CALLBACK(OnDialogResponse), NULL); | 257 g_signal_connect(dialog, "response", G_CALLBACK(OnDialogResponse), NULL); |
| 261 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); | 258 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); |
| 262 gtk_widget_show_all(dialog); | 259 gtk_widget_show_all(dialog); |
| 263 } | 260 } |
| OLD | NEW |