diff options
-rw-r--r-- | chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.cc | 10 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.h | 3 |
2 files changed, 12 insertions, 1 deletions
diff --git a/chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.cc b/chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.cc index 51fc25b..2314a8c 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(TabContentsWrapper* owner) { // 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 ? diff --git a/chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.h b/chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.h index dce45da..8fc0ac7 100644 --- a/chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.h +++ b/chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.h @@ -11,6 +11,7 @@ #include "chrome/browser/ui/gtk/infobars/infobar_gtk.h" #include "ui/base/gtk/gtk_signal.h" +typedef struct _GtkSizeGroup GtkSizeGroup; typedef struct _GtkWidget GtkWidget; // An infobar that shows a message, up to two optional buttons, and an optional, @@ -33,6 +34,8 @@ class ConfirmInfoBarGtk : public InfoBar { GtkWidget* confirm_hbox_; + GtkSizeGroup* size_group_; + DISALLOW_COPY_AND_ASSIGN(ConfirmInfoBarGtk); }; |