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

Unified Diff: chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.cc

Issue 7066031: GTK: Buttons on Confirm Infobars should have matching sizes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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 | « chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.cc
diff --git a/chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.cc b/chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.cc
index 76fe7423a92968be259547db08993c877fc16009..137f6485c50cc5ce8d7ae48992bc1d60e45fb54b 100644
--- a/chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.cc
+++ b/chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.cc
@@ -20,7 +20,8 @@ InfoBar* ConfirmInfoBarDelegate::CreateInfoBar() {
// ConfirmInfoBarGtk -----------------------------------------------------------
ConfirmInfoBarGtk::ConfirmInfoBarGtk(ConfirmInfoBarDelegate* delegate)
- : InfoBar(delegate) {
+ : InfoBar(delegate),
+ size_group_(NULL) {
confirm_hbox_ = gtk_chrome_shrinkable_hbox_new(FALSE, FALSE,
kEndOfLabelSpacing);
// This alignment allocates the confirm hbox only as much space as it
@@ -59,12 +60,19 @@ ConfirmInfoBarGtk::ConfirmInfoBarGtk(ConfirmInfoBarDelegate* delegate)
}
ConfirmInfoBarGtk::~ConfirmInfoBarGtk() {
+ if (size_group_)
+ g_object_unref(size_group_);
}
void ConfirmInfoBarGtk::AddButton(ConfirmInfoBarDelegate::InfoBarButton type) {
if (delegate_->AsConfirmInfoBarDelegate()->GetButtons() & type) {
+ if (!size_group_)
+ size_group_ = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+
GtkWidget* button = gtk_button_new_with_label(UTF16ToUTF8(
delegate_->AsConfirmInfoBarDelegate()->GetButtonLabel(type)).c_str());
+ gtk_size_group_add_widget(size_group_, button);
+
gtk_util::CenterWidgetInHBox(confirm_hbox_, button, true, 0);
g_signal_connect(button, "clicked",
G_CALLBACK(type == ConfirmInfoBarDelegate::BUTTON_OK ?
« no previous file with comments | « chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698