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/gfx/gtk_util.h" | 9 #include "app/gfx/gtk_util.h" |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
11 #include "app/resource_bundle.h" | 11 #include "app/resource_bundle.h" |
12 #include "base/file_version_info.h" | 12 #include "base/file_version_info.h" |
13 #include "chrome/browser/browser_list.h" | 13 #include "chrome/browser/browser_list.h" |
| 14 #include "chrome/browser/gtk/cairo_cached_surface.h" |
14 #include "chrome/browser/gtk/gtk_chrome_link_button.h" | 15 #include "chrome/browser/gtk/gtk_chrome_link_button.h" |
| 16 #include "chrome/browser/gtk/gtk_theme_provider.h" |
15 #include "chrome/browser/profile.h" | 17 #include "chrome/browser/profile.h" |
16 #include "chrome/common/chrome_constants.h" | 18 #include "chrome/common/chrome_constants.h" |
17 #include "chrome/common/gtk_util.h" | 19 #include "chrome/common/gtk_util.h" |
18 #include "chrome/common/url_constants.h" | 20 #include "chrome/common/url_constants.h" |
19 #include "grit/chromium_strings.h" | 21 #include "grit/chromium_strings.h" |
20 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
21 #include "grit/locale_settings.h" | 23 #include "grit/locale_settings.h" |
22 #include "grit/theme_resources.h" | 24 #include "grit/theme_resources.h" |
23 #include "webkit/glue/webkit_glue.h" | 25 #include "webkit/glue/webkit_glue.h" |
24 | 26 |
(...skipping 11 matching lines...) Expand all Loading... |
36 // These are used as placeholder text around the links in the text in the about | 38 // These are used as placeholder text around the links in the text in the about |
37 // dialog. | 39 // dialog. |
38 const char* kBeginLinkChr = "BEGIN_LINK_CHR"; | 40 const char* kBeginLinkChr = "BEGIN_LINK_CHR"; |
39 const char* kBeginLinkOss = "BEGIN_LINK_OSS"; | 41 const char* kBeginLinkOss = "BEGIN_LINK_OSS"; |
40 // We don't actually use this one. | 42 // We don't actually use this one. |
41 // const char* kEndLinkChr = "END_LINK_CHR"; | 43 // const char* kEndLinkChr = "END_LINK_CHR"; |
42 const char* kEndLinkOss = "END_LINK_OSS"; | 44 const char* kEndLinkOss = "END_LINK_OSS"; |
43 const char* kBeginLink = "BEGIN_LINK"; | 45 const char* kBeginLink = "BEGIN_LINK"; |
44 const char* kEndLink = "END_LINK"; | 46 const char* kEndLink = "END_LINK"; |
45 | 47 |
46 const char* kSmaller = "<span size=\"smaller\">%s</span>"; | |
47 | |
48 void OnDialogResponse(GtkDialog* dialog, int response_id) { | 48 void OnDialogResponse(GtkDialog* dialog, int response_id) { |
49 // We're done. | 49 // We're done. |
50 gtk_widget_destroy(GTK_WIDGET(dialog)); | 50 gtk_widget_destroy(GTK_WIDGET(dialog)); |
51 } | 51 } |
52 | 52 |
53 void FixLabelWrappingCallback(GtkWidget *label, | 53 void FixLabelWrappingCallback(GtkWidget *label, |
54 GtkAllocation *allocation, | 54 GtkAllocation *allocation, |
55 gpointer data) { | 55 gpointer data) { |
56 gtk_widget_set_size_request(label, allocation->width, -1); | 56 gtk_widget_set_size_request(label, allocation->width, -1); |
57 } | 57 } |
(...skipping 13 matching lines...) Expand all Loading... |
71 void OnLinkButtonClick(GtkWidget* button, const char* url) { | 71 void OnLinkButtonClick(GtkWidget* button, const char* url) { |
72 BrowserList::GetLastActive()-> | 72 BrowserList::GetLastActive()-> |
73 OpenURL(GURL(url), GURL(), NEW_WINDOW, PageTransition::LINK); | 73 OpenURL(GURL(url), GURL(), NEW_WINDOW, PageTransition::LINK); |
74 } | 74 } |
75 | 75 |
76 const char* GetChromiumUrl() { | 76 const char* GetChromiumUrl() { |
77 static std::string url(l10n_util::GetStringUTF8(IDS_CHROMIUM_PROJECT_URL)); | 77 static std::string url(l10n_util::GetStringUTF8(IDS_CHROMIUM_PROJECT_URL)); |
78 return url.c_str(); | 78 return url.c_str(); |
79 } | 79 } |
80 | 80 |
81 std::string Smaller(const std::string& text) { | 81 gboolean OnEventBoxExpose(GtkWidget* event_box, |
82 return std::string("<span size=\"smaller\">") + text + std::string("</span>"); | 82 GdkEventExpose* expose, |
| 83 gboolean user_data) { |
| 84 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(event_box->window)); |
| 85 gdk_cairo_rectangle(cr, &expose->area); |
| 86 cairo_clip(cr); |
| 87 GtkThemeProvider* theme_provider = |
| 88 GtkThemeProvider::GetFrom(BrowserList::GetLastActive()->profile()); |
| 89 CairoCachedSurface* background = theme_provider->GetSurfaceNamed( |
| 90 IDR_ABOUT_BACKGROUND_COLOR, event_box); |
| 91 |
| 92 background->SetSource(cr, 0, 0); |
| 93 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); |
| 94 gdk_cairo_rectangle(cr, &expose->area); |
| 95 cairo_fill(cr); |
| 96 cairo_destroy(cr); |
| 97 return FALSE; |
83 } | 98 } |
84 | 99 |
85 } // namespace | 100 } // namespace |
86 | 101 |
87 void ShowAboutDialogForProfile(GtkWindow* parent, Profile* profile) { | 102 void ShowAboutDialogForProfile(GtkWindow* parent, Profile* profile) { |
88 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 103 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
89 static GdkPixbuf* background = rb.GetPixbufNamed(IDR_ABOUT_BACKGROUND); | 104 static GdkPixbuf* background = rb.GetPixbufNamed(IDR_ABOUT_BACKGROUND); |
90 scoped_ptr<FileVersionInfo> version_info( | 105 scoped_ptr<FileVersionInfo> version_info( |
91 FileVersionInfo::CreateFileVersionInfoForCurrentModule()); | 106 FileVersionInfo::CreateFileVersionInfoForCurrentModule()); |
92 std::wstring current_version = version_info->file_version(); | 107 std::wstring current_version = version_info->file_version(); |
93 #if !defined(GOOGLE_CHROME_BUILD) | 108 #if !defined(GOOGLE_CHROME_BUILD) |
94 current_version += L" ("; | 109 current_version += L" ("; |
95 current_version += version_info->last_change(); | 110 current_version += version_info->last_change(); |
96 current_version += L")"; | 111 current_version += L")"; |
97 #endif | 112 #endif |
98 | 113 |
99 // Build the dialog. | 114 // Build the dialog. |
100 GtkWidget* dialog = gtk_dialog_new_with_buttons( | 115 GtkWidget* dialog = gtk_dialog_new_with_buttons( |
101 l10n_util::GetStringUTF8(IDS_ABOUT_CHROME_TITLE).c_str(), | 116 l10n_util::GetStringUTF8(IDS_ABOUT_CHROME_TITLE).c_str(), |
102 parent, | 117 parent, |
103 GTK_DIALOG_MODAL, | 118 GTK_DIALOG_MODAL, |
104 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, | |
105 NULL); | 119 NULL); |
106 // Pick up the style set in gtk_util.cc:InitRCStyles(). | 120 // Pick up the style set in gtk_util.cc:InitRCStyles(). |
107 // The layout of this dialog is special because the logo should be flush | 121 // The layout of this dialog is special because the logo should be flush |
108 // with the edges of the window. | 122 // with the edges of the window. |
109 gtk_widget_set_name(dialog, "about-dialog"); | 123 gtk_widget_set_name(dialog, "about-dialog"); |
110 gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); | 124 gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); |
111 | 125 |
| 126 GtkWidget* close_button = gtk_dialog_add_button(GTK_DIALOG(dialog), |
| 127 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); |
| 128 |
112 GtkWidget* content_area = GTK_DIALOG(dialog)->vbox; | 129 GtkWidget* content_area = GTK_DIALOG(dialog)->vbox; |
113 | 130 |
114 // Use an event box to get the background painting correctly | 131 // Use an event box to get the background painting correctly |
115 GtkWidget* ebox = gtk_event_box_new(); | 132 GtkWidget* ebox = gtk_event_box_new(); |
116 gtk_widget_modify_bg(ebox, GTK_STATE_NORMAL, &gfx::kGdkWhite); | 133 gtk_widget_set_app_paintable(ebox, TRUE); |
| 134 g_signal_connect(ebox, "expose-event", G_CALLBACK(OnEventBoxExpose), NULL); |
117 | 135 |
118 GtkWidget* hbox = gtk_hbox_new(FALSE, 0); | 136 GtkWidget* hbox = gtk_hbox_new(FALSE, 0); |
119 | 137 |
120 GtkWidget* text_alignment = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); | 138 GtkWidget* text_alignment = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); |
121 gtk_alignment_set_padding(GTK_ALIGNMENT(text_alignment), | 139 gtk_alignment_set_padding(GTK_ALIGNMENT(text_alignment), |
122 kPanelVertMargin, kPanelVertMargin, | 140 kPanelVertMargin, kPanelVertMargin, |
123 kPanelHorizMargin, kPanelHorizMargin); | 141 kPanelHorizMargin, kPanelHorizMargin); |
124 | 142 |
125 GtkWidget* text_vbox = gtk_vbox_new(FALSE, kExtraLineSpacing); | 143 GtkWidget* text_vbox = gtk_vbox_new(FALSE, kExtraLineSpacing); |
126 | 144 |
127 GdkColor black = gfx::kGdkBlack; | 145 GdkColor black = gfx::kGdkBlack; |
128 GtkWidget* product_label = MakeMarkupLabel( | 146 GtkWidget* product_label = MakeMarkupLabel( |
129 "<span font_desc=\"18\" weight=\"bold\" style=\"normal\">%s</span>", | 147 "<span font_desc=\"18\" style=\"normal\">%s</span>", |
130 l10n_util::GetStringUTF8(IDS_PRODUCT_NAME)); | 148 l10n_util::GetStringUTF8(IDS_PRODUCT_NAME)); |
131 gtk_widget_modify_fg(product_label, GTK_STATE_NORMAL, &black); | 149 gtk_widget_modify_fg(product_label, GTK_STATE_NORMAL, &black); |
132 gtk_box_pack_start(GTK_BOX(text_vbox), product_label, FALSE, FALSE, 0); | 150 gtk_box_pack_start(GTK_BOX(text_vbox), product_label, FALSE, FALSE, 0); |
133 | 151 |
134 GtkWidget* version_label = gtk_label_new(WideToUTF8(current_version).c_str()); | 152 GtkWidget* version_label = gtk_label_new(WideToUTF8(current_version).c_str()); |
135 gtk_misc_set_alignment(GTK_MISC(version_label), 0.0, 0.5); | 153 gtk_misc_set_alignment(GTK_MISC(version_label), 0.0, 0.5); |
136 gtk_label_set_selectable(GTK_LABEL(version_label), TRUE); | 154 gtk_label_set_selectable(GTK_LABEL(version_label), TRUE); |
137 gtk_widget_modify_fg(version_label, GTK_STATE_NORMAL, &black); | 155 gtk_widget_modify_fg(version_label, GTK_STATE_NORMAL, &black); |
138 gtk_box_pack_start(GTK_BOX(text_vbox), version_label, FALSE, FALSE, 0); | 156 gtk_box_pack_start(GTK_BOX(text_vbox), version_label, FALSE, FALSE, 0); |
139 | 157 |
140 gtk_container_add(GTK_CONTAINER(text_alignment), text_vbox); | 158 gtk_container_add(GTK_CONTAINER(text_alignment), text_vbox); |
141 gtk_box_pack_start(GTK_BOX(hbox), text_alignment, TRUE, TRUE, 0); | 159 gtk_box_pack_start(GTK_BOX(hbox), text_alignment, TRUE, TRUE, 0); |
142 | 160 |
143 GtkWidget* image_vbox = gtk_vbox_new(FALSE, 0); | 161 GtkWidget* image_vbox = gtk_vbox_new(FALSE, 0); |
144 gtk_box_pack_end(GTK_BOX(image_vbox), | 162 gtk_box_pack_end(GTK_BOX(image_vbox), |
145 gtk_image_new_from_pixbuf(background), | 163 gtk_image_new_from_pixbuf(background), |
146 FALSE, FALSE, 0); | 164 FALSE, FALSE, 0); |
147 | 165 |
148 gtk_box_pack_start(GTK_BOX(hbox), image_vbox, FALSE, FALSE, 0); | 166 gtk_box_pack_start(GTK_BOX(hbox), image_vbox, FALSE, FALSE, 0); |
149 gtk_container_add(GTK_CONTAINER(ebox), hbox); | 167 gtk_container_add(GTK_CONTAINER(ebox), hbox); |
150 gtk_box_pack_start(GTK_BOX(content_area), ebox, TRUE, TRUE, 0); | 168 gtk_box_pack_start(GTK_BOX(content_area), ebox, TRUE, TRUE, 0); |
151 | 169 |
152 // We use a separate box for the licensing etc. text. See the comment near | 170 // We use a separate box for the licensing etc. text. See the comment near |
153 // the top of this function about using a special layout for this dialog. | 171 // the top of this function about using a special layout for this dialog. |
154 GtkWidget* vbox = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); | 172 GtkWidget* vbox = gtk_vbox_new(FALSE, 0); |
155 gtk_container_set_border_width(GTK_CONTAINER(vbox), | |
156 gtk_util::kContentAreaBorder); | |
157 | 173 |
158 GtkWidget* copyright_label = MakeMarkupLabel( | 174 GtkWidget* copyright_label = gtk_label_new( |
159 kSmaller, l10n_util::GetStringUTF8(IDS_ABOUT_VERSION_COPYRIGHT)); | 175 l10n_util::GetStringUTF8(IDS_ABOUT_VERSION_COPYRIGHT).c_str()); |
160 gtk_box_pack_start(GTK_BOX(vbox), copyright_label, TRUE, TRUE, 5); | 176 gtk_misc_set_alignment(GTK_MISC(copyright_label), 0.0, 0.5); |
| 177 gtk_box_pack_start(GTK_BOX(vbox), copyright_label, FALSE, FALSE, 5); |
161 | 178 |
162 std::string license = l10n_util::GetStringUTF8(IDS_ABOUT_VERSION_LICENSE); | 179 std::string license = l10n_util::GetStringUTF8(IDS_ABOUT_VERSION_LICENSE); |
163 bool chromium_url_appears_first = | 180 bool chromium_url_appears_first = |
164 license.find(kBeginLinkChr) < license.find(kBeginLinkOss); | 181 license.find(kBeginLinkChr) < license.find(kBeginLinkOss); |
165 size_t link1 = license.find(kBeginLink); | 182 size_t link1 = license.find(kBeginLink); |
166 DCHECK(link1 != std::string::npos); | 183 DCHECK(link1 != std::string::npos); |
167 size_t link1_end = license.find(kEndLink, link1); | 184 size_t link1_end = license.find(kEndLink, link1); |
168 DCHECK(link1_end != std::string::npos); | 185 DCHECK(link1_end != std::string::npos); |
169 size_t link2 = license.find(kBeginLink, link1_end); | 186 size_t link2 = license.find(kBeginLink, link1_end); |
170 DCHECK(link2 != std::string::npos); | 187 DCHECK(link2 != std::string::npos); |
171 size_t link2_end = license.find(kEndLink, link2); | 188 size_t link2_end = license.find(kEndLink, link2); |
172 DCHECK(link1_end != std::string::npos); | 189 DCHECK(link1_end != std::string::npos); |
173 | 190 |
174 GtkWidget* license_chunk1 = MakeMarkupLabel( | 191 GtkWidget* license_chunk1 = gtk_label_new(license.substr(0, link1).c_str()); |
175 kSmaller, license.substr(0, link1)); | 192 gtk_misc_set_alignment(GTK_MISC(license_chunk1), 0.0, 0.5); |
176 GtkWidget* license_chunk2 = MakeMarkupLabel( | 193 GtkWidget* license_chunk2 = gtk_label_new( |
177 kSmaller, | |
178 license.substr(link1_end + strlen(kEndLinkOss), | 194 license.substr(link1_end + strlen(kEndLinkOss), |
179 link2 - link1_end - strlen(kEndLinkOss))); | 195 link2 - link1_end - strlen(kEndLinkOss)).c_str()); |
180 GtkWidget* license_chunk3 = MakeMarkupLabel( | 196 gtk_misc_set_alignment(GTK_MISC(license_chunk2), 0.0, 0.5); |
181 kSmaller, license.substr(link2_end + strlen(kEndLinkOss))); | 197 GtkWidget* license_chunk3 = gtk_label_new( |
| 198 license.substr(link2_end + strlen(kEndLinkOss)).c_str()); |
| 199 gtk_misc_set_alignment(GTK_MISC(license_chunk3), 0.0, 0.5); |
182 | 200 |
183 std::string first_link_text = Smaller( | 201 std::string first_link_text = |
184 license.substr(link1 + strlen(kBeginLinkOss), | 202 license.substr(link1 + strlen(kBeginLinkOss), |
185 link1_end - link1 - strlen(kBeginLinkOss))); | 203 link1_end - link1 - strlen(kBeginLinkOss)); |
186 std::string second_link_text = Smaller( | 204 std::string second_link_text = |
187 license.substr(link2 + strlen(kBeginLinkOss), | 205 license.substr(link2 + strlen(kBeginLinkOss), |
188 link2_end - link2 - strlen(kBeginLinkOss))); | 206 link2_end - link2 - strlen(kBeginLinkOss)); |
189 | 207 |
190 GtkWidget* first_link = | 208 GtkWidget* first_link = gtk_chrome_link_button_new(first_link_text.c_str()); |
191 gtk_chrome_link_button_new_with_markup(first_link_text.c_str()); | 209 GtkWidget* second_link = gtk_chrome_link_button_new(second_link_text.c_str()); |
192 GtkWidget* second_link = | |
193 gtk_chrome_link_button_new_with_markup(second_link_text.c_str()); | |
194 if (!chromium_url_appears_first) { | 210 if (!chromium_url_appears_first) { |
195 GtkWidget* swap = second_link; | 211 GtkWidget* swap = second_link; |
196 second_link = first_link; | 212 second_link = first_link; |
197 first_link = swap; | 213 first_link = swap; |
198 } | 214 } |
199 | 215 |
200 g_signal_connect(chromium_url_appears_first ? first_link : second_link, | 216 g_signal_connect(chromium_url_appears_first ? first_link : second_link, |
201 "clicked", G_CALLBACK(OnLinkButtonClick), | 217 "clicked", G_CALLBACK(OnLinkButtonClick), |
202 const_cast<char*>(GetChromiumUrl())); | 218 const_cast<char*>(GetChromiumUrl())); |
203 g_signal_connect(chromium_url_appears_first ? second_link : first_link, | 219 g_signal_connect(chromium_url_appears_first ? second_link : first_link, |
(...skipping 13 matching lines...) Expand all Loading... |
217 // chromium). | 233 // chromium). |
218 GtkWidget* license_hbox2 = gtk_hbox_new(FALSE, 0); | 234 GtkWidget* license_hbox2 = gtk_hbox_new(FALSE, 0); |
219 gtk_box_pack_start(GTK_BOX(license_hbox2), second_link, | 235 gtk_box_pack_start(GTK_BOX(license_hbox2), second_link, |
220 FALSE, FALSE, 0); | 236 FALSE, FALSE, 0); |
221 gtk_box_pack_start(GTK_BOX(license_hbox2), license_chunk3, | 237 gtk_box_pack_start(GTK_BOX(license_hbox2), license_chunk3, |
222 FALSE, FALSE, 0); | 238 FALSE, FALSE, 0); |
223 | 239 |
224 GtkWidget* license_vbox = gtk_vbox_new(FALSE, 0); | 240 GtkWidget* license_vbox = gtk_vbox_new(FALSE, 0); |
225 gtk_box_pack_start(GTK_BOX(license_vbox), license_hbox, FALSE, FALSE, 0); | 241 gtk_box_pack_start(GTK_BOX(license_vbox), license_hbox, FALSE, FALSE, 0); |
226 gtk_box_pack_start(GTK_BOX(license_vbox), license_hbox2, FALSE, FALSE, 0); | 242 gtk_box_pack_start(GTK_BOX(license_vbox), license_hbox2, FALSE, FALSE, 0); |
227 gtk_box_pack_start(GTK_BOX(vbox), license_vbox, TRUE, TRUE, 0); | 243 gtk_box_pack_start(GTK_BOX(vbox), license_vbox, FALSE, FALSE, 0); |
228 | 244 |
229 #if defined(GOOGLE_CHROME_BUILD) | 245 #if defined(GOOGLE_CHROME_BUILD) |
| 246 // Spacing line. |
| 247 gtk_box_pack_start(GTK_BOX(vbox), gtk_label_new(""), FALSE, FALSE, 0); |
| 248 |
230 std::vector<size_t> url_offsets; | 249 std::vector<size_t> url_offsets; |
231 std::wstring text = l10n_util::GetStringF(IDS_ABOUT_TERMS_OF_SERVICE, | 250 std::wstring text = l10n_util::GetStringF(IDS_ABOUT_TERMS_OF_SERVICE, |
232 std::wstring(), | 251 std::wstring(), |
233 std::wstring(), | 252 std::wstring(), |
234 &url_offsets); | 253 &url_offsets); |
235 | 254 |
236 std::string tos_link_text = Smaller( | 255 GtkWidget* tos_chunk1 = gtk_label_new( |
237 l10n_util::GetStringUTF8(IDS_TERMS_OF_SERVICE)); | 256 WideToUTF8(text.substr(0, url_offsets[0])).c_str()); |
238 GtkWidget* tos_chunk1 = MakeMarkupLabel( | 257 gtk_misc_set_alignment(GTK_MISC(tos_chunk1), 0.0, 0.5); |
239 kSmaller, WideToUTF8(text.substr(0, url_offsets[0])).c_str()); | 258 GtkWidget* tos_link = gtk_chrome_link_button_new( |
240 GtkWidget* tos_link = | 259 l10n_util::GetStringUTF8(IDS_TERMS_OF_SERVICE).c_str()); |
241 gtk_chrome_link_button_new_with_markup(tos_link_text.c_str()); | 260 GtkWidget* tos_chunk2 = gtk_label_new( |
242 GtkWidget* tos_chunk2 = MakeMarkupLabel( | 261 WideToUTF8(text.substr(url_offsets[0])).c_str()); |
243 kSmaller, WideToUTF8(text.substr(url_offsets[0])).c_str()); | 262 gtk_misc_set_alignment(GTK_MISC(tos_chunk2), 0.0, 0.5); |
244 | 263 |
245 GtkWidget* tos_hbox = gtk_hbox_new(FALSE, 0); | 264 GtkWidget* tos_hbox = gtk_hbox_new(FALSE, 0); |
246 gtk_box_pack_start(GTK_BOX(tos_hbox), tos_chunk1, FALSE, FALSE, 0); | 265 gtk_box_pack_start(GTK_BOX(tos_hbox), tos_chunk1, FALSE, FALSE, 0); |
247 gtk_box_pack_start(GTK_BOX(tos_hbox), tos_link, FALSE, FALSE, 0); | 266 gtk_box_pack_start(GTK_BOX(tos_hbox), tos_link, FALSE, FALSE, 0); |
248 gtk_box_pack_start(GTK_BOX(tos_hbox), tos_chunk2, FALSE, FALSE, 0); | 267 gtk_box_pack_start(GTK_BOX(tos_hbox), tos_chunk2, FALSE, FALSE, 0); |
249 | 268 |
250 g_signal_connect(tos_link, "clicked", G_CALLBACK(OnLinkButtonClick), | 269 g_signal_connect(tos_link, "clicked", G_CALLBACK(OnLinkButtonClick), |
251 const_cast<char*>(chrome::kAboutTermsURL)); | 270 const_cast<char*>(chrome::kAboutTermsURL)); |
252 gtk_box_pack_start(GTK_BOX(vbox), tos_hbox, TRUE, TRUE, 0); | 271 gtk_box_pack_start(GTK_BOX(vbox), tos_hbox, TRUE, TRUE, 0); |
253 #endif | 272 #endif |
254 | 273 |
255 gtk_box_pack_start(GTK_BOX(content_area), vbox, TRUE, TRUE, 0); | 274 GtkWidget* alignment = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); |
| 275 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), |
| 276 gtk_util::kContentAreaBorder, 0, |
| 277 gtk_util::kContentAreaBorder, gtk_util::kContentAreaBorder); |
| 278 gtk_container_add(GTK_CONTAINER(alignment), vbox); |
| 279 gtk_box_pack_start(GTK_BOX(content_area), alignment, FALSE, FALSE, 0); |
256 | 280 |
257 g_signal_connect(dialog, "response", G_CALLBACK(OnDialogResponse), NULL); | 281 g_signal_connect(dialog, "response", G_CALLBACK(OnDialogResponse), NULL); |
258 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); | 282 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); |
259 gtk_widget_show_all(dialog); | 283 gtk_widget_show_all(dialog); |
| 284 gtk_widget_grab_focus(close_button); |
260 } | 285 } |
OLD | NEW |