| 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/bookmark_utils_gtk.h" | 5 #include "chrome/browser/gtk/bookmark_utils_gtk.h" |
| 6 | 6 |
| 7 #include "app/gtk_dnd_util.h" | 7 #include "app/gtk_dnd_util.h" |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
| 10 #include "base/pickle.h" | 10 #include "base/pickle.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 provider->UseGtkTheme()); | 117 provider->UseGtkTheme()); |
| 118 GtkWidget* image = gtk_image_new_from_pixbuf(pixbuf); | 118 GtkWidget* image = gtk_image_new_from_pixbuf(pixbuf); |
| 119 g_object_unref(pixbuf); | 119 g_object_unref(pixbuf); |
| 120 | 120 |
| 121 GtkWidget* box = gtk_hbox_new(FALSE, kBarButtonPadding); | 121 GtkWidget* box = gtk_hbox_new(FALSE, kBarButtonPadding); |
| 122 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); | 122 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
| 123 | 123 |
| 124 std::string label_string = WideToUTF8(node->GetTitle()); | 124 std::string label_string = WideToUTF8(node->GetTitle()); |
| 125 if (!label_string.empty()) { | 125 if (!label_string.empty()) { |
| 126 GtkWidget* label = gtk_label_new(label_string.c_str()); | 126 GtkWidget* label = gtk_label_new(label_string.c_str()); |
| 127 // Until we switch to vector graphics, force the font size. |
| 128 gtk_util::ForceFontSizePixels(label, 13.4); // 13.4px == 10pt @ 96dpi |
| 127 | 129 |
| 128 // Ellipsize long bookmark names. | 130 // Ellipsize long bookmark names. |
| 129 if (node != model->other_node()) { | 131 if (node != model->other_node()) { |
| 130 gtk_label_set_max_width_chars(GTK_LABEL(label), kMaxCharsOnAButton); | 132 gtk_label_set_max_width_chars(GTK_LABEL(label), kMaxCharsOnAButton); |
| 131 gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END); | 133 gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END); |
| 132 } | 134 } |
| 133 | 135 |
| 134 gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0); | 136 gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0); |
| 135 SetButtonTextColors(label, provider); | 137 SetButtonTextColors(label, provider); |
| 136 } | 138 } |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 std::vector<GURL> urls; | 328 std::vector<GURL> urls; |
| 327 gtk_dnd_util::ExtractURIList(selection_data, &urls); | 329 gtk_dnd_util::ExtractURIList(selection_data, &urls); |
| 328 for (size_t i = 0; i < urls.size(); ++i) { | 330 for (size_t i = 0; i < urls.size(); ++i) { |
| 329 std::string title = GetNameForURL(urls[i]); | 331 std::string title = GetNameForURL(urls[i]); |
| 330 model->AddURL(parent, idx++, UTF8ToWide(title), urls[i]); | 332 model->AddURL(parent, idx++, UTF8ToWide(title), urls[i]); |
| 331 } | 333 } |
| 332 return true; | 334 return true; |
| 333 } | 335 } |
| 334 | 336 |
| 335 } // namespace bookmark_utils | 337 } // namespace bookmark_utils |
| OLD | NEW |