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

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

Issue 507022: Fix issue 11258: Linux: gracefully handle small browser window... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years 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 | « chrome/browser/gtk/gtk_expanded_container_unittest.cc ('k') | chrome/browser/gtk/slide_animator_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/infobar_gtk.cc
===================================================================
--- chrome/browser/gtk/infobar_gtk.cc (revision 34953)
+++ chrome/browser/gtk/infobar_gtk.cc (working copy)
@@ -188,8 +188,13 @@
: InfoBar(delegate) {
std::wstring text = delegate->GetMessageText();
GtkWidget* label = gtk_label_new(WideToUTF8(text).c_str());
+ // We want the label to be horizontally shrinkable, so that the Chrome
+ // window can be resized freely even with a very long message.
+ gtk_widget_set_size_request(label, 0, -1);
+ gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END);
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &gfx::kGdkBlack);
- gtk_box_pack_start(GTK_BOX(hbox_), label, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(hbox_), label, TRUE, TRUE, 0);
gtk_widget_show_all(border_bin_.get());
}
@@ -215,13 +220,23 @@
G_CALLBACK(OnLinkClick), this);
gtk_util::SetButtonTriggersNavigation(link_button);
+ GtkWidget* hbox = gtk_hbox_new(FALSE, 0);
+ // We want the link to be horizontally shrinkable, so that the Chrome
+ // window can be resized freely even with a very long link.
+ gtk_widget_set_size_request(hbox, 0, -1);
+ gtk_box_pack_start(GTK_BOX(hbox_), hbox, TRUE, TRUE, 0);
// If link_offset is npos, we right-align the link instead of embedding it
// in the text.
if (link_offset == std::wstring::npos) {
- gtk_box_pack_end(GTK_BOX(hbox_), link_button, FALSE, FALSE, 0);
+ gtk_box_pack_end(GTK_BOX(hbox), link_button, FALSE, FALSE, 0);
GtkWidget* label = gtk_label_new(WideToUTF8(display_text).c_str());
+ // In order to avoid the link_button and the label overlapping with each
+ // other, we make the label shrinkable.
+ gtk_widget_set_size_request(label, 0, -1);
+ gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END);
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &gfx::kGdkBlack);
- gtk_box_pack_start(GTK_BOX(hbox_), label, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0);
} else {
GtkWidget* initial_label = gtk_label_new(
WideToUTF8(display_text.substr(0, link_offset)).c_str());
@@ -233,11 +248,9 @@
// We don't want any spacing between the elements, so we pack them into
// this hbox that doesn't use kElementPadding.
- GtkWidget* hbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox), initial_label, FALSE, FALSE, 0);
gtk_util::CenterWidgetInHBox(hbox, link_button, false, 0);
gtk_box_pack_start(GTK_BOX(hbox), trailing_label, FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(hbox_), hbox, FALSE, FALSE, 0);
}
gtk_widget_show_all(border_bin_.get());
« no previous file with comments | « chrome/browser/gtk/gtk_expanded_container_unittest.cc ('k') | chrome/browser/gtk/slide_animator_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698