]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkcombobox.c
Remove GtkObject completely
[~andy/gtk] / gtk / gtkcombobox.c
index 6059e1e4451871c9390a270bbcda40681f5c8557..f8ce6db0ee27b814c5cd6fdfdb1dd274ed6783eb 100644 (file)
@@ -38,7 +38,6 @@
 #include "gtktreeselection.h"
 #include "gtkvseparator.h"
 #include "gtkwindow.h"
-#include "gtksizerequest.h"
 #include "gtkprivate.h"
 
 #include <gdk/gdkkeysyms.h>
@@ -222,7 +221,7 @@ static void     gtk_combo_box_cell_layout_init     (GtkCellLayoutIface *iface);
 static void     gtk_combo_box_cell_editable_init   (GtkCellEditableIface *iface);
 static void     gtk_combo_box_dispose              (GObject          *object);
 static void     gtk_combo_box_finalize             (GObject          *object);
-static void     gtk_combo_box_destroy              (GtkObject        *object);
+static void     gtk_combo_box_destroy              (GtkWidget        *widget);
 
 static void     gtk_combo_box_set_property         (GObject         *object,
                                                     guint            prop_id,
@@ -286,8 +285,8 @@ static void     gtk_combo_box_forall               (GtkContainer     *container,
                                                     gboolean          include_internals,
                                                     GtkCallback       callback,
                                                     gpointer          callback_data);
-static gboolean gtk_combo_box_expose_event         (GtkWidget        *widget,
-                                                    GdkEventExpose   *event);
+static gboolean gtk_combo_box_draw                 (GtkWidget        *widget,
+                                                    cairo_t          *cr);
 static gboolean gtk_combo_box_scroll_event         (GtkWidget        *widget,
                                                     GdkEventScroll   *event);
 static void     gtk_combo_box_set_active_internal  (GtkComboBox      *combo_box,
@@ -467,18 +466,17 @@ static void     gtk_combo_box_buildable_custom_tag_end       (GtkBuildable  *bui
 static void     gtk_combo_box_start_editing                  (GtkCellEditable *cell_editable,
                                                              GdkEvent        *event);
 
-static void     gtk_combo_box_size_request_init              (GtkSizeRequestIface *iface);
-static void     gtk_combo_box_get_width                      (GtkSizeRequest      *widget,
+static void     gtk_combo_box_get_preferred_width            (GtkWidget           *widget,
                                                              gint                *minimum_size,
                                                              gint                *natural_size);
-static void     gtk_combo_box_get_height                     (GtkSizeRequest      *widget,
+static void     gtk_combo_box_get_preferred_height           (GtkWidget           *widget,
                                                              gint                *minimum_size,
                                                              gint                *natural_size);
-static void     gtk_combo_box_get_width_for_height           (GtkSizeRequest        *widget,
+static void     gtk_combo_box_get_preferred_width_for_height (GtkWidget             *widget,
                                                              gint                   avail_size,
                                                              gint                  *minimum_size,
                                                              gint                  *natural_size);
-static void     gtk_combo_box_get_height_for_width           (GtkSizeRequest        *widget,
+static void     gtk_combo_box_get_preferred_height_for_width (GtkWidget             *widget,
                                                              gint                   avail_size,
                                                              gint                  *minimum_size,
                                                              gint                  *natural_size);
@@ -490,9 +488,7 @@ G_DEFINE_TYPE_WITH_CODE (GtkComboBox, gtk_combo_box, GTK_TYPE_BIN,
                         G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_EDITABLE,
                                                gtk_combo_box_cell_editable_init)
                         G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
-                                               gtk_combo_box_buildable_init)
-                        G_IMPLEMENT_INTERFACE (GTK_TYPE_SIZE_REQUEST,
-                                               gtk_combo_box_size_request_init))
+                                               gtk_combo_box_buildable_init))
 
 
 /* common */
@@ -500,7 +496,6 @@ static void
 gtk_combo_box_class_init (GtkComboBoxClass *klass)
 {
   GObjectClass *object_class;
-  GtkObjectClass *gtk_object_class;
   GtkContainerClass *container_class;
   GtkWidgetClass *widget_class;
   GtkBindingSet *binding_set;
@@ -514,15 +509,17 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
 
   widget_class = (GtkWidgetClass *)klass;
   widget_class->size_allocate = gtk_combo_box_size_allocate;
-  widget_class->expose_event = gtk_combo_box_expose_event;
+  widget_class->draw = gtk_combo_box_draw;
   widget_class->scroll_event = gtk_combo_box_scroll_event;
   widget_class->mnemonic_activate = gtk_combo_box_mnemonic_activate;
   widget_class->grab_focus = gtk_combo_box_grab_focus;
   widget_class->style_set = gtk_combo_box_style_set;
   widget_class->state_changed = gtk_combo_box_state_changed;
-
-  gtk_object_class = (GtkObjectClass *)klass;
-  gtk_object_class->destroy = gtk_combo_box_destroy;
+  widget_class->get_preferred_width = gtk_combo_box_get_preferred_width;
+  widget_class->get_preferred_height = gtk_combo_box_get_preferred_height;
+  widget_class->get_preferred_height_for_width = gtk_combo_box_get_preferred_height_for_width;
+  widget_class->get_preferred_width_for_height = gtk_combo_box_get_preferred_width_for_height;
+  widget_class->destroy = gtk_combo_box_destroy;
 
   object_class = (GObjectClass *)klass;
   object_class->dispose = gtk_combo_box_dispose;
@@ -1286,7 +1283,7 @@ gtk_combo_box_remove (GtkContainer *container,
   gtk_widget_unparent (widget);
   _gtk_bin_set_child (GTK_BIN (container), NULL);
 
-  if (GTK_OBJECT_FLAGS (combo_box) & GTK_IN_DESTRUCTION)
+  if (gtk_widget_in_destruction (combo_box))
     return;
 
   gtk_widget_queue_resize (GTK_WIDGET (container));
@@ -1529,7 +1526,8 @@ gtk_combo_box_menu_position_below (GtkMenu  *menu,
   if (GTK_SHADOW_NONE != combo_box->priv->shadow_type)
     sx -= gtk_widget_get_style (GTK_WIDGET (combo_box))->xthickness;
 
-  gtk_widget_size_request (GTK_WIDGET (menu), &req);
+  gtk_widget_get_preferred_size (GTK_WIDGET (menu),
+                                 &req, NULL);
 
   if (gtk_widget_get_direction (GTK_WIDGET (combo_box)) == GTK_TEXT_DIR_LTR)
     *x = sx;
@@ -1588,7 +1586,7 @@ gtk_combo_box_menu_position_over (GtkMenu  *menu,
   menu_xpos = allocation.x;
   menu_ypos = allocation.y + allocation.height / 2 - 2;
 
-  gtk_size_request_get_width (GTK_SIZE_REQUEST (menu), &menu_width, NULL);
+  gtk_widget_get_preferred_width (GTK_WIDGET (menu), &menu_width, NULL);
 
   if (active != NULL)
     {
@@ -1705,14 +1703,16 @@ gtk_combo_box_list_position (GtkComboBox *combo_box,
   hpolicy = vpolicy = GTK_POLICY_NEVER;
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window),
                                  hpolicy, vpolicy);
-  gtk_widget_size_request (priv->scrolled_window, &popup_req);
+  gtk_widget_get_preferred_size (priv->scrolled_window,
+                                 &popup_req, NULL);
 
   if (popup_req.width > *width)
     {
       hpolicy = GTK_POLICY_ALWAYS;
       gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window),
                                      hpolicy, vpolicy);
-      gtk_widget_size_request (priv->scrolled_window, &popup_req);
+      gtk_widget_get_preferred_size (priv->scrolled_window,
+                                     &popup_req, NULL);
     }
 
   *height = popup_req.height;
@@ -1888,7 +1888,7 @@ gtk_combo_box_menu_popup (GtkComboBox *combo_box,
       gtk_widget_get_allocation (GTK_WIDGET (combo_box), &allocation);
       width = allocation.width;
       gtk_widget_set_size_request (priv->popup_widget, -1, -1);
-      gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->popup_widget), &min_width, NULL);
+      gtk_widget_get_preferred_width (priv->popup_widget, &min_width, NULL);
       
       gtk_widget_set_size_request (priv->popup_widget,
                                   MAX (width, min_width), -1);
@@ -2168,7 +2168,8 @@ gtk_combo_box_update_requested_width (GtkComboBox *combo_box,
 }
 
 #define GTK_COMBO_BOX_SIZE_ALLOCATE_BUTTON                                     \
-  gtk_widget_size_request (combo_box->priv->button, &req);                     \
+  gtk_widget_get_preferred_size (combo_box->priv->button,                      \
+                                 &req, NULL);                                  \
                                                                                \
   if (is_rtl)                                                                  \
     child.x = allocation->x + shadow_width;                                    \
@@ -2254,7 +2255,7 @@ gtk_combo_box_size_allocate (GtkWidget     *widget,
 
 
           /* handle the children */
-          gtk_widget_size_request (priv->arrow, &req);
+          gtk_widget_get_preferred_size (priv->arrow, &req, NULL);
           child.width = req.width;
           if (!is_rtl)
             child.x += width - req.width;
@@ -2263,7 +2264,7 @@ gtk_combo_box_size_allocate (GtkWidget     *widget,
           gtk_widget_size_allocate (priv->arrow, &child);
           if (is_rtl)
             child.x += req.width;
-          gtk_widget_size_request (priv->separator, &req);
+          gtk_widget_get_preferred_size (priv->separator, &req, NULL);
           child.width = req.width;
           if (!is_rtl)
             child.x -= req.width;
@@ -2297,7 +2298,7 @@ gtk_combo_box_size_allocate (GtkWidget     *widget,
                   gtk_widget_get_allocation (GTK_WIDGET (combo_box), &combo_box_allocation);
                   width = combo_box_allocation.width;
                   gtk_widget_set_size_request (priv->popup_widget, -1, -1);
-                  gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->popup_widget), &min_width, NULL);
+                  gtk_widget_get_preferred_width (priv->popup_widget, &min_width, NULL);
                   gtk_widget_set_size_request (priv->popup_widget,
                     MAX (width, min_width), -1);
                }
@@ -2480,39 +2481,35 @@ gtk_combo_box_child_hide (GtkWidget *widget,
 }
 
 static gboolean
-gtk_combo_box_expose_event (GtkWidget      *widget,
-                            GdkEventExpose *event)
+gtk_combo_box_draw (GtkWidget *widget,
+                    cairo_t   *cr)
 {
   GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
   GtkComboBoxPrivate *priv = combo_box->priv;
 
-  if (gtk_widget_is_drawable (widget) &&
-      GTK_SHADOW_NONE != priv->shadow_type)
+  if (priv->shadow_type != GTK_SHADOW_NONE)
     {
-      GtkAllocation allocation;
-
-      gtk_widget_get_allocation (widget, &allocation);
-
       gtk_paint_shadow (gtk_widget_get_style (widget),
-                        gtk_widget_get_window (widget),
+                        cr,
                         GTK_STATE_NORMAL, priv->shadow_type,
-                        NULL, widget, "combobox",
-                        allocation.x, allocation.y,
-                        allocation.width, allocation.height);
+                        widget, "combobox",
+                        0, 0,
+                        gtk_widget_get_allocated_width (widget),
+                        gtk_widget_get_allocated_height (widget));
     }
 
-  gtk_container_propagate_expose (GTK_CONTAINER (widget),
-                                 priv->button, event);
+  gtk_container_propagate_draw (GTK_CONTAINER (widget),
+                               priv->button, cr);
 
   if (priv->tree_view && priv->cell_view_frame)
     {
-      gtk_container_propagate_expose (GTK_CONTAINER (widget),
-                                     priv->cell_view_frame, event);
+      gtk_container_propagate_draw (GTK_CONTAINER (widget),
+                                   priv->cell_view_frame, cr);
     }
 
-  gtk_container_propagate_expose (GTK_CONTAINER (widget),
-                                  gtk_bin_get_child (GTK_BIN (widget)),
-                                  event);
+  gtk_container_propagate_draw (GTK_CONTAINER (widget),
+                                gtk_bin_get_child (GTK_BIN (widget)),
+                                cr);
 
   return FALSE;
 }
@@ -2910,7 +2907,7 @@ gtk_cell_view_menu_item_new (GtkComboBox  *combo_box,
   gtk_tree_path_free (path);
 
   gtk_combo_box_sync_cells (combo_box, GTK_CELL_LAYOUT (cell_view));
-  gtk_widget_size_request (cell_view, &req);
+  gtk_widget_get_preferred_size (cell_view, &req, NULL);
   gtk_widget_show (cell_view);
   
   return item;
@@ -3967,12 +3964,12 @@ gtk_combo_box_menu_key_press (GtkWidget   *widget,
 {
   GtkComboBox *combo_box = GTK_COMBO_BOX (data);
 
-  if (!gtk_bindings_activate_event (GTK_OBJECT (widget), event))
+  if (!gtk_bindings_activate_event (G_OBJECT (widget), event))
     {
       /* The menu hasn't managed the
        * event, forward it to the combobox
        */
-      gtk_bindings_activate_event (GTK_OBJECT (combo_box), event);
+      gtk_bindings_activate_event (G_OBJECT (combo_box), event);
     }
 
   return TRUE;
@@ -4006,12 +4003,12 @@ gtk_combo_box_list_key_press (GtkWidget   *widget,
     return TRUE;
   }
 
-  if (!gtk_bindings_activate_event (GTK_OBJECT (widget), event))
+  if (!gtk_bindings_activate_event (G_OBJECT (widget), event))
     {
       /* The list hasn't managed the
        * event, forward it to the combobox
        */
-      gtk_bindings_activate_event (GTK_OBJECT (combo_box), event);
+      gtk_bindings_activate_event (G_OBJECT (combo_box), event);
     }
 
   return TRUE;
@@ -5092,12 +5089,13 @@ out:
 }
 
 /**
- * gtk_combo_box_get_model
+ * gtk_combo_box_get_model:
  * @combo_box: A #GtkComboBox
  *
  * Returns the #GtkTreeModel which is acting as data source for @combo_box.
  *
- * Return value: (transfer none): A #GtkTreeModel which was passed during construction.
+ * Return value: (transfer none): A #GtkTreeModel which was passed
+ *     during construction.
  *
  * Since: 2.4
  */
@@ -5419,9 +5417,9 @@ gtk_combo_box_grab_focus (GtkWidget *widget)
 }
 
 static void
-gtk_combo_box_destroy (GtkObject *object)
+gtk_combo_box_destroy (GtkWidget *widget)
 {
-  GtkComboBox *combo_box = GTK_COMBO_BOX (object);
+  GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
 
   if (combo_box->priv->popup_idle_id > 0)
     {
@@ -5438,7 +5436,7 @@ gtk_combo_box_destroy (GtkObject *object)
   combo_box->priv->row_separator_data = NULL;
   combo_box->priv->row_separator_destroy = NULL;
 
-  GTK_OBJECT_CLASS (gtk_combo_box_parent_class)->destroy (object);
+  GTK_WIDGET_CLASS (gtk_combo_box_parent_class)->destroy (widget);
   combo_box->priv->cell_view = NULL;
 }
 
@@ -5737,7 +5735,8 @@ gtk_combo_box_set_title (GtkComboBox *combo_box,
  * This function is mostly intended for use by accessibility technologies;
  * applications should have little use for it.
  *
- * Returns: the accessible object corresponding to the combo box's popup.
+ * Returns: (transfer none): the accessible object corresponding
+ *     to the combo box's popup.
  *
  * Since: 2.6
  */
@@ -5948,15 +5947,6 @@ gtk_combo_box_buildable_custom_tag_end (GtkBuildable *buildable,
 }
 
 
-static void
-gtk_combo_box_size_request_init (GtkSizeRequestIface *iface)
-{
-  iface->get_width            = gtk_combo_box_get_width;
-  iface->get_height           = gtk_combo_box_get_height;
-  iface->get_height_for_width = gtk_combo_box_get_height_for_width;
-  iface->get_width_for_height = gtk_combo_box_get_width_for_height;
-}
-
 static void
 gtk_combo_box_remeasure (GtkComboBox *combo_box)
 {
@@ -6005,8 +5995,8 @@ gtk_combo_box_measure_height_for_width (GtkComboBox *combo_box,
 
   child = gtk_bin_get_child (GTK_BIN (combo_box));
 
-  gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (child), avail_width,
-                                        &child_min, &child_nat);
+  gtk_widget_get_preferred_height_for_width (child, avail_width,
+                                             &child_min, &child_nat);
 
   if (!priv->model ||
       !gtk_tree_model_get_iter_first (priv->model, &iter))
@@ -6042,9 +6032,9 @@ gtk_combo_box_measure_height_for_width (GtkComboBox *combo_box,
 
 
 static void     
-gtk_combo_box_get_width (GtkSizeRequest      *widget,
-                        gint                *minimum_size,
-                        gint                *natural_size)
+gtk_combo_box_get_preferred_width (GtkWidget *widget,
+                                   gint      *minimum_size,
+                                   gint      *natural_size)
 {
   GtkComboBox           *combo_box = GTK_COMBO_BOX (widget);
   GtkComboBoxPrivate    *priv = combo_box->priv;
@@ -6061,7 +6051,7 @@ gtk_combo_box_get_width (GtkSizeRequest      *widget,
   child = gtk_bin_get_child (GTK_BIN (widget));
  
   /* common */
-  gtk_size_request_get_width (GTK_SIZE_REQUEST (child), &child_min, &child_nat);
+  gtk_widget_get_preferred_width (child, &child_min, &child_nat);
   gtk_combo_box_remeasure (combo_box);
 
   child_min  = MAX (child_min,  priv->minimum_width);
@@ -6097,8 +6087,8 @@ gtk_combo_box_get_width (GtkSizeRequest      *widget,
          border_width = gtk_container_get_border_width (GTK_CONTAINER (combo_box));
           xthickness   = gtk_widget_get_style (priv->button)->xthickness;
 
-          gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->separator), &sep_width, NULL);
-          gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->arrow), &arrow_width, NULL);
+          gtk_widget_get_preferred_width (priv->separator, &sep_width, NULL);
+          gtk_widget_get_preferred_width (priv->arrow, &arrow_width, NULL);
 
          xpad = 2*(border_width + xthickness + focus_width + focus_pad);
 
@@ -6109,8 +6099,8 @@ gtk_combo_box_get_width (GtkSizeRequest      *widget,
         {
           gint but_width, but_nat_width;
 
-          gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->button)
-                                     &but_width, &but_nat_width);
+          gtk_widget_get_preferred_width (priv->button
+                                          &but_width, &but_nat_width);
 
           minimum_width  = child_min + but_width;
           natural_width  = child_nat + but_nat_width;
@@ -6141,8 +6131,8 @@ gtk_combo_box_get_width (GtkSizeRequest      *widget,
         }
 
       /* the button */
-      gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->button)
-                                 &button_width, &button_nat_width);
+      gtk_widget_get_preferred_width (priv->button
+                                      &button_width, &button_nat_width);
 
       minimum_width += button_width;
       natural_width += button_nat_width;
@@ -6164,35 +6154,35 @@ gtk_combo_box_get_width (GtkSizeRequest      *widget,
 }
 
 static void
-gtk_combo_box_get_height (GtkSizeRequest      *widget,
-                         gint                *minimum_size,
-                         gint                *natural_size)
+gtk_combo_box_get_preferred_height (GtkWidget *widget,
+                                    gint      *minimum_size,
+                                    gint      *natural_size)
 { 
   gint min_width;
 
   /* Combo box is height-for-width only 
    * (so we always just reserve enough height for the minimum width) */
-  GTK_SIZE_REQUEST_GET_IFACE (widget)->get_width (widget, &min_width, NULL);
-  GTK_SIZE_REQUEST_GET_IFACE (widget)->get_height_for_width (widget, min_width, minimum_size, natural_size);
+  GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, &min_width, NULL);
+  GTK_WIDGET_GET_CLASS (widget)->get_preferred_height_for_width (widget, min_width, minimum_size, natural_size);
 }
 
 static void
-gtk_combo_box_get_width_for_height (GtkSizeRequest        *widget,
-                                   gint                   avail_size,
-                                   gint                  *minimum_size,
-                                   gint                  *natural_size)
+gtk_combo_box_get_preferred_width_for_height (GtkWidget *widget,
+                                              gint       avail_size,
+                                              gint      *minimum_size,
+                                              gint      *natural_size)
 {
   /* Combo box is height-for-width only 
    * (so we assume we always reserved enough height for the minimum width) */
-  GTK_SIZE_REQUEST_GET_IFACE (widget)->get_width (widget, minimum_size, natural_size);
+  GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, minimum_size, natural_size);
 }
 
 
 static void
-gtk_combo_box_get_height_for_width (GtkSizeRequest        *widget,
-                                   gint                   avail_size,
-                                   gint                  *minimum_size,
-                                   gint                  *natural_size)
+gtk_combo_box_get_preferred_height_for_width (GtkWidget *widget,
+                                              gint       avail_size,
+                                              gint      *minimum_size,
+                                              gint      *natural_size)
 {
   GtkComboBox           *combo_box = GTK_COMBO_BOX (widget);
   GtkComboBoxPrivate    *priv = combo_box->priv;
@@ -6227,12 +6217,12 @@ gtk_combo_box_get_height_for_width (GtkSizeRequest        *widget,
           xthickness = button_style->xthickness;
           ythickness = button_style->ythickness;
 
-          gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->separator), &sep_width, NULL);
-          gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->arrow), &arrow_width, NULL);
-          gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (priv->separator)
-                                                sep_width, &sep_height, NULL);
-          gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (priv->arrow)
-                                                arrow_width, &arrow_height, NULL);
+          gtk_widget_get_preferred_width (priv->separator, &sep_width, NULL);
+          gtk_widget_get_preferred_width (priv->arrow, &arrow_width, NULL);
+          gtk_widget_get_preferred_height_for_width (priv->separator
+                                                     sep_width, &sep_height, NULL);
+          gtk_widget_get_preferred_height_for_width (priv->arrow
+                                                     arrow_width, &arrow_height, NULL);
 
          xpad = 2*(border_width + xthickness + focus_width + focus_pad);
          ypad = 2*(border_width + ythickness + focus_width + focus_pad);
@@ -6253,9 +6243,9 @@ gtk_combo_box_get_height_for_width (GtkSizeRequest        *widget,
          /* there is a custom child widget inside (no priv->cell_view) */
           gint but_width, but_height;
 
-          gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->button), &but_width, NULL);
-          gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (priv->button)
-                                                but_width, &but_height, NULL);
+          gtk_widget_get_preferred_width (priv->button, &but_width, NULL);
+          gtk_widget_get_preferred_height_for_width (priv->button
+                                                     but_width, &but_height, NULL);
 
          size -= but_width;
 
@@ -6271,9 +6261,9 @@ gtk_combo_box_get_height_for_width (GtkSizeRequest        *widget,
       gint but_width, but_height;
       gint xpad = 0, ypad = 0;
 
-      gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->button), &but_width, NULL);
-      gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (priv->button)
-                                            but_width, &but_height, NULL);
+      gtk_widget_get_preferred_width (priv->button, &but_width, NULL);
+      gtk_widget_get_preferred_height_for_width (priv->button
+                                                 but_width, &but_height, NULL);
       
       if (priv->cell_view_frame && priv->has_frame)
        {