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

Unified Diff: chrome/browser/gtk/bookmark_bar_gtk.cc

Issue 132049: Don't treat underscores as mnemonics in the bookmark bar.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: stupid gtk bug Created 11 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/bookmark_bar_gtk.cc
===================================================================
--- chrome/browser/gtk/bookmark_bar_gtk.cc (revision 18764)
+++ chrome/browser/gtk/bookmark_bar_gtk.cc (working copy)
@@ -89,6 +89,21 @@
}
}
+std::string DoubleUnderscores(const std::string& text) {
+ std::string ret;
+ ret.reserve(text.length() * 2);
+ for (size_t i = 0; i < text.length(); ++i) {
+ if ('_' == text[i]) {
+ ret.push_back('_');
+ ret.push_back('_');
+ } else {
+ ret.push_back(text[i]);
+ }
+ }
+
+ return ret;
+}
+
} // namespace
BookmarkBarGtk::BookmarkBarGtk(Profile* profile, Browser* browser,
@@ -411,8 +426,12 @@
// TODO(erg): Consider a soft maximum instead of this hard 15.
std::wstring title = node->GetTitle();
- title = title.substr(0, std::min(title.size(), kMaxCharsOnAButton));
- gtk_button_set_label(GTK_BUTTON(button), WideToUTF8(title).c_str());
+ // Don't treat underscores as mnemonics.
+ // O, that we could just use gtk_button_set_use_underline()!
+ // See http://bugzilla.gnome.org/show_bug.cgi?id=586330
+ std::string text = DoubleUnderscores(WideToUTF8(title));
+ text = text.substr(0, std::min(text.size(), kMaxCharsOnAButton));
+ gtk_button_set_label(GTK_BUTTON(button), text.c_str());
GdkPixbuf* pixbuf = bookmark_utils::GetPixbufForNode(node, model_);
gtk_button_set_image(GTK_BUTTON(button), gtk_image_new_from_pixbuf(pixbuf));
« 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