[gtk+/wip/garnacho/window-dragging] app chooser dialog: Prevent uneven button heights



commit 61c77fcd809e4cb287639902d72c3c943570decc
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Feb 26 20:55:54 2015 -0500

    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.

 gtk/gtkappchooserdialog.c     |    5 +++++
 gtk/ui/gtkappchooserdialog.ui |    7 +++++++
 2 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkappchooserdialog.c b/gtk/gtkappchooserdialog.c
index 204b415..c582063 100644
--- a/gtk/gtkappchooserdialog.c
+++ b/gtk/gtkappchooserdialog.c
@@ -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);
 }
diff --git a/gtk/ui/gtkappchooserdialog.ui b/gtk/ui/gtkappchooserdialog.ui
index bc7df6a..be7dfe4 100644
--- a/gtk/ui/gtkappchooserdialog.ui
+++ b/gtk/ui/gtkappchooserdialog.ui
@@ -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>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]