Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: chrome/browser/gtk/bookmark_utils_gtk.cc

Issue 225014: Don't ellpsize the Other Bookmarks button. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/gfx/gtk_util.h" 10 #include "base/gfx/gtk_util.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 gtk_label_set_max_width_chars(GTK_LABEL(label), kMaxCharsOnAButton); 127
128 gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END); 128 // Ellipsize long bookmark names.
129 if (node != model->other_node()) {
130 gtk_label_set_max_width_chars(GTK_LABEL(label), kMaxCharsOnAButton);
131 gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END);
132 }
133
129 gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0); 134 gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0);
130 SetButtonTextColors(label, provider); 135 SetButtonTextColors(label, provider);
131 } 136 }
132 137
133 GtkWidget* alignment = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); 138 GtkWidget* alignment = gtk_alignment_new(0.0, 0.0, 1.0, 1.0);
134 // If we are not showing the label, don't set any padding, so that the icon 139 // If we are not showing the label, don't set any padding, so that the icon
135 // will just be centered. 140 // will just be centered.
136 if (label_string.c_str()) { 141 if (label_string.c_str()) {
137 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 142 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment),
138 kButtonPaddingTop, kButtonPaddingBottom, 143 kButtonPaddingTop, kButtonPaddingBottom,
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 std::vector<GURL> urls; 297 std::vector<GURL> urls;
293 GtkDndUtil::ExtractURIList(selection_data, &urls); 298 GtkDndUtil::ExtractURIList(selection_data, &urls);
294 for (size_t i = 0; i < urls.size(); ++i) { 299 for (size_t i = 0; i < urls.size(); ++i) {
295 std::string title = GetNameForURL(urls[i]); 300 std::string title = GetNameForURL(urls[i]);
296 model->AddURL(parent, idx++, UTF8ToWide(title), urls[i]); 301 model->AddURL(parent, idx++, UTF8ToWide(title), urls[i]);
297 } 302 }
298 return true; 303 return true;
299 } 304 }
300 305
301 } // namespace bookmark_utils 306 } // namespace bookmark_utils
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698