| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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/options/options_layout_gtk.h" | 5 #include "chrome/browser/gtk/options/options_layout_gtk.h" |
| 6 | 6 |
| 7 #include "chrome/common/gtk_util.h" | 7 #include "chrome/common/gtk_util.h" |
| 8 | 8 |
| 9 namespace { | 9 namespace { |
| 10 | 10 |
| 11 // Style for option group titles | 11 // Style for option group titles |
| 12 const char kOptionGroupTitleMarkup[] = "<span weight='bold'>%s</span>"; | 12 const char kOptionGroupTitleMarkup[] = "<span weight='bold'>%s</span>"; |
| 13 | 13 |
| 14 } | 14 } // namespace |
| 15 | 15 |
| 16 OptionsLayoutBuilderGtk::OptionsLayoutBuilderGtk() { | 16 OptionsLayoutBuilderGtk::OptionsLayoutBuilderGtk() { |
| 17 page_ = gtk_vbox_new(FALSE, gtk_util::kContentAreaSpacing); | 17 page_ = gtk_vbox_new(FALSE, gtk_util::kContentAreaSpacing); |
| 18 gtk_container_set_border_width(GTK_CONTAINER(page_), | 18 gtk_container_set_border_width(GTK_CONTAINER(page_), |
| 19 gtk_util::kContentAreaBorder); | 19 gtk_util::kContentAreaBorder); |
| 20 } | 20 } |
| 21 | 21 |
| 22 void OptionsLayoutBuilderGtk::AddOptionGroup(const std::string& title, | 22 void OptionsLayoutBuilderGtk::AddOptionGroup(const std::string& title, |
| 23 GtkWidget* content, | 23 GtkWidget* content, |
| 24 bool expandable) { | 24 bool expandable) { |
| 25 GtkWidget* title_label = gtk_label_new(NULL); | 25 GtkWidget* title_label = gtk_label_new(NULL); |
| 26 char* markup = g_markup_printf_escaped(kOptionGroupTitleMarkup, | 26 char* markup = g_markup_printf_escaped(kOptionGroupTitleMarkup, |
| 27 title.c_str()); | 27 title.c_str()); |
| 28 gtk_label_set_markup(GTK_LABEL(title_label), markup); | 28 gtk_label_set_markup(GTK_LABEL(title_label), markup); |
| 29 g_free(markup); | 29 g_free(markup); |
| 30 | 30 |
| 31 GtkWidget* title_alignment = gtk_alignment_new(0.0, 0.5, 0.0, 0.0); | 31 GtkWidget* title_alignment = gtk_alignment_new(0.0, 0.5, 0.0, 0.0); |
| 32 gtk_container_add(GTK_CONTAINER(title_alignment), title_label); | 32 gtk_container_add(GTK_CONTAINER(title_alignment), title_label); |
| 33 | 33 |
| 34 GtkWidget* group = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); | 34 GtkWidget* group = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); |
| 35 gtk_box_pack_start(GTK_BOX(group), title_alignment, FALSE, FALSE, 0); | 35 gtk_box_pack_start(GTK_BOX(group), title_alignment, FALSE, FALSE, 0); |
| 36 gtk_container_add(GTK_CONTAINER(group), gtk_util::IndentWidget(content)); | 36 gtk_container_add(GTK_CONTAINER(group), gtk_util::IndentWidget(content)); |
| 37 | 37 |
| 38 gtk_box_pack_start(GTK_BOX(page_), group, expandable, expandable, 0); | 38 gtk_box_pack_start(GTK_BOX(page_), group, expandable, expandable, 0); |
| 39 } | 39 } |
| OLD | NEW |