diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-08 20:57:33 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-08 20:57:33 +0000 |
commit | 22aa17f53d3cac55da469a5dd75a6b48086d0f9f (patch) | |
tree | f9ab620e1e8ecf1119302fb0409b04750cc01ad6 /chrome | |
parent | 75fcc27b00efe3c6b20e5becf349235c9ef11af9 (diff) | |
download | chromium_src-22aa17f53d3cac55da469a5dd75a6b48086d0f9f.zip chromium_src-22aa17f53d3cac55da469a5dd75a6b48086d0f9f.tar.gz chromium_src-22aa17f53d3cac55da469a5dd75a6b48086d0f9f.tar.bz2 |
Fix some spacing issues with gtk infobars.
1. Account for variable size icon resources (which should themselves be fixed as well)
2. remove excess padding from start of confirm infobars.
BUG=none
TEST=visual
Review URL: http://codereview.chromium.org/6626066
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77328 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.cc | 8 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/infobars/infobar_gtk.cc | 10 |
2 files changed, 14 insertions, 4 deletions
diff --git a/chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.cc b/chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.cc index 29ae948..76fe742 100644 --- a/chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.cc +++ b/chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.cc @@ -21,7 +21,8 @@ InfoBar* ConfirmInfoBarDelegate::CreateInfoBar() { ConfirmInfoBarGtk::ConfirmInfoBarGtk(ConfirmInfoBarDelegate* delegate) : InfoBar(delegate) { - confirm_hbox_ = gtk_chrome_shrinkable_hbox_new(FALSE, FALSE, 0); + confirm_hbox_ = gtk_chrome_shrinkable_hbox_new(FALSE, FALSE, + kEndOfLabelSpacing); // This alignment allocates the confirm hbox only as much space as it // requests, and less if there is not enough available. GtkWidget* align = gtk_alignment_new(0, 0, 0, 1); @@ -37,7 +38,7 @@ ConfirmInfoBarGtk::ConfirmInfoBarGtk(ConfirmInfoBarDelegate* delegate) GtkWidget* label = gtk_label_new(label_text.c_str()); gtk_util::ForceFontSizePixels(label, 13.4); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); - gtk_util::CenterWidgetInHBox(confirm_hbox_, label, true, kEndOfLabelSpacing); + gtk_util::CenterWidgetInHBox(confirm_hbox_, label, true, 0); gtk_widget_modify_fg(label, GTK_STATE_NORMAL, >k_util::kGdkBlack); g_signal_connect(label, "map", G_CALLBACK(gtk_util::InitLabelSizeRequestAndEllipsizeMode), @@ -64,8 +65,7 @@ void ConfirmInfoBarGtk::AddButton(ConfirmInfoBarDelegate::InfoBarButton type) { if (delegate_->AsConfirmInfoBarDelegate()->GetButtons() & type) { GtkWidget* button = gtk_button_new_with_label(UTF16ToUTF8( delegate_->AsConfirmInfoBarDelegate()->GetButtonLabel(type)).c_str()); - gtk_util::CenterWidgetInHBox(confirm_hbox_, button, true, - kButtonButtonSpacing); + gtk_util::CenterWidgetInHBox(confirm_hbox_, button, true, 0); g_signal_connect(button, "clicked", G_CALLBACK(type == ConfirmInfoBarDelegate::BUTTON_OK ? OnOkButtonThunk : OnCancelButtonThunk), diff --git a/chrome/browser/ui/gtk/infobars/infobar_gtk.cc b/chrome/browser/ui/gtk/infobars/infobar_gtk.cc index b958a6a..df072b5 100644 --- a/chrome/browser/ui/gtk/infobars/infobar_gtk.cc +++ b/chrome/browser/ui/gtk/infobars/infobar_gtk.cc @@ -28,6 +28,9 @@ const int kElementPadding = 5; const int kLeftPadding = 5; const int kRightPadding = 5; +// The horizontal space allotted for the icon. +const int kIconSizePixels = 26; + } // namespace // static @@ -63,6 +66,13 @@ InfoBar::InfoBar(InfoBarDelegate* delegate) GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(icon); GtkWidget* image = gtk_image_new_from_pixbuf(pixbuf); g_object_unref(pixbuf); + + // All icons should be 26x26, but some are larger with transparent padding + // pixels around the edges. (And some are smaller). Thus we hardcode the + // width and center the image. + gtk_widget_set_size_request(image, kIconSizePixels, 0); + gtk_misc_set_alignment(GTK_MISC(image), 0.5, 0.5); + gtk_box_pack_start(GTK_BOX(hbox_), image, FALSE, FALSE, 0); } |