app chooser dialog: Prevent uneven button heights

The height of the text buttons depends on the font height,
whereas the search button has a fixed-size icon in it...
Prevent unevent heights by putting them all in a size group.
This commit is contained in:
Matthias Clasen 2015-02-26 20:55:54 -05:00
parent c951740cf9
commit 6855e1eec3
2 changed files with 12 additions and 0 deletions

View File

@ -57,6 +57,7 @@
#include "gtkheaderbar.h"
#include "gtkdialogprivate.h"
#include "gtksearchbar.h"
#include "gtksizegroup.h"
#include <string.h>
#include <glib/gi18n-lib.h>
@ -80,6 +81,8 @@ struct _GtkAppChooserDialogPrivate {
GtkWidget *show_more_button;
GtkWidget *software_button;
GtkSizeGroup *buttons;
gboolean show_more_clicked;
gboolean dismissed;
};
@ -494,6 +497,7 @@ setup_search (GtkAppChooserDialog *self)
header = gtk_dialog_get_header_bar (GTK_DIALOG (self));
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
gtk_size_group_add_widget (self->priv->buttons, button);
g_object_bind_property (button, "active",
self->priv->search_bar, "search-mode-enabled",
@ -696,6 +700,7 @@ gtk_app_chooser_dialog_class_init (GtkAppChooserDialogClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GtkAppChooserDialog, inner_box);
gtk_widget_class_bind_template_child_private (widget_class, GtkAppChooserDialog, search_bar);
gtk_widget_class_bind_template_child_private (widget_class, GtkAppChooserDialog, search_entry);
gtk_widget_class_bind_template_child_private (widget_class, GtkAppChooserDialog, buttons);
gtk_widget_class_bind_template_callback (widget_class, show_more_button_clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, software_button_clicked_cb);
}

View File

@ -108,4 +108,11 @@
<property name="receives_default">True</property>
<signal name="clicked" handler="software_button_clicked_cb" swapped="no"/>
</object>
<object class="GtkSizeGroup" id="buttons">
<property name="mode">vertical</property>
<widgets>
<widget name="cancel_button"/>
<widget name="ok_button"/>
</widgets>
</object>
</interface>