[gtk/wip/ebassi/custom-layouts: 112/115] Port GtkSearchBar to GtkBinLayout



commit 1a8c8b7878d68b6f29fa61289bd54558f3074fce
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Apr 8 17:36:34 2019 +0100

    Port GtkSearchBar to GtkBinLayout

 gtk/gtksearchbar.c | 37 +++----------------------------------
 1 file changed, 3 insertions(+), 34 deletions(-)
---
diff --git a/gtk/gtksearchbar.c b/gtk/gtksearchbar.c
index 016b78cde9..3a8b0bd804 100644
--- a/gtk/gtksearchbar.c
+++ b/gtk/gtksearchbar.c
@@ -29,6 +29,7 @@
 
 #include "gtksearchbar.h"
 
+#include "gtkbinlayout.h"
 #include "gtkbutton.h"
 #include "gtkcenterbox.h"
 #include "gtkentryprivate.h"
@@ -249,37 +250,6 @@ gtk_search_bar_dispose (GObject *object)
   G_OBJECT_CLASS (gtk_search_bar_parent_class)->dispose (object);
 }
 
-static void
-gtk_search_bar_measure (GtkWidget      *widget,
-                        GtkOrientation  orientation,
-                        int             for_size,
-                        int            *minimum,
-                        int            *natural,
-                        int            *minimum_baseline,
-                        int            *natural_baseline)
-{
-  GtkSearchBar *bar = GTK_SEARCH_BAR (widget);
-  GtkSearchBarPrivate *priv = gtk_search_bar_get_instance_private (bar);
-
-  gtk_widget_measure (priv->revealer, orientation, for_size, minimum, natural, minimum_baseline, 
natural_baseline);
-}
-
-static void
-gtk_search_bar_size_allocate (GtkWidget *widget,
-                              int        width,
-                              int        height,
-                              int        baseline)
-{
-  GtkSearchBar *bar = GTK_SEARCH_BAR (widget);
-  GtkSearchBarPrivate *priv = gtk_search_bar_get_instance_private (bar);
-
-  gtk_widget_size_allocate (priv->revealer,
-                            &(GtkAllocation) {
-                              0, 0,
-                              width, height
-                            }, baseline);
-}
-
 static void
 gtk_search_bar_class_init (GtkSearchBarClass *klass)
 {
@@ -291,9 +261,6 @@ gtk_search_bar_class_init (GtkSearchBarClass *klass)
   object_class->set_property = gtk_search_bar_set_property;
   object_class->get_property = gtk_search_bar_get_property;
 
-  widget_class->measure = gtk_search_bar_measure;
-  widget_class->size_allocate = gtk_search_bar_size_allocate;
-
   container_class->add = gtk_search_bar_add;
   container_class->remove = gtk_search_bar_remove;
 
@@ -331,6 +298,8 @@ gtk_search_bar_init (GtkSearchBar *bar)
 {
   GtkSearchBarPrivate *priv = gtk_search_bar_get_instance_private (bar);
 
+  gtk_widget_set_layout_manager (GTK_WIDGET (bar), gtk_bin_layout_new ());
+
   priv->revealer = gtk_revealer_new ();
   gtk_revealer_set_reveal_child (GTK_REVEALER (priv->revealer), FALSE);
   gtk_widget_set_hexpand (priv->revealer, TRUE);


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