summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2015-02-26 21:15:19 -0500
committerMatthias Clasen <mclasen@redhat.com>2015-02-26 21:15:19 -0500
commitdfc4c4271ff3c92dc7473beca540a8bb7c03697d (patch)
tree6ed7bf8387de536b21c820b4e2e08652e19ae096
parent61c77fcd809e4cb287639902d72c3c943570decc (diff)
downloadgtk+-wip/garnacho/window-dragging.tar.gz
file chooser dialog: Prevent uneven button heightswip/garnacho/window-dragging
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. https://bugzilla.gnome.org/show_bug.cgi?id=745263
-rw-r--r--gtk/gtkfilechooserdialog.c14
-rw-r--r--gtk/ui/gtkfilechooserdialog.ui3
2 files changed, 17 insertions, 0 deletions
diff --git a/gtk/gtkfilechooserdialog.c b/gtk/gtkfilechooserdialog.c
index 169e6a1bd4..29fbb48d5f 100644
--- a/gtk/gtkfilechooserdialog.c
+++ b/gtk/gtkfilechooserdialog.c
@@ -201,6 +201,8 @@ struct _GtkFileChooserDialogPrivate
{
GtkWidget *widget;
+ GtkSizeGroup *buttons;
+
/* for use with GtkFileChooserEmbed */
gboolean response_requested;
gboolean search_setup;
@@ -256,6 +258,7 @@ gtk_file_chooser_dialog_class_init (GtkFileChooserDialogClass *class)
"/org/gtk/libgtk/ui/gtkfilechooserdialog.ui");
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserDialog, widget);
+ gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserDialog, buttons);
gtk_widget_class_bind_template_callback (widget_class, response_cb);
gtk_widget_class_bind_template_callback (widget_class, file_chooser_widget_file_activated);
gtk_widget_class_bind_template_callback (widget_class, file_chooser_widget_default_size_changed);
@@ -474,6 +477,15 @@ gtk_file_chooser_dialog_get_property (GObject *object,
}
static void
+add_button (GtkWidget *button, gpointer data)
+{
+ GtkFileChooserDialog *dialog = data;
+
+ if (GTK_IS_BUTTON (button))
+ gtk_size_group_add_widget (dialog->priv->buttons, button);
+}
+
+static void
setup_search (GtkFileChooserDialog *dialog)
{
gboolean use_header;
@@ -505,6 +517,8 @@ setup_search (GtkFileChooserDialog *dialog)
g_object_bind_property (button, "active",
dialog->priv->widget, "search-mode",
G_BINDING_BIDIRECTIONAL);
+
+ gtk_container_forall (GTK_CONTAINER (header), add_button, dialog);
}
}
diff --git a/gtk/ui/gtkfilechooserdialog.ui b/gtk/ui/gtkfilechooserdialog.ui
index fa0a3683ad..281bd6f66f 100644
--- a/gtk/ui/gtkfilechooserdialog.ui
+++ b/gtk/ui/gtkfilechooserdialog.ui
@@ -53,4 +53,7 @@
</object>
</child>
</template>
+ <object class="GtkSizeGroup" id="buttons">
+ <property name="mode">vertical</property>
+ </object>
</interface>