]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkcombobox.c
Remove GtkObject completely
[~andy/gtk] / gtk / gtkcombobox.c
index 3dc094f82a2d31f311c397eb122a67f65b088d31..f8ce6db0ee27b814c5cd6fdfdb1dd274ed6783eb 100644 (file)
@@ -17,7 +17,7 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#include <config.h>
+#include "config.h"
 #include "gtkcombobox.h"
 
 #include "gtkarrow.h"
@@ -39,7 +39,6 @@
 #include "gtkvseparator.h"
 #include "gtkwindow.h"
 #include "gtkprivate.h"
-#include "gtkmarshal.h"
 
 #include <gdk/gdkkeysyms.h>
 
@@ -52,7 +51,6 @@
 #include "gtkintl.h"
 
 #include "gtktreeprivate.h"
-#include "gtkalias.h"
 
 /* WELCOME, to THE house of evil code */
 
@@ -70,7 +68,6 @@ struct _ComboCellInfo
   guint pack : 1;
 };
 
-#define GTK_COMBO_BOX_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_COMBO_BOX, GtkComboBoxPrivate))
 
 struct _GtkComboBoxPrivate
 {
@@ -82,6 +79,7 @@ struct _GtkComboBoxPrivate
   gint wrap_width;
   GtkShadowType shadow_type;
 
+  gint active; /* Only temporary */
   GtkTreeRowReference *active_row;
 
   GtkWidget *tree_view;
@@ -109,8 +107,9 @@ struct _GtkComboBoxPrivate
   guint scroll_timer;
   guint resize_idle_id;
 
-  gint width;
-  gint height;
+  gint  minimum_width;
+  gint  natural_width;
+
   GSList *cells;
 
   guint popup_in_progress : 1;
@@ -121,10 +120,14 @@ struct _GtkComboBoxPrivate
   guint editing_canceled : 1;
   guint auto_scroll : 1;
   guint focus_on_click : 1;
+  guint button_sensitivity : 2;
 
   GtkTreeViewRowSeparatorFunc row_separator_func;
   gpointer                    row_separator_data;
-  GtkDestroyNotify            row_separator_destroy;
+  GDestroyNotify              row_separator_destroy;
+
+  GdkDevice *grab_pointer;
+  GdkDevice *grab_keyboard;
 
   gchar *tearoff_title;
 };
@@ -202,7 +205,9 @@ enum {
   PROP_TEAROFF_TITLE,
   PROP_HAS_FRAME,
   PROP_FOCUS_ON_CLICK,
-  PROP_POPUP_SHOWN
+  PROP_POPUP_SHOWN,
+  PROP_BUTTON_SENSITIVITY,
+  PROP_EDITING_CANCELED
 };
 
 static guint combo_box_signals[LAST_SIGNAL] = {0,};
@@ -216,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,
@@ -268,22 +273,20 @@ static void     gtk_combo_box_menu_position        (GtkMenu          *menu,
                                                     gint             *push_in,
                                                     gpointer          user_data);
 
-static gint     gtk_combo_box_calc_requested_width (GtkComboBox      *combo_box,
-                                                    GtkTreePath      *path);
+static void     gtk_combo_box_update_requested_width(GtkComboBox      *combo_box,
+                                                    GtkTreePath      *path);
 static void     gtk_combo_box_remeasure            (GtkComboBox      *combo_box);
 
 static void     gtk_combo_box_unset_model          (GtkComboBox      *combo_box);
 
-static void     gtk_combo_box_size_request         (GtkWidget        *widget,
-                                                    GtkRequisition   *requisition);
 static void     gtk_combo_box_size_allocate        (GtkWidget        *widget,
                                                     GtkAllocation    *allocation);
 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,
@@ -377,6 +380,8 @@ static gboolean gtk_combo_box_menu_button_press    (GtkWidget        *widget,
                                                     gpointer          user_data);
 static void     gtk_combo_box_menu_item_activate   (GtkWidget        *item,
                                                     gpointer          user_data);
+
+static void     gtk_combo_box_update_sensitivity   (GtkComboBox      *combo_box);
 static void     gtk_combo_box_menu_row_inserted    (GtkTreeModel     *model,
                                                     GtkTreePath      *path,
                                                     GtkTreeIter      *iter,
@@ -458,8 +463,23 @@ static void     gtk_combo_box_buildable_custom_tag_end       (GtkBuildable  *bui
                                                              gpointer      *data);
 
 /* GtkCellEditable method implementations */
-static void gtk_combo_box_start_editing (GtkCellEditable *cell_editable,
-                                        GdkEvent        *event);
+static void     gtk_combo_box_start_editing                  (GtkCellEditable *cell_editable,
+                                                             GdkEvent        *event);
+
+static void     gtk_combo_box_get_preferred_width            (GtkWidget           *widget,
+                                                             gint                *minimum_size,
+                                                             gint                *natural_size);
+static void     gtk_combo_box_get_preferred_height           (GtkWidget           *widget,
+                                                             gint                *minimum_size,
+                                                             gint                *natural_size);
+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_preferred_height_for_width (GtkWidget             *widget,
+                                                             gint                   avail_size,
+                                                             gint                  *minimum_size,
+                                                             gint                  *natural_size);
 
 
 G_DEFINE_TYPE_WITH_CODE (GtkComboBox, gtk_combo_box, GTK_TYPE_BIN,
@@ -476,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;
@@ -490,16 +509,17 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
 
   widget_class = (GtkWidgetClass *)klass;
   widget_class->size_allocate = gtk_combo_box_size_allocate;
-  widget_class->size_request = gtk_combo_box_size_request;
-  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;
@@ -541,14 +561,14 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
    * Since: 2.12
    */
   combo_box_signals[MOVE_ACTIVE] =
-    _gtk_binding_signal_new (I_("move-active"),
-                             G_OBJECT_CLASS_TYPE (klass),
-                             G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-                             G_CALLBACK (gtk_combo_box_real_move_active),
-                             NULL, NULL,
-                             g_cclosure_marshal_VOID__ENUM,
-                             G_TYPE_NONE, 1,
-                             GTK_TYPE_SCROLL_TYPE);
+    g_signal_new_class_handler (I_("move-active"),
+                                G_OBJECT_CLASS_TYPE (klass),
+                                G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+                                G_CALLBACK (gtk_combo_box_real_move_active),
+                                NULL, NULL,
+                                g_cclosure_marshal_VOID__ENUM,
+                                G_TYPE_NONE, 1,
+                                GTK_TYPE_SCROLL_TYPE);
 
   /**
    * GtkComboBox::popup:
@@ -563,13 +583,13 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
    * Since: 2.12
    */
   combo_box_signals[POPUP] =
-    _gtk_binding_signal_new (I_("popup"),
-                             G_OBJECT_CLASS_TYPE (klass),
-                             G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-                             G_CALLBACK (gtk_combo_box_real_popup),
-                             NULL, NULL,
-                             g_cclosure_marshal_VOID__VOID,
-                             G_TYPE_NONE, 0);
+    g_signal_new_class_handler (I_("popup"),
+                                G_OBJECT_CLASS_TYPE (klass),
+                                G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+                                G_CALLBACK (gtk_combo_box_real_popup),
+                                NULL, NULL,
+                                g_cclosure_marshal_VOID__VOID,
+                                G_TYPE_NONE, 0);
   /**
    * GtkComboBox::popdown:
    * @button: the object which received the signal
@@ -583,68 +603,72 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
    * Since: 2.12
    */
   combo_box_signals[POPDOWN] =
-    _gtk_binding_signal_new (I_("popdown"),
-                             G_OBJECT_CLASS_TYPE (klass),
-                             G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-                             G_CALLBACK (gtk_combo_box_real_popdown),
-                             NULL, NULL,
-                             gtk_marshal_BOOLEAN__VOID,
-                             G_TYPE_BOOLEAN, 0);
+    g_signal_new_class_handler (I_("popdown"),
+                                G_OBJECT_CLASS_TYPE (klass),
+                                G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+                                G_CALLBACK (gtk_combo_box_real_popdown),
+                                NULL, NULL,
+                                _gtk_marshal_BOOLEAN__VOID,
+                                G_TYPE_BOOLEAN, 0);
 
   /* key bindings */
   binding_set = gtk_binding_set_by_class (widget_class);
 
-  gtk_binding_entry_add_signal (binding_set, GDK_Down, GDK_MOD1_MASK,
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_Down, GDK_MOD1_MASK,
                                "popup", 0);
-  gtk_binding_entry_add_signal (binding_set, GDK_KP_Down, GDK_MOD1_MASK,
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Down, GDK_MOD1_MASK,
                                "popup", 0);
 
-  gtk_binding_entry_add_signal (binding_set, GDK_Up, GDK_MOD1_MASK,
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_Up, GDK_MOD1_MASK,
                                "popdown", 0);
-  gtk_binding_entry_add_signal (binding_set, GDK_KP_Up, GDK_MOD1_MASK,
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Up, GDK_MOD1_MASK,
                                "popdown", 0);
-  gtk_binding_entry_add_signal (binding_set, GDK_Escape, 0,
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0,
                                "popdown", 0);
 
-  gtk_binding_entry_add_signal (binding_set, GDK_Up, 0,
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_Up, 0,
                                "move-active", 1,
                                GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_STEP_UP);
-  gtk_binding_entry_add_signal (binding_set, GDK_KP_Up, 0,
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Up, 0,
                                "move-active", 1,
                                GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_STEP_UP);
-  gtk_binding_entry_add_signal (binding_set, GDK_Page_Up, 0,
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_Page_Up, 0,
                                "move-active", 1,
                                GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_UP);
-  gtk_binding_entry_add_signal (binding_set, GDK_KP_Page_Up, 0,
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Page_Up, 0,
                                "move-active", 1,
                                GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_UP);
-  gtk_binding_entry_add_signal (binding_set, GDK_Home, 0,
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_Home, 0,
                                "move-active", 1,
                                GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_START);
-  gtk_binding_entry_add_signal (binding_set, GDK_KP_Home, 0,
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Home, 0,
                                "move-active", 1,
                                GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_START);
 
-  gtk_binding_entry_add_signal (binding_set, GDK_Down, 0,
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_Down, 0,
                                "move-active", 1,
                                GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_STEP_DOWN);
-  gtk_binding_entry_add_signal (binding_set, GDK_KP_Down, 0,
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Down, 0,
                                "move-active", 1,
                                GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_STEP_DOWN);
-  gtk_binding_entry_add_signal (binding_set, GDK_Page_Down, 0,
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_Page_Down, 0,
                                "move-active", 1,
                                GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_DOWN);
-  gtk_binding_entry_add_signal (binding_set, GDK_KP_Page_Down, 0,
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Page_Down, 0,
                                "move-active", 1,
                                GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_DOWN);
-  gtk_binding_entry_add_signal (binding_set, GDK_End, 0,
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_End, 0,
                                "move-active", 1,
                                GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_END);
-  gtk_binding_entry_add_signal (binding_set, GDK_KP_End, 0,
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_End, 0,
                                "move-active", 1,
                                GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_END);
 
   /* properties */
+  g_object_class_override_property (object_class,
+                                    PROP_EDITING_CANCELED,
+                                    "editing-canceled");
+
   /**
    * GtkComboBox:model:
    *
@@ -823,6 +847,24 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
                                                          FALSE,
                                                          GTK_PARAM_READABLE));
 
+
+   /**
+    * GtkComboBox:button-sensitivity:
+    *
+    * Whether the dropdown button is sensitive when
+    * the model is empty.
+    *
+    * Since: 2.14
+    */
+   g_object_class_install_property (object_class,
+                                    PROP_BUTTON_SENSITIVITY,
+                                    g_param_spec_enum ("button-sensitivity",
+                                                       P_("Button Sensitivity"),
+                                                       P_("Whether the dropdown button is sensitive when the model is empty"),
+                                                       GTK_TYPE_SENSITIVITY_TYPE,
+                                                       GTK_SENSITIVITY_AUTO,
+                                                       GTK_PARAM_READWRITE));
+
   gtk_widget_class_install_style_property (widget_class,
                                            g_param_spec_boolean ("appears-as-list",
                                                                  P_("Appears as list"),
@@ -898,17 +940,24 @@ gtk_combo_box_cell_editable_init (GtkCellEditableIface *iface)
 static void
 gtk_combo_box_init (GtkComboBox *combo_box)
 {
-  GtkComboBoxPrivate *priv = GTK_COMBO_BOX_GET_PRIVATE (combo_box);
+  GtkComboBoxPrivate *priv;
+
+  combo_box->priv = G_TYPE_INSTANCE_GET_PRIVATE (combo_box,
+                                                 GTK_TYPE_COMBO_BOX,
+                                                 GtkComboBoxPrivate);
+  priv = combo_box->priv;
 
   priv->cell_view = gtk_cell_view_new ();
   gtk_widget_set_parent (priv->cell_view, GTK_WIDGET (combo_box));
-  GTK_BIN (combo_box)->child = priv->cell_view;
+  _gtk_bin_set_child (GTK_BIN (combo_box), priv->cell_view);
   gtk_widget_show (priv->cell_view);
 
-  priv->width = 0;
-  priv->height = 0;
+  priv->minimum_width = 0;
+  priv->natural_width = 0;
+
   priv->wrap_width = 0;
 
+  priv->active = -1;
   priv->active_row = NULL;
   priv->col_column = -1;
   priv->row_column = -1;
@@ -920,8 +969,7 @@ gtk_combo_box_init (GtkComboBox *combo_box)
   priv->editing_canceled = FALSE;
   priv->auto_scroll = FALSE;
   priv->focus_on_click = TRUE;
-
-  combo_box->priv = priv;
+  priv->button_sensitivity = GTK_SENSITIVITY_AUTO;
 
   gtk_combo_box_check_appearance (combo_box);
 }
@@ -936,53 +984,62 @@ gtk_combo_box_set_property (GObject      *object,
 
   switch (prop_id)
     {
-      case PROP_MODEL:
-        gtk_combo_box_set_model (combo_box, g_value_get_object (value));
-        break;
+    case PROP_MODEL:
+      gtk_combo_box_set_model (combo_box, g_value_get_object (value));
+      break;
 
-      case PROP_WRAP_WIDTH:
-        gtk_combo_box_set_wrap_width (combo_box, g_value_get_int (value));
-        break;
+    case PROP_WRAP_WIDTH:
+      gtk_combo_box_set_wrap_width (combo_box, g_value_get_int (value));
+      break;
 
-      case PROP_ROW_SPAN_COLUMN:
-        gtk_combo_box_set_row_span_column (combo_box, g_value_get_int (value));
-        break;
+    case PROP_ROW_SPAN_COLUMN:
+      gtk_combo_box_set_row_span_column (combo_box, g_value_get_int (value));
+      break;
 
-      case PROP_COLUMN_SPAN_COLUMN:
-        gtk_combo_box_set_column_span_column (combo_box, g_value_get_int (value));
-        break;
+    case PROP_COLUMN_SPAN_COLUMN:
+      gtk_combo_box_set_column_span_column (combo_box, g_value_get_int (value));
+      break;
 
-      case PROP_ACTIVE:
-        gtk_combo_box_set_active (combo_box, g_value_get_int (value));
-        break;
+    case PROP_ACTIVE:
+      gtk_combo_box_set_active (combo_box, g_value_get_int (value));
+      break;
 
-      case PROP_ADD_TEAROFFS:
-        gtk_combo_box_set_add_tearoffs (combo_box, g_value_get_boolean (value));
-        break;
+    case PROP_ADD_TEAROFFS:
+      gtk_combo_box_set_add_tearoffs (combo_box, g_value_get_boolean (value));
+      break;
 
-      case PROP_HAS_FRAME:
-        combo_box->priv->has_frame = g_value_get_boolean (value);
-        break;
+    case PROP_HAS_FRAME:
+      combo_box->priv->has_frame = g_value_get_boolean (value);
+      break;
 
-      case PROP_FOCUS_ON_CLICK:
-       gtk_combo_box_set_focus_on_click (combo_box, 
-                                         g_value_get_boolean (value));
-        break;
+    case PROP_FOCUS_ON_CLICK:
+      gtk_combo_box_set_focus_on_click (combo_box,
+                                        g_value_get_boolean (value));
+      break;
 
-      case PROP_TEAROFF_TITLE:
-       gtk_combo_box_set_title (combo_box, g_value_get_string (value));
-        break;
+    case PROP_TEAROFF_TITLE:
+      gtk_combo_box_set_title (combo_box, g_value_get_string (value));
+      break;
 
-      case PROP_POPUP_SHOWN:
-        if (g_value_get_boolean (value))
-          gtk_combo_box_popup (combo_box);
-        else
-          gtk_combo_box_popdown (combo_box);
-        break;
+    case PROP_POPUP_SHOWN:
+      if (g_value_get_boolean (value))
+        gtk_combo_box_popup (combo_box);
+      else
+        gtk_combo_box_popdown (combo_box);
+      break;
 
-      default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-        break;
+    case PROP_BUTTON_SENSITIVITY:
+      gtk_combo_box_set_button_sensitivity (combo_box,
+                                            g_value_get_enum (value));
+      break;
+
+    case PROP_EDITING_CANCELED:
+      combo_box->priv->editing_canceled = g_value_get_boolean (value);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
     }
 }
 
@@ -993,6 +1050,7 @@ gtk_combo_box_get_property (GObject    *object,
                             GParamSpec *pspec)
 {
   GtkComboBox *combo_box = GTK_COMBO_BOX (object);
+  GtkComboBoxPrivate *priv = combo_box->priv;
 
   switch (prop_id)
     {
@@ -1036,6 +1094,14 @@ gtk_combo_box_get_property (GObject    *object,
         g_value_set_boolean (value, combo_box->priv->popup_shown);
         break;
 
+      case PROP_BUTTON_SENSITIVITY:
+        g_value_set_enum (value, combo_box->priv->button_sensitivity);
+        break;
+
+      case PROP_EDITING_CANCELED:
+        g_value_set_boolean (value, priv->editing_canceled);
+        break;
+
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
         break;
@@ -1049,11 +1115,11 @@ gtk_combo_box_state_changed (GtkWidget    *widget,
   GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
   GtkComboBoxPrivate *priv = combo_box->priv;
 
-  if (GTK_WIDGET_REALIZED (widget))
+  if (gtk_widget_get_realized (widget))
     {
       if (priv->tree_view && priv->cell_view)
        gtk_cell_view_set_background_color (GTK_CELL_VIEW (priv->cell_view), 
-                                           &widget->style->base[GTK_WIDGET_STATE (widget)]);
+                                           &gtk_widget_get_style (widget)->base[gtk_widget_get_state (widget)]);
     }
 
   gtk_widget_queue_draw (widget);
@@ -1067,16 +1133,16 @@ gtk_combo_box_button_state_changed (GtkWidget    *widget,
   GtkComboBox *combo_box = GTK_COMBO_BOX (data);
   GtkComboBoxPrivate *priv = combo_box->priv;
 
-  if (GTK_WIDGET_REALIZED (widget))
+  if (gtk_widget_get_realized (widget))
     {
       if (!priv->tree_view && priv->cell_view)
        {
-         if ((GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE) !=
-             (GTK_WIDGET_STATE (priv->cell_view) == GTK_STATE_INSENSITIVE))
-           gtk_widget_set_sensitive (priv->cell_view, GTK_WIDGET_SENSITIVE (widget));
+         if ((gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE) !=
+             (gtk_widget_get_state (priv->cell_view) == GTK_STATE_INSENSITIVE))
+           gtk_widget_set_sensitive (priv->cell_view, gtk_widget_get_sensitive (widget));
          
          gtk_widget_set_state (priv->cell_view, 
-                               GTK_WIDGET_STATE (widget));
+                               gtk_widget_get_state (widget));
        }
     }
 
@@ -1131,15 +1197,17 @@ gtk_combo_box_style_set (GtkWidget *widget,
 {
   GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
   GtkComboBoxPrivate *priv = combo_box->priv;
+  GtkWidget *child;
 
   gtk_combo_box_check_appearance (combo_box);
 
   if (priv->tree_view && priv->cell_view)
     gtk_cell_view_set_background_color (GTK_CELL_VIEW (priv->cell_view), 
-                                       &widget->style->base[GTK_WIDGET_STATE (widget)]);
+                                       &gtk_widget_get_style (widget)->base[gtk_widget_get_state (widget)]);
 
-  if (GTK_IS_ENTRY (GTK_BIN (combo_box)->child))
-    g_object_set (GTK_BIN (combo_box)->child, "shadow-type",
+  child = gtk_bin_get_child (GTK_BIN (combo_box));
+  if (GTK_IS_ENTRY (child))
+    g_object_set (child, "shadow-type",
                   GTK_SHADOW_NONE == priv->shadow_type ?
                   GTK_SHADOW_IN : GTK_SHADOW_NONE, NULL);
 }
@@ -1166,15 +1234,16 @@ gtk_combo_box_add (GtkContainer *container,
   GtkComboBox *combo_box = GTK_COMBO_BOX (container);
   GtkComboBoxPrivate *priv = combo_box->priv;
 
-  if (priv->cell_view && priv->cell_view->parent)
+  if (priv->cell_view &&
+      gtk_widget_get_parent (priv->cell_view))
     {
       gtk_widget_unparent (priv->cell_view);
-      GTK_BIN (container)->child = NULL;
+      _gtk_bin_set_child (GTK_BIN (container), NULL);
       gtk_widget_queue_resize (GTK_WIDGET (container));
     }
   
   gtk_widget_set_parent (widget, GTK_WIDGET (container));
-  GTK_BIN (container)->child = widget;
+  _gtk_bin_set_child (GTK_BIN (container), widget);
 
   if (priv->cell_view &&
       widget != priv->cell_view)
@@ -1184,8 +1253,8 @@ gtk_combo_box_add (GtkContainer *container,
 
       if (!priv->tree_view && priv->separator)
         {
-         gtk_container_remove (GTK_CONTAINER (priv->separator->parent),
-                               priv->separator);
+          gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (priv->separator)),
+                                priv->separator);
          priv->separator = NULL;
 
           gtk_widget_queue_resize (GTK_WIDGET (container));
@@ -1212,9 +1281,9 @@ gtk_combo_box_remove (GtkContainer *container,
     priv->cell_view = NULL;
 
   gtk_widget_unparent (widget);
-  GTK_BIN (container)->child = NULL;
+  _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));
@@ -1237,7 +1306,7 @@ gtk_combo_box_remove (GtkContainer *container,
     {
       priv->cell_view = gtk_cell_view_new ();
       gtk_widget_set_parent (priv->cell_view, GTK_WIDGET (container));
-      GTK_BIN (container)->child = priv->cell_view;
+      _gtk_bin_set_child (GTK_BIN (container), priv->cell_view);
       
       gtk_widget_show (priv->cell_view);
       gtk_cell_view_set_model (GTK_CELL_VIEW (priv->cell_view),
@@ -1430,6 +1499,7 @@ gtk_combo_box_menu_position_below (GtkMenu  *menu,
                                   gpointer  user_data)
 {
   GtkComboBox *combo_box = GTK_COMBO_BOX (user_data);
+  GtkAllocation child_allocation;
   gint sx, sy;
   GtkWidget *child;
   GtkRequisition req;
@@ -1438,30 +1508,36 @@ gtk_combo_box_menu_position_below (GtkMenu  *menu,
   GdkRectangle monitor;
   
   /* FIXME: is using the size request here broken? */
-  child = GTK_BIN (combo_box)->child;
-   
-  gdk_window_get_origin (child->window, &sx, &sy);
-   
-  if (GTK_WIDGET_NO_WINDOW (child))
+  child = gtk_bin_get_child (GTK_BIN (combo_box));
+
+  sx = sy = 0;
+
+  gtk_widget_get_allocation (child, &child_allocation);
+
+  if (!gtk_widget_get_has_window (child))
     {
-      sx += child->allocation.x;
-      sy += child->allocation.y;
+      sx += child_allocation.x;
+      sy += child_allocation.y;
     }
 
+  gdk_window_get_root_coords (gtk_widget_get_window (child),
+                              sx, sy, &sx, &sy);
+
   if (GTK_SHADOW_NONE != combo_box->priv->shadow_type)
-    sx -= GTK_WIDGET (combo_box)->style->xthickness;
+    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;
   else
-    *x = sx + child->allocation.width - req.width;
+    *x = sx + child_allocation.width - req.width;
   *y = sy;
 
   screen = gtk_widget_get_screen (GTK_WIDGET (combo_box));
   monitor_num = gdk_screen_get_monitor_at_window (screen, 
-                                                 GTK_WIDGET (combo_box)->window);
+                                                  gtk_widget_get_window (GTK_WIDGET (combo_box)));
   gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
   
   if (*x < monitor.x)
@@ -1469,12 +1545,12 @@ gtk_combo_box_menu_position_below (GtkMenu  *menu,
   else if (*x + req.width > monitor.x + monitor.width)
     *x = monitor.x + monitor.width - req.width;
   
-  if (monitor.y + monitor.height - *y - child->allocation.height >= req.height)
-    *y += child->allocation.height;
+  if (monitor.y + monitor.height - *y - child_allocation.height >= req.height)
+    *y += child_allocation.height;
   else if (*y - monitor.y >= req.height)
     *y -= req.height;
-  else if (monitor.y + monitor.height - *y - child->allocation.height > *y - monitor.y) 
-    *y += child->allocation.height;
+  else if (monitor.y + monitor.height - *y - child_allocation.height > *y - monitor.y)
+    *y += child_allocation.height;
   else
     *y -= req.height;
 
@@ -1488,33 +1564,34 @@ gtk_combo_box_menu_position_over (GtkMenu  *menu,
                                  gboolean *push_in,
                                  gpointer  user_data)
 {
-  GtkComboBox *combo_box;
-  GtkWidget *active;
-  GtkWidget *child;
-  GtkWidget *widget;
-  GtkRequisition requisition;
-  GList *children;
-  gint screen_width;
-  gint menu_xpos;
-  gint menu_ypos;
-  gint menu_width;
+  GtkComboBox    *combo_box;
+  GtkWidget      *active;
+  GtkWidget      *child;
+  GtkWidget      *widget;
+  GtkAllocation   allocation;
+  GtkAllocation   child_allocation;
+  GList          *children;
+  gint            screen_width;
+  gint            menu_xpos;
+  gint            menu_ypos;
+  gint            menu_width;
 
   combo_box = GTK_COMBO_BOX (user_data);
   widget = GTK_WIDGET (combo_box);
 
-  gtk_widget_get_child_requisition (GTK_WIDGET (menu), &requisition);
-  menu_width = requisition.width;
-
   active = gtk_menu_get_active (GTK_MENU (combo_box->priv->popup_widget));
-  gdk_window_get_origin (widget->window, &menu_xpos, &menu_ypos);
 
-  menu_xpos += widget->allocation.x;
-  menu_ypos += widget->allocation.y + widget->allocation.height / 2 - 2;
+  gtk_widget_get_allocation (widget, &allocation);
+
+  menu_xpos = allocation.x;
+  menu_ypos = allocation.y + allocation.height / 2 - 2;
+
+  gtk_widget_get_preferred_width (GTK_WIDGET (menu), &menu_width, NULL);
 
   if (active != NULL)
     {
-      gtk_widget_get_child_requisition (active, &requisition);
-      menu_ypos -= requisition.height / 2;
+      gtk_widget_get_allocation (active, &child_allocation);
+      menu_ypos -= child_allocation.height / 2;
     }
 
   children = GTK_MENU_SHELL (combo_box->priv->popup_widget)->children;
@@ -1525,17 +1602,22 @@ gtk_combo_box_menu_position_over (GtkMenu  *menu,
       if (active == child)
        break;
 
-      if (GTK_WIDGET_VISIBLE (child))
+      if (gtk_widget_get_visible (child))
        {
-         gtk_widget_get_child_requisition (child, &requisition);
-         menu_ypos -= requisition.height;
+         gtk_widget_get_allocation (child, &child_allocation);
+
+         menu_ypos -= child_allocation.height;
        }
 
       children = children->next;
     }
 
   if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
-    menu_xpos = menu_xpos + widget->allocation.width - menu_width;
+    menu_xpos = menu_xpos + allocation.width - menu_width;
+
+  gdk_window_get_root_coords (gtk_widget_get_window (widget),
+                              menu_xpos, menu_ypos,
+                             &menu_xpos, &menu_ypos);
 
   /* Clamp the position on screen */
   screen_width = gdk_screen_get_width (gtk_widget_get_screen (widget));
@@ -1575,6 +1657,10 @@ gtk_combo_box_menu_position (GtkMenu  *menu,
 
       gtk_combo_box_menu_position_over (menu, x, y, push_in, user_data);
     }
+
+  if (!gtk_widget_get_visible (GTK_MENU (priv->popup_widget)->toplevel))
+    gtk_window_set_type_hint (GTK_WINDOW (GTK_MENU (priv->popup_widget)->toplevel),
+                              GDK_WINDOW_TYPE_HINT_COMBO);
 }
 
 static void
@@ -1585,44 +1671,54 @@ gtk_combo_box_list_position (GtkComboBox *combo_box,
                             gint        *height)
 {
   GtkComboBoxPrivate *priv = combo_box->priv;
+  GtkAllocation allocation;
   GdkScreen *screen;
   gint monitor_num;
   GdkRectangle monitor;
   GtkRequisition popup_req;
   GtkPolicyType hpolicy, vpolicy;
-  
+  GdkWindow *window;
+
   /* under windows, the drop down list is as wide as the combo box itself.
      see bug #340204 */
-  GtkWidget *sample = GTK_WIDGET (combo_box);
+  GtkWidget *widget = GTK_WIDGET (combo_box);
+
+  *x = *y = 0;
 
-  gdk_window_get_origin (sample->window, x, y);
+  gtk_widget_get_allocation (widget, &allocation);
 
-  if (GTK_WIDGET_NO_WINDOW (sample))
+  if (!gtk_widget_get_has_window (widget))
     {
-      *x += sample->allocation.x;
-      *y += sample->allocation.y;
+      *x += allocation.x;
+      *y += allocation.y;
     }
-  
-  *width = sample->allocation.width;
+
+  window = gtk_widget_get_window (widget);
+
+  gdk_window_get_root_coords (gtk_widget_get_window (widget),
+                              *x, *y, x, y);
+
+  *width = allocation.width;
 
   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;
 
   screen = gtk_widget_get_screen (GTK_WIDGET (combo_box));
-  monitor_num = gdk_screen_get_monitor_at_window (screen, 
-                                                 GTK_WIDGET (combo_box)->window);
+  monitor_num = gdk_screen_get_monitor_at_window (screen, window);
   gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
 
   if (*x < monitor.x)
@@ -1630,13 +1726,13 @@ gtk_combo_box_list_position (GtkComboBox *combo_box,
   else if (*x + *width > monitor.x + monitor.width)
     *x = monitor.x + monitor.width - *width;
   
-  if (*y + sample->allocation.height + *height <= monitor.y + monitor.height)
-    *y += sample->allocation.height;
+  if (*y + allocation.height + *height <= monitor.y + monitor.height)
+    *y += allocation.height;
   else if (*y - *height >= monitor.y)
     *y -= *height;
-  else if (monitor.y + monitor.height - (*y + sample->allocation.height) > *y - monitor.y)
+  else if (monitor.y + monitor.height - (*y + allocation.height) > *y - monitor.y)
     {
-      *y += sample->allocation.height;
+      *y += allocation.height;
       *height = monitor.y + monitor.height - *y;
     }
   else 
@@ -1660,7 +1756,7 @@ cell_view_is_sensitive (GtkCellView *cell_view)
   GList *cells, *list;
   gboolean sensitive;
   
-  cells = gtk_cell_view_get_cell_renderers (cell_view);
+  cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (cell_view));
 
   sensitive = FALSE;
   for (list = cells; list; list = list->next)
@@ -1688,8 +1784,8 @@ tree_column_row_is_sensitive (GtkComboBox *combo_box,
 
   if (priv->row_separator_func)
     {
-      if ((*priv->row_separator_func) (priv->model, iter,
-                                      priv->row_separator_data))
+      if (priv->row_separator_func (priv->model, iter,
+                                    priv->row_separator_data))
        return FALSE;
     }
 
@@ -1697,7 +1793,7 @@ tree_column_row_is_sensitive (GtkComboBox *combo_box,
                                           priv->model,
                                           iter, FALSE, FALSE);
 
-  cells = gtk_tree_view_column_get_cell_renderers (priv->column);
+  cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (priv->column));
 
   sensitive = FALSE;
   for (list = cells; list; list = list->next)
@@ -1730,7 +1826,7 @@ update_menu_sensitivity (GtkComboBox *combo_box,
   for (child = children; child; child = child->next)
     {
       item = GTK_WIDGET (child->data);
-      cell_view = GTK_BIN (item)->child;
+      cell_view = gtk_bin_get_child (GTK_BIN (item));
 
       if (!GTK_IS_CELL_VIEW (cell_view))
        continue;
@@ -1767,8 +1863,7 @@ gtk_combo_box_menu_popup (GtkComboBox *combo_box,
   GtkComboBoxPrivate *priv = combo_box->priv;
   GtkTreePath *path;
   gint active_item;
-  GtkRequisition requisition;
-  gint width;
+  gint width, min_width;
   
   update_menu_sensitivity (combo_box, priv->popup_widget);
 
@@ -1788,12 +1883,15 @@ gtk_combo_box_menu_popup (GtkComboBox *combo_box,
   
   if (priv->wrap_width == 0)
     {
-      width = GTK_WIDGET (combo_box)->allocation.width;
+      GtkAllocation allocation;
+
+      gtk_widget_get_allocation (GTK_WIDGET (combo_box), &allocation);
+      width = allocation.width;
       gtk_widget_set_size_request (priv->popup_widget, -1, -1);
-      gtk_widget_size_request (priv->popup_widget, &requisition);
+      gtk_widget_get_preferred_width (priv->popup_widget, &min_width, NULL);
       
       gtk_widget_set_size_request (priv->popup_widget,
-                                  MAX (width, requisition.width), -1);
+                                  MAX (width, min_width), -1);
     }
   
   gtk_menu_popup (GTK_MENU (priv->popup_widget),
@@ -1804,27 +1902,31 @@ gtk_combo_box_menu_popup (GtkComboBox *combo_box,
 
 static gboolean
 popup_grab_on_window (GdkWindow *window,
-                     guint32    activate_time,
-                     gboolean   grab_keyboard)
-{
-  if ((gdk_pointer_grab (window, TRUE,
-                        GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
-                        GDK_POINTER_MOTION_MASK,
-                        NULL, NULL, activate_time) == 0))
+                      GdkDevice *keyboard,
+                      GdkDevice *pointer,
+                     guint32    activate_time)
+{
+  if (keyboard &&
+      gdk_device_grab (keyboard, window,
+                       GDK_OWNERSHIP_WINDOW, TRUE,
+                       GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK,
+                       NULL, activate_time) != GDK_GRAB_SUCCESS)
+    return FALSE;
+
+  if (pointer &&
+      gdk_device_grab (pointer, window,
+                       GDK_OWNERSHIP_WINDOW, TRUE,
+                       GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
+                       GDK_POINTER_MOTION_MASK,
+                       NULL, activate_time) != GDK_GRAB_SUCCESS)
     {
-      if (!grab_keyboard ||
-         gdk_keyboard_grab (window, TRUE,
-                            activate_time) == 0)
-       return TRUE;
-      else
-       {
-         gdk_display_pointer_ungrab (gdk_drawable_get_display (window),
-                                     activate_time);
-         return FALSE;
-       }
+      if (keyboard)
+        gdk_device_ungrab (keyboard, activate_time);
+
+      return FALSE;
     }
 
-  return FALSE;
+  return TRUE;
 }
 
 /**
@@ -1846,20 +1948,53 @@ gtk_combo_box_popup (GtkComboBox *combo_box)
   g_signal_emit (combo_box, combo_box_signals[POPUP], 0);
 }
 
-static void
-gtk_combo_box_real_popup (GtkComboBox *combo_box)
+/**
+ * gtk_combo_box_popup_for_device:
+ * @combo_box: a #GtkComboBox
+ * @device: a #GdkDevice
+ *
+ * Pops up the menu or dropdown list of @combo_box, the popup window
+ * will be grabbed so only @device and its associated pointer/keyboard
+ * are the only #GdkDevice<!-- -->s able to send events to it.
+ *
+ * Since: 3.0
+ **/
+void
+gtk_combo_box_popup_for_device (GtkComboBox *combo_box,
+                                GdkDevice   *device)
 {
   GtkComboBoxPrivate *priv = combo_box->priv;
   gint x, y, width, height;
   GtkTreePath *path = NULL, *ppath;
   GtkWidget *toplevel;
+  GdkDevice *keyboard, *pointer;
+  guint32 time;
+
+  g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
+  g_return_if_fail (GDK_IS_DEVICE (device));
 
-  if (!GTK_WIDGET_REALIZED (combo_box))
+  if (!gtk_widget_get_realized (GTK_WIDGET (combo_box)))
     return;
 
-  if (GTK_WIDGET_MAPPED (priv->popup_widget))
+  if (gtk_widget_get_mapped (priv->popup_widget))
     return;
 
+  if (priv->grab_pointer && priv->grab_keyboard)
+    return;
+
+  time = gtk_get_current_event_time ();
+
+  if (device->source == GDK_SOURCE_KEYBOARD)
+    {
+      keyboard = device;
+      pointer = gdk_device_get_associated_device (device);
+    }
+  else
+    {
+      pointer = device;
+      keyboard = gdk_device_get_associated_device (device);
+    }
+
   if (GTK_IS_MENU (priv->popup_widget))
     {
       gtk_combo_box_menu_popup (combo_box, 
@@ -1905,17 +2040,44 @@ gtk_combo_box_real_popup (GtkComboBox *combo_box)
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->button),
                                 TRUE);
 
-  if (!GTK_WIDGET_HAS_FOCUS (priv->tree_view))
+  if (!gtk_widget_has_focus (priv->tree_view))
     gtk_widget_grab_focus (priv->tree_view);
 
-  if (!popup_grab_on_window (priv->popup_window->window,
-                            GDK_CURRENT_TIME, TRUE))
+  if (!popup_grab_on_window (gtk_widget_get_window (priv->popup_window),
+                            keyboard, pointer, time))
     {
       gtk_widget_hide (priv->popup_window);
       return;
     }
 
-  gtk_grab_add (priv->popup_window);
+  gtk_device_grab_add (priv->popup_window, pointer, TRUE);
+  priv->grab_pointer = pointer;
+  priv->grab_keyboard = keyboard;
+}
+
+static void
+gtk_combo_box_real_popup (GtkComboBox *combo_box)
+{
+  GdkDevice *device;
+
+  device = gtk_get_current_event_device ();
+
+  if (!device)
+    {
+      GdkDeviceManager *device_manager;
+      GdkDisplay *display;
+      GList *devices;
+
+      display = gtk_widget_get_display (GTK_WIDGET (combo_box));
+      device_manager = gdk_display_get_device_manager (display);
+
+      /* No device was set, pick the first master device */
+      devices = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER);
+      device = devices->data;
+      g_list_free (devices);
+    }
+
+  gtk_combo_box_popup_for_device (combo_box, device);
 }
 
 static gboolean
@@ -1954,22 +2116,24 @@ gtk_combo_box_popdown (GtkComboBox *combo_box)
       return;
     }
 
-  if (!GTK_WIDGET_REALIZED (GTK_WIDGET (combo_box)))
+  if (!gtk_widget_get_realized (GTK_WIDGET (combo_box)))
     return;
 
-  gtk_grab_remove (priv->popup_window);
+  gtk_device_grab_remove (priv->popup_window, priv->grab_pointer);
   gtk_widget_hide_all (priv->popup_window);
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->button),
                                 FALSE);
+
+  priv->grab_pointer = NULL;
+  priv->grab_keyboard = NULL;
 }
 
-static gint
-gtk_combo_box_calc_requested_width (GtkComboBox *combo_box,
-                                    GtkTreePath *path)
+static void
+gtk_combo_box_update_requested_width (GtkComboBox *combo_box,
+                                     GtkTreePath *path)
 {
   GtkComboBoxPrivate *priv = combo_box->priv;
-  gint padding;
-  GtkRequisition req;
+  gint                padding, min_width, nat_width;
 
   if (priv->cell_view)
     gtk_widget_style_get (priv->cell_view,
@@ -1982,174 +2146,30 @@ gtk_combo_box_calc_requested_width (GtkComboBox *combo_box,
   padding += BONUS_PADDING;
 
   if (priv->cell_view)
-    gtk_cell_view_get_size_of_row (GTK_CELL_VIEW (priv->cell_view),
-                                   path, &req);
+    gtk_cell_view_get_desired_width_of_row (GTK_CELL_VIEW (priv->cell_view),
+                                           path, &min_width, &nat_width);
   else
-    req.width = 0;
+    min_width = nat_width = 0;
 
-  return req.width + padding;
-}
-
-static void
-gtk_combo_box_remeasure (GtkComboBox *combo_box)
-{
-  GtkComboBoxPrivate *priv = combo_box->priv;
-  GtkTreeIter iter;
-  GtkTreePath *path;
-
-  if (!priv->model ||
-      !gtk_tree_model_get_iter_first (priv->model, &iter))
-    return;
-
-  priv->width = 0;
-  priv->height = 0;
-
-  path = gtk_tree_path_new_from_indices (0, -1);
-
-  do
-    {
-      GtkRequisition req;
-
-      if (priv->cell_view)
-       gtk_cell_view_get_size_of_row (GTK_CELL_VIEW (priv->cell_view), 
-                                       path, &req);
-      else
-        {
-          req.width = 0;
-          req.height = 0;
-        }
-
-      priv->width = MAX (priv->width, req.width);
-      priv->height = MAX (priv->height, req.height);
-
-      gtk_tree_path_next (path);
-    }
-  while (gtk_tree_model_iter_next (priv->model, &iter));
-
-  gtk_tree_path_free (path);
-}
-
-static void
-gtk_combo_box_size_request (GtkWidget      *widget,
-                            GtkRequisition *requisition)
-{
-  gint width, height;
-  gint focus_width, focus_pad;
-  gint font_size;
-  gint arrow_size;
-  GtkRequisition bin_req;
-  PangoContext *context;
-  PangoFontMetrics *metrics;
-  PangoFontDescription *font_desc;
-
-  GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
-  GtkComboBoxPrivate *priv = combo_box->priv;
-  /* common */
-  gtk_widget_size_request (GTK_BIN (widget)->child, &bin_req);
-  gtk_combo_box_remeasure (combo_box);
-  bin_req.width = MAX (bin_req.width, priv->width);
-  bin_req.height = MAX (bin_req.height, priv->height);
-
-  gtk_widget_style_get (GTK_WIDGET (widget),
-                       "focus-line-width", &focus_width,
-                       "focus-padding", &focus_pad,
-                       "arrow-size", &arrow_size,
-                       NULL);
-
-  font_desc = GTK_BIN (widget)->child->style->font_desc;
-  context = gtk_widget_get_pango_context (widget);
-  metrics = pango_context_get_metrics (context, font_desc,
-                                      pango_context_get_language (context));
-  font_size = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) +
-                           pango_font_metrics_get_descent (metrics));
-  pango_font_metrics_unref (metrics);
-
-  arrow_size = MAX (arrow_size, font_size);
-
-  gtk_widget_set_size_request (priv->arrow, arrow_size, arrow_size);
+  min_width += padding;
+  nat_width += padding;
 
-  if (!priv->tree_view)
+  if (min_width > priv->minimum_width || nat_width > priv->natural_width)
     {
-      /* menu mode */
+      priv->minimum_width = MAX (priv->minimum_width, min_width);
+      priv->natural_width = MAX (priv->natural_width, nat_width);
 
       if (priv->cell_view)
-        {
-          GtkRequisition button_req, sep_req, arrow_req;
-          gint border_width, xthickness, ythickness;
-
-          gtk_widget_size_request (priv->button, &button_req);
-         border_width = GTK_CONTAINER (combo_box)->border_width;
-          xthickness = priv->button->style->xthickness;
-          ythickness = priv->button->style->ythickness;
-
-          bin_req.width = MAX (bin_req.width, priv->width);
-          bin_req.height = MAX (bin_req.height, priv->height);
-
-          gtk_widget_size_request (priv->separator, &sep_req);
-          gtk_widget_size_request (priv->arrow, &arrow_req);
-
-          height = MAX (sep_req.height, arrow_req.height);
-          height = MAX (height, bin_req.height);
-
-          width = bin_req.width + sep_req.width + arrow_req.width;
-
-          height += 2*(border_width + ythickness + focus_width + focus_pad);
-          width  += 2*(border_width + xthickness + focus_width + focus_pad);
-
-          requisition->width = width;
-          requisition->height = height;
-        }
-      else
-        {
-          GtkRequisition but_req;
-
-          gtk_widget_size_request (priv->button, &but_req);
-
-          requisition->width = bin_req.width + but_req.width;
-          requisition->height = MAX (bin_req.height, but_req.height);
-        }
-    }
-  else
-    {
-      /* list mode */
-      GtkRequisition button_req, frame_req;
-
-      /* sample + frame */
-      *requisition = bin_req;
-
-      requisition->width += 2 * focus_width;
-      
-      if (priv->cell_view_frame)
-        {
-         gtk_widget_size_request (priv->cell_view_frame, &frame_req);
-         if (priv->has_frame)
-           {
-             requisition->width += 2 *
-               (GTK_CONTAINER (priv->cell_view_frame)->border_width +
-                GTK_WIDGET (priv->cell_view_frame)->style->xthickness);
-             requisition->height += 2 *
-               (GTK_CONTAINER (priv->cell_view_frame)->border_width +
-                GTK_WIDGET (priv->cell_view_frame)->style->ythickness);
-           }
-        }
-
-      /* the button */
-      gtk_widget_size_request (priv->button, &button_req);
-
-      requisition->height = MAX (requisition->height, button_req.height);
-      requisition->width += button_req.width;
-    }
-
-  if (GTK_SHADOW_NONE != priv->shadow_type)
-    {
-      requisition->height += 2 * widget->style->ythickness;
-      requisition->width += 2 * widget->style->xthickness;
+       {
+         gtk_widget_set_size_request (priv->cell_view, min_width, -1);
+         gtk_widget_queue_resize (priv->cell_view);
+       }
     }
 }
 
 #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;                                    \
@@ -2170,23 +2190,27 @@ gtk_combo_box_size_allocate (GtkWidget     *widget,
 {
   GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
   GtkComboBoxPrivate *priv = combo_box->priv;
+  GtkWidget *child_widget;
   gint shadow_width, shadow_height;
   gint focus_width, focus_pad;
   GtkAllocation child;
   GtkRequisition req;
+  GtkStyle *style;
   gboolean is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
 
-  widget->allocation = *allocation;
+  gtk_widget_set_allocation (widget, allocation);
+  child_widget = gtk_bin_get_child (GTK_BIN (widget));
 
-  gtk_widget_style_get (GTK_WIDGET (widget),
+  style = gtk_widget_get_style (widget);
+  gtk_widget_style_get (widget,
                        "focus-line-width", &focus_width,
                        "focus-padding", &focus_pad,
                        NULL);
 
   if (GTK_SHADOW_NONE != priv->shadow_type)
     {
-      shadow_width = widget->style->xthickness;
-      shadow_height = widget->style->ythickness;
+      shadow_width = style->xthickness;
+      shadow_height = style->ythickness;
     }
   else
     {
@@ -2198,8 +2222,9 @@ gtk_combo_box_size_allocate (GtkWidget     *widget,
     {
       if (priv->cell_view)
         {
-          gint border_width, xthickness, ythickness;
+          gint xthickness, ythickness;
           gint width;
+          guint border_width;
 
           /* menu mode */
           allocation->x += shadow_width;
@@ -2210,9 +2235,10 @@ gtk_combo_box_size_allocate (GtkWidget     *widget,
           gtk_widget_size_allocate (priv->button, allocation);
 
           /* set some things ready */
-          border_width = GTK_CONTAINER (priv->button)->border_width;
-          xthickness = priv->button->style->xthickness;
-          ythickness = priv->button->style->ythickness;
+          border_width = gtk_container_get_border_width (GTK_CONTAINER (priv->button));
+          style = gtk_widget_get_style (priv->button);
+          xthickness = style->xthickness;
+          ythickness = style->ythickness;
 
           child.x = allocation->x;
           child.y = allocation->y;
@@ -2229,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;
@@ -2238,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;
@@ -2261,9 +2287,29 @@ gtk_combo_box_size_allocate (GtkWidget     *widget,
               child.width -= child.x;
             }
 
+          if (gtk_widget_get_visible (priv->popup_widget))
+            {
+              gint width, min_width;
+
+              if (priv->wrap_width == 0)
+                {
+                  GtkAllocation combo_box_allocation;
+
+                  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_widget_get_preferred_width (priv->popup_widget, &min_width, NULL);
+                  gtk_widget_set_size_request (priv->popup_widget,
+                    MAX (width, min_width), -1);
+               }
+
+              /* reposition the menu after giving it a new width */
+              gtk_menu_reposition (GTK_MENU (priv->popup_widget));
+            }
+
          child.width = MAX (1, child.width);
          child.height = MAX (1, child.height);
-          gtk_widget_size_allocate (GTK_BIN (widget)->child, &child);
+          gtk_widget_size_allocate (child_widget, &child);
         }
       else
         {
@@ -2277,13 +2323,18 @@ gtk_combo_box_size_allocate (GtkWidget     *widget,
           child.width = allocation->width - req.width - 2 * shadow_width;
          child.width = MAX (1, child.width);
          child.height = MAX (1, child.height);
-          gtk_widget_size_allocate (GTK_BIN (widget)->child, &child);
+          gtk_widget_size_allocate (child_widget, &child);
         }
     }
   else
     {
       /* list mode */
 
+      /* Combobox thickness + border-width */
+      guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+      int delta_x = shadow_width + border_width;
+      int delta_y = shadow_height + border_width;
+
       /* button */
       GTK_COMBO_BOX_SIZE_ALLOCATE_BUTTON
 
@@ -2292,37 +2343,54 @@ gtk_combo_box_size_allocate (GtkWidget     *widget,
         child.x = allocation->x + req.width;
       else
         child.x = allocation->x;
+
       child.y = allocation->y;
       child.width = allocation->width - req.width;
       child.height = allocation->height;
 
       if (priv->cell_view_frame)
         {
-         child.width = MAX (1, child.width);
-         child.height = MAX (1, child.height);
+          child.x += delta_x;
+          child.y += delta_y;
+          child.width = MAX (1, child.width - delta_x * 2);
+          child.height = MAX (1, child.height - delta_y * 2);
           gtk_widget_size_allocate (priv->cell_view_frame, &child);
 
           /* the sample */
-         if (priv->has_frame)
-           {
-             child.x +=
-               GTK_CONTAINER (priv->cell_view_frame)->border_width +
-               GTK_WIDGET (priv->cell_view_frame)->style->xthickness;
-             child.y +=
-               GTK_CONTAINER (priv->cell_view_frame)->border_width +
-               GTK_WIDGET (priv->cell_view_frame)->style->ythickness;
-             child.width -= 2 * (
-                                 GTK_CONTAINER (priv->cell_view_frame)->border_width +
-                                 GTK_WIDGET (priv->cell_view_frame)->style->xthickness);
-             child.height -= 2 * (
-                                  GTK_CONTAINER (priv->cell_view_frame)->border_width +
-                                  GTK_WIDGET (priv->cell_view_frame)->style->ythickness);
-           }
+          if (priv->has_frame)
+            {
+              border_width = gtk_container_get_border_width (GTK_CONTAINER (priv->cell_view_frame));
+              style = gtk_widget_get_style (priv->cell_view_frame);
+              delta_x = border_width + style->xthickness;
+              delta_y = border_width + style->ythickness;
+
+              child.x += delta_x;
+              child.y += delta_y;
+              child.width -= delta_x * 2;
+              child.height -= delta_y * 2;
+            }
+        }
+      else
+        {
+          child.x += delta_x;
+          child.y += delta_y;
+          child.width -= delta_x * 2;
+          child.height -= delta_y * 2;
+        }
+
+      if (gtk_widget_get_visible (priv->popup_window))
+        {
+          gint x, y, width, height;
+          gtk_combo_box_list_position (combo_box, &x, &y, &width, &height);
+          gtk_window_move (GTK_WINDOW (priv->popup_window), x, y);
+          gtk_widget_set_size_request (priv->popup_window, width, height);
         }
+
       
       child.width = MAX (1, child.width);
       child.height = MAX (1, child.height);
-      gtk_widget_size_allocate (GTK_BIN (combo_box)->child, &child);
+      
+      gtk_widget_size_allocate (child_widget, &child);
     }
 }
 
@@ -2377,6 +2445,7 @@ gtk_combo_box_forall (GtkContainer *container,
 {
   GtkComboBox *combo_box = GTK_COMBO_BOX (container);
   GtkComboBoxPrivate *priv = combo_box->priv;
+  GtkWidget *child;
 
   if (include_internals)
     {
@@ -2386,8 +2455,9 @@ gtk_combo_box_forall (GtkContainer *container,
        (* callback) (priv->cell_view_frame, callback_data);
     }
 
-  if (GTK_BIN (container)->child)
-    (* callback) (GTK_BIN (container)->child, callback_data);
+  child = gtk_bin_get_child (GTK_BIN (container));
+  if (child)
+    (* callback) (child, callback_data);
 }
 
 static void 
@@ -2411,33 +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_DRAWABLE (widget) &&
-      GTK_SHADOW_NONE != priv->shadow_type)
+  if (priv->shadow_type != GTK_SHADOW_NONE)
     {
-      gtk_paint_shadow (widget->style, widget->window,
+      gtk_paint_shadow (gtk_widget_get_style (widget),
+                        cr,
                         GTK_STATE_NORMAL, priv->shadow_type,
-                        NULL, widget, "combobox",
-                        widget->allocation.x, widget->allocation.y,
-                        widget->allocation.width, widget->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 (widget)->child, event);
+  gtk_container_propagate_draw (GTK_CONTAINER (widget),
+                                gtk_bin_get_child (GTK_BIN (widget)),
+                                cr);
 
   return FALSE;
 }
@@ -2717,8 +2789,11 @@ gtk_combo_box_menu_setup (GtkComboBox *combo_box,
                           gboolean     add_children)
 {
   GtkComboBoxPrivate *priv = combo_box->priv;
+  GtkWidget *child;
   GtkWidget *menu;
 
+  child = gtk_bin_get_child (GTK_BIN (combo_box));
+
   if (priv->cell_view)
     {
       priv->button = gtk_toggle_button_new ();
@@ -2728,7 +2803,7 @@ gtk_combo_box_menu_setup (GtkComboBox *combo_box,
       g_signal_connect (priv->button, "toggled",
                         G_CALLBACK (gtk_combo_box_button_toggled), combo_box);
       gtk_widget_set_parent (priv->button,
-                             GTK_BIN (combo_box)->child->parent);
+                             gtk_widget_get_parent (child));
 
       priv->box = gtk_hbox_new (FALSE, 0);
       gtk_container_add (GTK_CONTAINER (priv->button), priv->box);
@@ -2750,25 +2825,26 @@ gtk_combo_box_menu_setup (GtkComboBox *combo_box,
       g_signal_connect (priv->button, "toggled",
                         G_CALLBACK (gtk_combo_box_button_toggled), combo_box);
       gtk_widget_set_parent (priv->button,
-                             GTK_BIN (combo_box)->child->parent);
+                             gtk_widget_get_parent (child));
 
       priv->arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
       gtk_container_add (GTK_CONTAINER (priv->button), priv->arrow);
       gtk_widget_show_all (priv->button);
     }
 
-  g_signal_connect (priv->button, "button_press_event",
+  g_signal_connect (priv->button, "button-press-event",
                     G_CALLBACK (gtk_combo_box_menu_button_press),
                     combo_box);
-  g_signal_connect (priv->button, "state_changed",
+  g_signal_connect (priv->button, "state-changed",
                    G_CALLBACK (gtk_combo_box_button_state_changed), 
                    combo_box);
 
   /* create our funky menu */
   menu = gtk_menu_new ();
   gtk_widget_set_name (menu, "gtk-combobox-popup-menu");
+  gtk_menu_set_reserve_toggle_size (GTK_MENU (menu), FALSE);
   
-  g_signal_connect (menu, "key_press_event",
+  g_signal_connect (menu, "key-press-event",
                    G_CALLBACK (gtk_combo_box_menu_key_press), combo_box);
   gtk_combo_box_set_popup_widget (combo_box, menu);
 
@@ -2782,6 +2858,7 @@ gtk_combo_box_menu_setup (GtkComboBox *combo_box,
   gtk_combo_box_sync_cells (combo_box, GTK_CELL_LAYOUT (priv->column));
 
   gtk_combo_box_update_title (combo_box);
+  gtk_combo_box_update_sensitivity (combo_box);
 }
 
 static void
@@ -2830,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;
@@ -2858,8 +2935,8 @@ gtk_combo_box_menu_fill_level (GtkComboBox *combo_box,
       gtk_tree_model_iter_nth_child (model, &iter, parent, i);
 
       if (priv->row_separator_func)
-       is_separator = (*priv->row_separator_func) (priv->model, &iter,
-                                                   priv->row_separator_data);
+       is_separator = priv->row_separator_func (priv->model, &iter,
+                                                 priv->row_separator_data);
       else
        is_separator = FALSE;
       
@@ -2879,6 +2956,7 @@ gtk_combo_box_menu_fill_level (GtkComboBox *combo_box,
          if (gtk_tree_model_iter_has_child (model, &iter))
            {
              submenu = gtk_menu_new ();
+              gtk_menu_set_reserve_toggle_size (GTK_MENU (submenu), FALSE);
              gtk_widget_show (submenu);
              gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), submenu);
              
@@ -3070,7 +3148,7 @@ gtk_combo_box_menu_button_press (GtkWidget      *widget,
       event->type == GDK_BUTTON_PRESS && event->button == 1)
     {
       if (priv->focus_on_click && 
-         !GTK_WIDGET_HAS_FOCUS (priv->button))
+         !gtk_widget_has_focus (priv->button))
        gtk_widget_grab_focus (priv->button);
 
       gtk_combo_box_menu_popup (combo_box, event->button, event->time);
@@ -3090,7 +3168,7 @@ gtk_combo_box_menu_item_activate (GtkWidget *item,
   GtkTreePath *path;
   GtkTreeIter iter;
 
-  cell_view = GTK_BIN (item)->child;
+  cell_view = gtk_bin_get_child (GTK_BIN (item));
 
   g_return_if_fail (GTK_IS_CELL_VIEW (cell_view));
 
@@ -3104,21 +3182,59 @@ gtk_combo_box_menu_item_activate (GtkWidget *item,
 
   gtk_tree_path_free (path);
 
-  combo_box->priv->editing_canceled = FALSE;
+  g_object_set (combo_box,
+                "editing-canceled", FALSE,
+                NULL);
 }
 
 static void
-gtk_combo_box_model_row_inserted (GtkTreeModel     *model,
-                                 GtkTreePath      *path,
-                                 GtkTreeIter      *iter,
-                                 gpointer          user_data)
+gtk_combo_box_update_sensitivity (GtkComboBox *combo_box)
 {
-  GtkComboBox *combo_box = GTK_COMBO_BOX (user_data);
+  GtkTreeIter iter;
+  gboolean sensitive = TRUE; /* fool code checkers */
 
-  if (combo_box->priv->tree_view)
+  if (!combo_box->priv->button)
+    return;
+
+  switch (combo_box->priv->button_sensitivity)
+    {
+      case GTK_SENSITIVITY_ON:
+        sensitive = TRUE;
+        break;
+      case GTK_SENSITIVITY_OFF:
+        sensitive = FALSE;
+        break;
+      case GTK_SENSITIVITY_AUTO:
+        sensitive = combo_box->priv->model &&
+                    gtk_tree_model_get_iter_first (combo_box->priv->model, &iter);
+        break;
+      default:
+        g_assert_not_reached ();
+        break;
+    }
+
+  gtk_widget_set_sensitive (combo_box->priv->button, sensitive);
+
+  /* In list-mode, we also need to update sensitivity of the event box */
+  if (GTK_IS_TREE_VIEW (combo_box->priv->tree_view)
+      && combo_box->priv->cell_view)
+    gtk_widget_set_sensitive (combo_box->priv->box, sensitive);
+}
+
+static void
+gtk_combo_box_model_row_inserted (GtkTreeModel     *model,
+                                 GtkTreePath      *path,
+                                 GtkTreeIter      *iter,
+                                 gpointer          user_data)
+{
+  GtkComboBox *combo_box = GTK_COMBO_BOX (user_data);
+
+  if (combo_box->priv->tree_view)
     gtk_combo_box_list_popup_resize (combo_box);
   else
     gtk_combo_box_menu_row_inserted (model, path, iter, user_data);
+
+  gtk_combo_box_update_sensitivity (combo_box);
 }
 
 static void
@@ -3140,6 +3256,8 @@ gtk_combo_box_model_row_deleted (GtkTreeModel     *model,
     gtk_combo_box_list_popup_resize (combo_box);
   else
     gtk_combo_box_menu_row_deleted (model, path, user_data);  
+
+  gtk_combo_box_update_sensitivity (combo_box);
 }
 
 static void
@@ -3190,7 +3308,7 @@ list_popup_resize_idle (gpointer user_data)
   GtkComboBoxPrivate *priv = combo_box->priv;
   gint x, y, width, height;
 
-  if (priv->tree_view && GTK_WIDGET_MAPPED (priv->popup_window))
+  if (priv->tree_view && gtk_widget_get_mapped (priv->popup_window))
     {
       gtk_combo_box_list_position (combo_box, &x, &y, &width, &height);
   
@@ -3231,6 +3349,7 @@ find_menu_by_path (GtkWidget   *menu,
                   gboolean     skip_first)
 {
   GList *i, *list;
+  GtkWidget *child;
   GtkWidget *item;
   GtkWidget *submenu;    
   GtkTreeRowReference *mref;
@@ -3242,6 +3361,7 @@ find_menu_by_path (GtkWidget   *menu,
   item = NULL;
   for (i = list; i; i = i->next)
     {
+      child = gtk_bin_get_child (i->data);
       if (GTK_IS_SEPARATOR_MENU_ITEM (i->data))
        {
          mref = g_object_get_data (G_OBJECT (i->data), "gtk-combo-box-item-path");
@@ -3252,7 +3372,7 @@ find_menu_by_path (GtkWidget   *menu,
          else
            mpath = gtk_tree_row_reference_get_path (mref);
        }
-      else if (GTK_IS_CELL_VIEW (GTK_BIN (i->data)->child))
+      else if (GTK_IS_CELL_VIEW (child))
        {
          if (skip)
            {
@@ -3260,7 +3380,7 @@ find_menu_by_path (GtkWidget   *menu,
              continue;
            }
 
-         mpath = gtk_cell_view_get_displayed_row (GTK_CELL_VIEW (GTK_BIN (i->data)->child));
+         mpath = gtk_cell_view_get_displayed_row (GTK_CELL_VIEW (child));
        }
       else 
        continue;
@@ -3356,6 +3476,7 @@ gtk_combo_box_menu_row_inserted (GtkTreeModel *model,
       if (!menu)
        {
          menu = gtk_menu_new ();
+          gtk_menu_set_reserve_toggle_size (GTK_MENU (menu), FALSE);
          gtk_widget_show (menu);
          gtk_menu_item_set_submenu (GTK_MENU_ITEM (parent), menu);
          
@@ -3370,7 +3491,7 @@ gtk_combo_box_menu_row_inserted (GtkTreeModel *model,
                            combo_box);
          gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
          gtk_menu_shell_append (GTK_MENU_SHELL (menu), separator);
-         if (cell_view_is_sensitive (GTK_CELL_VIEW (GTK_BIN (item)->child)))
+         if (cell_view_is_sensitive (GTK_CELL_VIEW (gtk_bin_get_child (GTK_BIN (item)))))
            {
              gtk_widget_show (item);
              gtk_widget_show (separator);
@@ -3386,8 +3507,8 @@ gtk_combo_box_menu_row_inserted (GtkTreeModel *model,
     }
   
   if (priv->row_separator_func)
-    is_separator = (*priv->row_separator_func) (model, iter,
-                                               priv->row_separator_data);
+    is_separator = priv->row_separator_func (model, iter,
+                                             priv->row_separator_data);
   else
     is_separator = FALSE;
 
@@ -3469,7 +3590,6 @@ gtk_combo_box_menu_row_changed (GtkTreeModel *model,
   GtkComboBox *combo_box = GTK_COMBO_BOX (user_data);
   GtkComboBoxPrivate *priv = combo_box->priv;
   GtkWidget *item;
-  gint width;
   gboolean is_separator;
 
   if (!priv->popup_widget)
@@ -3478,8 +3598,8 @@ gtk_combo_box_menu_row_changed (GtkTreeModel *model,
   item = find_menu_by_path (priv->popup_widget, path, FALSE);
 
   if (priv->row_separator_func)
-    is_separator = (*priv->row_separator_func) (model, iter,
-                                               priv->row_separator_data);
+    is_separator = priv->row_separator_func (model, iter,
+                                             priv->row_separator_data);
   else
     is_separator = FALSE;
 
@@ -3489,7 +3609,8 @@ gtk_combo_box_menu_row_changed (GtkTreeModel *model,
       gtk_combo_box_menu_row_inserted (model, path, iter, combo_box);
     }
 
-  if (priv->wrap_width && item->parent == priv->popup_widget)
+  if (priv->wrap_width &&
+      gtk_widget_get_parent (item) == priv->popup_widget)
     {
       GtkWidget *pitem = NULL;
       GtkTreePath *prev;
@@ -3514,17 +3635,7 @@ gtk_combo_box_menu_row_changed (GtkTreeModel *model,
       gtk_combo_box_relayout_item (combo_box, item, iter, pitem);
     }
 
-  width = gtk_combo_box_calc_requested_width (combo_box, path);
-
-  if (width > priv->width)
-    {
-      if (priv->cell_view)
-       {
-         gtk_widget_set_size_request (priv->cell_view, width, -1);
-         gtk_widget_queue_resize (priv->cell_view);
-       }
-      priv->width = width;
-    }
+  gtk_combo_box_update_requested_width (combo_box, path);
 }
 
 /*
@@ -3536,11 +3647,15 @@ gtk_combo_box_list_setup (GtkComboBox *combo_box)
 {
   GtkComboBoxPrivate *priv = combo_box->priv;
   GtkTreeSelection *sel;
+  GtkStyle *style;
+  GtkWidget *child;
+  GtkWidget *widget = GTK_WIDGET (combo_box);
 
   priv->button = gtk_toggle_button_new ();
+  child = gtk_bin_get_child (GTK_BIN (combo_box));
   gtk_widget_set_parent (priv->button,
-                         GTK_BIN (combo_box)->child->parent);
-  g_signal_connect (priv->button, "button_press_event",
+                         gtk_widget_get_parent (child));
+  g_signal_connect (priv->button, "button-press-event",
                     G_CALLBACK (gtk_combo_box_list_button_pressed), combo_box);
   g_signal_connect (priv->button, "toggled",
                     G_CALLBACK (gtk_combo_box_button_toggled), combo_box);
@@ -3552,8 +3667,9 @@ gtk_combo_box_list_setup (GtkComboBox *combo_box)
 
   if (priv->cell_view)
     {
-      gtk_cell_view_set_background_color (GTK_CELL_VIEW (priv->cell_view), 
-                                         &GTK_WIDGET (combo_box)->style->base[GTK_WIDGET_STATE (combo_box)]);
+      style = gtk_widget_get_style (widget);
+      gtk_cell_view_set_background_color (GTK_CELL_VIEW (priv->cell_view),
+                                          &style->base[gtk_widget_get_state (widget)]);
 
       priv->box = gtk_event_box_new ();
       gtk_event_box_set_visible_window (GTK_EVENT_BOX (priv->box), 
@@ -3571,13 +3687,13 @@ gtk_combo_box_list_setup (GtkComboBox *combo_box)
          gtk_event_box_set_visible_window (GTK_EVENT_BOX (combo_box->priv->cell_view_frame), 
                                            FALSE);
        }
-      
+
       gtk_widget_set_parent (priv->cell_view_frame,
-                            GTK_BIN (combo_box)->child->parent);
+                            gtk_widget_get_parent (child));
       gtk_container_add (GTK_CONTAINER (priv->cell_view_frame), priv->box);
       gtk_widget_show_all (priv->cell_view_frame);
 
-      g_signal_connect (priv->box, "button_press_event",
+      g_signal_connect (priv->box, "button-press-event",
                        G_CALLBACK (gtk_combo_box_list_button_pressed), 
                        combo_box);
     }
@@ -3620,26 +3736,28 @@ gtk_combo_box_list_setup (GtkComboBox *combo_box)
   /* set sample/popup widgets */
   gtk_combo_box_set_popup_widget (combo_box, priv->tree_view);
 
-  g_signal_connect (priv->tree_view, "key_press_event",
+  g_signal_connect (priv->tree_view, "key-press-event",
                     G_CALLBACK (gtk_combo_box_list_key_press),
                     combo_box);
-  g_signal_connect (priv->tree_view, "enter_notify_event",
+  g_signal_connect (priv->tree_view, "enter-notify-event",
                     G_CALLBACK (gtk_combo_box_list_enter_notify),
                     combo_box);
-  g_signal_connect (priv->tree_view, "row_expanded",
+  g_signal_connect (priv->tree_view, "row-expanded",
                    G_CALLBACK (gtk_combo_box_model_row_expanded),
                    combo_box);
-  g_signal_connect (priv->tree_view, "row_collapsed",
+  g_signal_connect (priv->tree_view, "row-collapsed",
                    G_CALLBACK (gtk_combo_box_model_row_expanded),
                    combo_box);
-  g_signal_connect (priv->popup_window, "button_press_event",
+  g_signal_connect (priv->popup_window, "button-press-event",
                     G_CALLBACK (gtk_combo_box_list_button_pressed),
                     combo_box);
-  g_signal_connect (priv->popup_window, "button_release_event",
+  g_signal_connect (priv->popup_window, "button-release-event",
                     G_CALLBACK (gtk_combo_box_list_button_released),
                     combo_box);
 
   gtk_widget_show (priv->tree_view);
+
+  gtk_combo_box_update_sensitivity (combo_box);
 }
 
 static void
@@ -3749,10 +3867,10 @@ gtk_combo_box_list_button_pressed (GtkWidget      *widget,
     return FALSE;
 
   if (priv->focus_on_click && 
-      !GTK_WIDGET_HAS_FOCUS (priv->button))
+      !gtk_widget_has_focus (priv->button))
     gtk_widget_grab_focus (priv->button);
 
-  gtk_combo_box_popup (combo_box);
+  gtk_combo_box_popup_for_device (combo_box, event->device);
 
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->button), TRUE);
 
@@ -3846,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;
@@ -3865,8 +3983,8 @@ gtk_combo_box_list_key_press (GtkWidget   *widget,
   GtkComboBox *combo_box = GTK_COMBO_BOX (data);
   GtkTreeIter iter;
 
-  if (event->keyval == GDK_Return || event->keyval == GDK_KP_Enter ||
-      event->keyval == GDK_space || event->keyval == GDK_KP_Space) 
+  if (event->keyval == GDK_KEY_Return || event->keyval == GDK_KEY_ISO_Enter || event->keyval == GDK_KEY_KP_Enter ||
+      event->keyval == GDK_KEY_space || event->keyval == GDK_KEY_KP_Space) 
   {
     GtkTreeModel *model = NULL;
     
@@ -3885,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;
@@ -3901,41 +4019,44 @@ gtk_combo_box_list_auto_scroll (GtkComboBox *combo_box,
                                gint         x, 
                                gint         y)
 {
-  GtkWidget *tree_view = combo_box->priv->tree_view;
   GtkAdjustment *adj;
+  GtkAllocation allocation;
+  GtkWidget *tree_view = combo_box->priv->tree_view;
   gdouble value;
 
+  gtk_widget_get_allocation (tree_view, &allocation);
+
   adj = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (combo_box->priv->scrolled_window));
   if (adj && adj->upper - adj->lower > adj->page_size)
     {
-      if (x <= tree_view->allocation.x && 
+      if (x <= allocation.x &&
          adj->lower < adj->value)
        {
-         value = adj->value - (tree_view->allocation.x - x + 1);
-         gtk_adjustment_set_value (adj, CLAMP (value, adj->lower, adj->upper - adj->page_size));
+         value = adj->value - (allocation.x - x + 1);
+         gtk_adjustment_set_value (adj, value);
        }
-      else if (x >= tree_view->allocation.x + tree_view->allocation.width &&
+      else if (x >= allocation.x + allocation.width &&
               adj->upper - adj->page_size > adj->value)
        {
-         value = adj->value + (x - tree_view->allocation.x - tree_view->allocation.width + 1);
-         gtk_adjustment_set_value (adj, CLAMP (value, 0.0, adj->upper - adj->page_size));
+         value = adj->value + (x - allocation.x - allocation.width + 1);
+         gtk_adjustment_set_value (adj, MAX (value, 0.0));
        }
     }
 
   adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (combo_box->priv->scrolled_window));
   if (adj && adj->upper - adj->lower > adj->page_size)
     {
-      if (y <= tree_view->allocation.y && 
+      if (y <= allocation.y &&
          adj->lower < adj->value)
        {
-         value = adj->value - (tree_view->allocation.y - y + 1);
-         gtk_adjustment_set_value (adj, CLAMP (value, adj->lower, adj->upper - adj->page_size));
+         value = adj->value - (allocation.y - y + 1);
+         gtk_adjustment_set_value (adj, value);
        }
-      else if (y >= tree_view->allocation.height &&
+      else if (y >= allocation.height &&
               adj->upper - adj->page_size > adj->value)
        {
-         value = adj->value + (y - tree_view->allocation.height + 1);
-         gtk_adjustment_set_value (adj, CLAMP (value, 0.0, adj->upper - adj->page_size));
+         value = adj->value + (y - allocation.height + 1);
+         gtk_adjustment_set_value (adj, MAX (value, 0.0));
        }
     }
 }
@@ -3948,7 +4069,9 @@ gtk_combo_box_list_scroll_timeout (GtkComboBox *combo_box)
 
   if (priv->auto_scroll)
     {
-      gdk_window_get_pointer (priv->tree_view->window, &x, &y, NULL);
+      gdk_window_get_device_position (gtk_widget_get_window (priv->tree_view),
+                                      priv->grab_pointer,
+                                      &x, &y, NULL);
       gtk_combo_box_list_auto_scroll (combo_box, x, y);
     }
 
@@ -3991,7 +4114,7 @@ gtk_combo_box_list_select_func (GtkTreeSelection *selection,
       gtk_tree_view_column_cell_set_cell_data (column, model, &iter,
                                               FALSE, FALSE);
 
-      cell = cells = gtk_tree_view_column_get_cell_renderers (column);
+      cell = cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column));
       while (cell)
         {
          g_object_get (cell->data,
@@ -4019,20 +4142,8 @@ gtk_combo_box_list_row_changed (GtkTreeModel *model,
                                 gpointer      data)
 {
   GtkComboBox *combo_box = GTK_COMBO_BOX (data);
-  GtkComboBoxPrivate *priv = combo_box->priv;
-  gint width;
-
-  width = gtk_combo_box_calc_requested_width (combo_box, path);
 
-  if (width > priv->width)
-    {
-      if (priv->cell_view) 
-       {
-         gtk_widget_set_size_request (priv->cell_view, width, -1);
-         gtk_widget_queue_resize (priv->cell_view);
-       }
-      priv->width = width;
-    }
+  gtk_combo_box_update_requested_width (combo_box, path);
 }
 
 /*
@@ -4045,14 +4156,16 @@ pack_start_recurse (GtkWidget       *menu,
                    gboolean         expand)
 {
   GList *i, *list;
+  GtkWidget *child;
   GtkWidget *submenu;    
   
   list = gtk_container_get_children (GTK_CONTAINER (menu));
   for (i = list; i; i = i->next)
     {
-      if (GTK_IS_CELL_LAYOUT (GTK_BIN (i->data)->child))
-       gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (GTK_BIN (i->data)->child), 
-                                   cell, expand);
+      child = gtk_bin_get_child (GTK_BIN (i->data));
+      if (GTK_IS_CELL_LAYOUT (child))
+        gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (child),
+                                    cell, expand);
 
       submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data));
       if (submenu != NULL)
@@ -4067,19 +4180,15 @@ gtk_combo_box_cell_layout_pack_start (GtkCellLayout   *layout,
                                       GtkCellRenderer *cell,
                                       gboolean         expand)
 {
+  GtkComboBox *combo_box = GTK_COMBO_BOX (layout);
   ComboCellInfo *info;
-  GtkComboBox *combo_box;
   GtkComboBoxPrivate *priv;
 
-  g_return_if_fail (GTK_IS_COMBO_BOX (layout));
-  g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
-
-  combo_box = GTK_COMBO_BOX (layout);
   priv = combo_box->priv;
 
   g_object_ref_sink (cell);
 
-  info = g_new0 (ComboCellInfo, 1);
+  info = g_slice_new0 (ComboCellInfo);
   info->cell = cell;
   info->expand = expand;
   info->pack = GTK_PACK_START;
@@ -4087,8 +4196,11 @@ gtk_combo_box_cell_layout_pack_start (GtkCellLayout   *layout,
   priv->cells = g_slist_append (priv->cells, info);
 
   if (priv->cell_view)
-    gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (priv->cell_view),
-                                cell, expand);
+    {
+      gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (priv->cell_view),
+                                 cell, expand);
+
+    }
 
   if (priv->column)
     gtk_tree_view_column_pack_start (priv->column, cell, expand);
@@ -4103,14 +4215,16 @@ pack_end_recurse (GtkWidget       *menu,
                  gboolean         expand)
 {
   GList *i, *list;
+  GtkWidget *child;
   GtkWidget *submenu;    
   
   list = gtk_container_get_children (GTK_CONTAINER (menu));
   for (i = list; i; i = i->next)
     {
-      if (GTK_IS_CELL_LAYOUT (GTK_BIN (i->data)->child))
-       gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (GTK_BIN (i->data)->child), 
-                                 cell, expand);
+      child = gtk_bin_get_child (GTK_BIN (i->data));
+      if (GTK_IS_CELL_LAYOUT (child))
+        gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (child),
+                                  cell, expand);
 
       submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data));
       if (submenu != NULL)
@@ -4125,19 +4239,15 @@ gtk_combo_box_cell_layout_pack_end (GtkCellLayout   *layout,
                                     GtkCellRenderer *cell,
                                     gboolean         expand)
 {
+  GtkComboBox *combo_box = GTK_COMBO_BOX (layout);
   ComboCellInfo *info;
-  GtkComboBox *combo_box;
   GtkComboBoxPrivate *priv;
 
-  g_return_if_fail (GTK_IS_COMBO_BOX (layout));
-  g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
-
-  combo_box = GTK_COMBO_BOX (layout);
   priv = combo_box->priv;
 
   g_object_ref_sink (cell);
 
-  info = g_new0 (ComboCellInfo, 1);
+  info = g_slice_new0 (ComboCellInfo);
   info->cell = cell;
   info->expand = expand;
   info->pack = GTK_PACK_END;
@@ -4158,13 +4268,9 @@ gtk_combo_box_cell_layout_pack_end (GtkCellLayout   *layout,
 static GList *
 gtk_combo_box_cell_layout_get_cells (GtkCellLayout *layout)
 {
+  GtkComboBox *combo_box = GTK_COMBO_BOX (layout);
   GSList *list;
   GList *retval = NULL;
-  GtkComboBox *combo_box;
-
-  g_return_val_if_fail (GTK_IS_COMBO_BOX (layout), NULL);
-
-  combo_box = GTK_COMBO_BOX (layout);
 
   for (list = combo_box->priv->cells; list; list = list->next)
     {
@@ -4180,13 +4286,15 @@ static void
 clear_recurse (GtkWidget *menu)
 {
   GList *i, *list;
+  GtkWidget *child;
   GtkWidget *submenu;    
   
   list = gtk_container_get_children (GTK_CONTAINER (menu));
   for (i = list; i; i = i->next)
     {
-      if (GTK_IS_CELL_LAYOUT (GTK_BIN (i->data)->child))
-       gtk_cell_layout_clear (GTK_CELL_LAYOUT (GTK_BIN (i->data)->child)); 
+      child = gtk_bin_get_child (GTK_BIN (i->data));
+      if (GTK_IS_CELL_LAYOUT (child))
+        gtk_cell_layout_clear (GTK_CELL_LAYOUT (child));
 
       submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data));
       if (submenu != NULL)
@@ -4211,11 +4319,11 @@ gtk_combo_box_cell_layout_clear (GtkCellLayout *layout)
 
   for (i = priv->cells; i; i = i->next)
     {
-     ComboCellInfo *info = (ComboCellInfo *)i->data;
+      ComboCellInfo *info = (ComboCellInfo *)i->data;
 
       gtk_combo_box_cell_layout_clear_attributes (layout, info->cell);
       g_object_unref (info->cell);
-      g_free (info);
+      g_slice_free (ComboCellInfo, info);
       i->data = NULL;
     }
   g_slist_free (priv->cells);
@@ -4232,14 +4340,16 @@ add_attribute_recurse (GtkWidget       *menu,
                       gint             column)
 {
   GList *i, *list;
+  GtkWidget *child;
   GtkWidget *submenu;    
-  
+
   list = gtk_container_get_children (GTK_CONTAINER (menu));
   for (i = list; i; i = i->next)
     {
-      if (GTK_IS_CELL_LAYOUT (GTK_BIN (i->data)->child))
-       gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (GTK_BIN (i->data)->child),
-                                      cell, attribute, column); 
+      child = gtk_bin_get_child (GTK_BIN (i->data));
+      if (GTK_IS_CELL_LAYOUT (child))
+        gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (child),
+                                       cell, attribute, column);
 
       submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data));
       if (submenu != NULL)
@@ -4255,15 +4365,11 @@ gtk_combo_box_cell_layout_add_attribute (GtkCellLayout   *layout,
                                          const gchar     *attribute,
                                          gint             column)
 {
+  GtkComboBox *combo_box = GTK_COMBO_BOX (layout);
   ComboCellInfo *info;
-  GtkComboBox *combo_box;
-
-  g_return_if_fail (GTK_IS_COMBO_BOX (layout));
-  g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
-
-  combo_box = GTK_COMBO_BOX (layout);
 
   info = gtk_combo_box_get_cell_info (combo_box, cell);
+  g_return_if_fail (info != NULL);
 
   info->attributes = g_slist_prepend (info->attributes,
                                       GINT_TO_POINTER (column));
@@ -4296,8 +4402,8 @@ combo_cell_data_func (GtkCellLayout   *cell_layout,
   if (!info->func)
     return;
 
-  (*info->func) (cell_layout, cell, tree_model, iter, info->func_data);
-  
+  info->func (cell_layout, cell, tree_model, iter, info->func_data);
+
   if (GTK_IS_WIDGET (cell_layout))
     parent = gtk_widget_get_parent (GTK_WIDGET (cell_layout));
   
@@ -4319,7 +4425,7 @@ set_cell_data_func_recurse (GtkWidget       *menu,
  list = gtk_container_get_children (GTK_CONTAINER (menu));
   for (i = list; i; i = i->next)
     {
-      cell_view = GTK_BIN (i->data)->child;
+      cell_view = gtk_bin_get_child (GTK_BIN (i->data));
       if (GTK_IS_CELL_LAYOUT (cell_view))
        {
          /* Override sensitivity for inner nodes; we don't
@@ -4381,15 +4487,16 @@ clear_attributes_recurse (GtkWidget       *menu,
                          GtkCellRenderer *cell)
 {
   GList *i, *list;
-  GtkWidget *submenu;    
-  
+  GtkWidget *submenu;
+  GtkWidget *child;
+
   list = gtk_container_get_children (GTK_CONTAINER (menu));
   for (i = list; i; i = i->next)
     {
-      if (GTK_IS_CELL_LAYOUT (GTK_BIN (i->data)->child))
-       gtk_cell_layout_clear_attributes (GTK_CELL_LAYOUT (GTK_BIN (i->data)->child),
-                                           cell); 
-      
+      child = gtk_bin_get_child (GTK_BIN (i->data));
+      if (GTK_IS_CELL_LAYOUT (child))
+        gtk_cell_layout_clear_attributes (GTK_CELL_LAYOUT (child), cell);
+
       submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data));
       if (submenu != NULL)
        clear_attributes_recurse (submenu, cell);
@@ -4402,15 +4509,11 @@ static void
 gtk_combo_box_cell_layout_clear_attributes (GtkCellLayout   *layout,
                                             GtkCellRenderer *cell)
 {
-  ComboCellInfo *info;
-  GtkComboBox *combo_box;
+  GtkComboBox *combo_box = GTK_COMBO_BOX (layout);
   GtkComboBoxPrivate *priv;
+  ComboCellInfo *info;
   GSList *list;
 
-  g_return_if_fail (GTK_IS_COMBO_BOX (layout));
-  g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
-
-  combo_box = GTK_COMBO_BOX (layout);
   priv = combo_box->priv;
 
   info = gtk_combo_box_get_cell_info (combo_box, cell);
@@ -4443,15 +4546,17 @@ reorder_recurse (GtkWidget             *menu,
                 gint                   position)
 {
   GList *i, *list;
+  GtkWidget *child;
   GtkWidget *submenu;    
-  
+
   list = gtk_container_get_children (GTK_CONTAINER (menu));
   for (i = list; i; i = i->next)
     {
-      if (GTK_IS_CELL_LAYOUT (GTK_BIN (i->data)->child))
-       gtk_cell_layout_reorder (GTK_CELL_LAYOUT (GTK_BIN (i->data)->child),
-                                cell, position); 
-      
+      child = gtk_bin_get_child (GTK_BIN (i->data));
+      if (GTK_IS_CELL_LAYOUT (child))
+        gtk_cell_layout_reorder (GTK_CELL_LAYOUT (child),
+                                 cell, position);
+
       submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (i->data));
       if (submenu != NULL)
        reorder_recurse (submenu, cell, position);
@@ -4465,15 +4570,11 @@ gtk_combo_box_cell_layout_reorder (GtkCellLayout   *layout,
                                    GtkCellRenderer *cell,
                                    gint             position)
 {
-  ComboCellInfo *info;
-  GtkComboBox *combo_box;
+  GtkComboBox *combo_box = GTK_COMBO_BOX (layout);
   GtkComboBoxPrivate *priv;
+  ComboCellInfo *info;
   GSList *link;
 
-  g_return_if_fail (GTK_IS_COMBO_BOX (layout));
-  g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
-
-  combo_box = GTK_COMBO_BOX (layout);
   priv = combo_box->priv;
 
   info = gtk_combo_box_get_cell_info (combo_box, cell);
@@ -4759,6 +4860,14 @@ gtk_combo_box_set_active (GtkComboBox *combo_box,
   g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
   g_return_if_fail (index_ >= -1);
 
+  if (combo_box->priv->model == NULL)
+    {
+      /* Save index, in case the model is set after the index */
+      combo_box->priv->active = index_;
+      if (index_ != -1)
+        return;
+    }
+
   if (index_ != -1)
     path = gtk_tree_path_new_from_indices (index_, -1);
    
@@ -4776,7 +4885,10 @@ gtk_combo_box_set_active_internal (GtkComboBox *combo_box,
   GtkTreePath *active_path;
   gint path_cmp;
 
-  if (path && gtk_tree_row_reference_valid (priv->active_row))
+  /* Remember whether the initially active row is valid. */
+  gboolean is_valid_row_reference = gtk_tree_row_reference_valid (priv->active_row);
+
+  if (path && is_valid_row_reference)
     {
       active_path = gtk_tree_row_reference_get_path (priv->active_row);
       path_cmp = gtk_tree_path_compare (path, active_path);
@@ -4805,6 +4917,13 @@ gtk_combo_box_set_active_internal (GtkComboBox *combo_box,
 
       if (priv->cell_view)
         gtk_cell_view_set_displayed_row (GTK_CELL_VIEW (priv->cell_view), NULL);
+
+      /*
+       *  Do not emit a "changed" signal when an already invalid selection was
+       *  now set to invalid.
+       */
+      if (!is_valid_row_reference)
+        return;
     }
   else
     {
@@ -4836,7 +4955,7 @@ gtk_combo_box_set_active_internal (GtkComboBox *combo_box,
 /**
  * gtk_combo_box_get_active_iter:
  * @combo_box: A #GtkComboBox
- * @iter: The uninitialized #GtkTreeIter
+ * @iter: (out): The uninitialized #GtkTreeIter
  * 
  * Sets @iter to point to the current active item, if it exists.
  * 
@@ -4866,10 +4985,10 @@ gtk_combo_box_get_active_iter (GtkComboBox     *combo_box,
 /**
  * gtk_combo_box_set_active_iter:
  * @combo_box: A #GtkComboBox
- * @iter: The #GtkTreeIter
+ * @iter: (allow-none): The #GtkTreeIter, or %NULL
  * 
- * Sets the current active item to be the one referenced by @iter
- * @iter must correspond to a path of depth one.
+ * Sets the current active item to be the one referenced by @iter, or
+ * unsets the active item if @iter is %NULL.
  * 
  * Since: 2.4
  */
@@ -4877,11 +4996,13 @@ void
 gtk_combo_box_set_active_iter (GtkComboBox     *combo_box,
                                GtkTreeIter     *iter)
 {
-  GtkTreePath *path;
+  GtkTreePath *path = NULL;
 
   g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
 
-  path = gtk_tree_model_get_path (gtk_combo_box_get_model (combo_box), iter);
+  if (iter)
+    path = gtk_tree_model_get_path (gtk_combo_box_get_model (combo_box), iter);
+
   gtk_combo_box_set_active_internal (combo_box, path);
   gtk_tree_path_free (path);
 }
@@ -4889,9 +5010,9 @@ gtk_combo_box_set_active_iter (GtkComboBox     *combo_box,
 /**
  * gtk_combo_box_set_model:
  * @combo_box: A #GtkComboBox
- * @model: A #GtkTreeModel
+ * @model: (allow-none): A #GtkTreeModel
  *
- * Sets the model used by @combo_box to be @model. Will unset a previously set 
+ * Sets the model used by @combo_box to be @model. Will unset a previously set
  * model (if applicable). If model is %NULL, then it will unset the model.
  *
  * Note that this function does not clear the cell renderers, you have to 
@@ -4913,25 +5034,25 @@ gtk_combo_box_set_model (GtkComboBox  *combo_box,
   gtk_combo_box_unset_model (combo_box);
 
   if (model == NULL)
-    return;
+    goto out;
 
   combo_box->priv->model = model;
   g_object_ref (combo_box->priv->model);
 
   combo_box->priv->inserted_id =
-    g_signal_connect (combo_box->priv->model, "row_inserted",
+    g_signal_connect (combo_box->priv->model, "row-inserted",
                      G_CALLBACK (gtk_combo_box_model_row_inserted),
                      combo_box);
   combo_box->priv->deleted_id =
-    g_signal_connect (combo_box->priv->model, "row_deleted",
+    g_signal_connect (combo_box->priv->model, "row-deleted",
                      G_CALLBACK (gtk_combo_box_model_row_deleted),
                      combo_box);
   combo_box->priv->reordered_id =
-    g_signal_connect (combo_box->priv->model, "rows_reordered",
+    g_signal_connect (combo_box->priv->model, "rows-reordered",
                      G_CALLBACK (gtk_combo_box_model_rows_reordered),
                      combo_box);
   combo_box->priv->changed_id =
-    g_signal_connect (combo_box->priv->model, "row_changed",
+    g_signal_connect (combo_box->priv->model, "row-changed",
                      G_CALLBACK (gtk_combo_box_model_row_changed),
                      combo_box);
       
@@ -4953,15 +5074,28 @@ gtk_combo_box_set_model (GtkComboBox  *combo_box,
   if (combo_box->priv->cell_view)
     gtk_cell_view_set_model (GTK_CELL_VIEW (combo_box->priv->cell_view),
                              combo_box->priv->model);
+
+  if (combo_box->priv->active != -1)
+    {
+      /* If an index was set in advance, apply it now */
+      gtk_combo_box_set_active (combo_box, combo_box->priv->active);
+      combo_box->priv->active = -1;
+    }
+
+out:
+  gtk_combo_box_update_sensitivity (combo_box);
+
+  g_object_notify (G_OBJECT (combo_box), "model");
 }
 
 /**
- * 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: A #GtkTreeModel which was passed during construction.
+ * Return value: (transfer none): A #GtkTreeModel which was passed
+ *     during construction.
  *
  * Since: 2.4
  */
@@ -4986,7 +5120,7 @@ gtk_combo_box_get_model (GtkComboBox *combo_box)
  * gtk_combo_box_insert_text(), gtk_combo_box_prepend_text() and
  * gtk_combo_box_remove_text().
  *
- * Return value: A new text combo box.
+ * Return value: (transfer none): A new text combo box.
  *
  * Since: 2.4
  */
@@ -5030,6 +5164,8 @@ gtk_combo_box_append_text (GtkComboBox *combo_box,
 
   g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
   g_return_if_fail (GTK_IS_LIST_STORE (combo_box->priv->model));
+  g_return_if_fail (gtk_tree_model_get_column_type (combo_box->priv->model, 0)
+                   == G_TYPE_STRING);
   g_return_if_fail (text != NULL);
 
   store = GTK_LIST_STORE (combo_box->priv->model);
@@ -5061,6 +5197,8 @@ gtk_combo_box_insert_text (GtkComboBox *combo_box,
   g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
   g_return_if_fail (GTK_IS_LIST_STORE (combo_box->priv->model));
   g_return_if_fail (position >= 0);
+  g_return_if_fail (gtk_tree_model_get_column_type (combo_box->priv->model, 0)
+                   == G_TYPE_STRING);
   g_return_if_fail (text != NULL);
 
   store = GTK_LIST_STORE (combo_box->priv->model);
@@ -5089,6 +5227,8 @@ gtk_combo_box_prepend_text (GtkComboBox *combo_box,
 
   g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
   g_return_if_fail (GTK_IS_LIST_STORE (combo_box->priv->model));
+  g_return_if_fail (gtk_tree_model_get_column_type (combo_box->priv->model, 0)
+                   == G_TYPE_STRING);
   g_return_if_fail (text != NULL);
 
   store = GTK_LIST_STORE (combo_box->priv->model);
@@ -5116,6 +5256,8 @@ gtk_combo_box_remove_text (GtkComboBox *combo_box,
 
   g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
   g_return_if_fail (GTK_IS_LIST_STORE (combo_box->priv->model));
+  g_return_if_fail (gtk_tree_model_get_column_type (combo_box->priv->model, 0)
+                   == G_TYPE_STRING);
   g_return_if_fail (position >= 0);
 
   store = GTK_LIST_STORE (combo_box->priv->model);
@@ -5131,10 +5273,11 @@ gtk_combo_box_remove_text (GtkComboBox *combo_box,
  *
  * Returns the currently active string in @combo_box or %NULL if none
  * is selected.  Note that you can only use this function with combo
- * boxes constructed with gtk_combo_box_new_text() and with 
+ * boxes constructed with gtk_combo_box_new_text() and with
  * #GtkComboBoxEntry<!-- -->s.
  *
  * Returns: a newly allocated string containing the currently active text.
+ *     Must be freed with g_free().
  *
  * Since: 2.6
  */
@@ -5148,7 +5291,7 @@ gtk_combo_box_get_active_text (GtkComboBox *combo_box)
   class = GTK_COMBO_BOX_GET_CLASS (combo_box);
 
   if (class->get_active_text)
-    return (* class->get_active_text) (combo_box);
+    return class->get_active_text (combo_box);
 
   return NULL;
 }
@@ -5160,6 +5303,8 @@ gtk_combo_box_real_get_active_text (GtkComboBox *combo_box)
   gchar *text = NULL;
 
   g_return_val_if_fail (GTK_IS_LIST_STORE (combo_box->priv->model), NULL);
+  g_return_val_if_fail (gtk_tree_model_get_column_type (combo_box->priv->model, 0)
+                        == G_TYPE_STRING, NULL);
 
   if (gtk_combo_box_get_active_iter (combo_box, &iter))
     gtk_tree_model_get (combo_box->priv->model, &iter, 
@@ -5272,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)
     {
@@ -5285,13 +5430,13 @@ gtk_combo_box_destroy (GtkObject *object)
   gtk_combo_box_popdown (combo_box);
 
   if (combo_box->priv->row_separator_destroy)
-    (* combo_box->priv->row_separator_destroy) (combo_box->priv->row_separator_data);
+    combo_box->priv->row_separator_destroy (combo_box->priv->row_separator_data);
 
   combo_box->priv->row_separator_func = NULL;
   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;
 }
 
@@ -5340,7 +5485,7 @@ gtk_combo_box_finalize (GObject *object)
       g_slist_free (info->attributes);
 
       g_object_unref (info->cell);
-      g_free (info);
+      g_slice_free (ComboCellInfo, info);
     }
    g_slist_free (combo_box->priv->cells);
 
@@ -5356,16 +5501,19 @@ gtk_cell_editable_key_press (GtkWidget   *widget,
 {
   GtkComboBox *combo_box = GTK_COMBO_BOX (data);
 
-  if (event->keyval == GDK_Escape)
+  if (event->keyval == GDK_KEY_Escape)
     {
-      combo_box->priv->editing_canceled = TRUE;
-
+      g_object_set (combo_box,
+                    "editing-canceled", TRUE,
+                    NULL);
       gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (combo_box));
       gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (combo_box));
       
       return TRUE;
     }
-  else if (event->keyval == GDK_Return)
+  else if (event->keyval == GDK_KEY_Return ||
+           event->keyval == GDK_KEY_ISO_Enter ||
+           event->keyval == GDK_KEY_KP_Enter)
     {
       gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (combo_box));
       gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (combo_box));
@@ -5412,7 +5560,9 @@ popup_idle (gpointer data)
                             combo_box, 0);
   
   /* we unset this if a menu item is activated */
-  combo_box->priv->editing_canceled = TRUE;
+  g_object_set (combo_box,
+                "editing-canceled", TRUE,
+                NULL);
   gtk_combo_box_popup (combo_box);
 
   combo_box->priv->popup_idle_id = 0;
@@ -5427,12 +5577,13 @@ gtk_combo_box_start_editing (GtkCellEditable *cell_editable,
                             GdkEvent        *event)
 {
   GtkComboBox *combo_box = GTK_COMBO_BOX (cell_editable);
+  GtkWidget *child;
 
   combo_box->priv->is_cell_renderer = TRUE;
 
   if (combo_box->priv->cell_view)
     {
-      g_signal_connect_object (combo_box->priv->button, "key_press_event",
+      g_signal_connect_object (combo_box->priv->button, "key-press-event",
                               G_CALLBACK (gtk_cell_editable_key_press), 
                               cell_editable, 0);  
 
@@ -5440,12 +5591,14 @@ gtk_combo_box_start_editing (GtkCellEditable *cell_editable,
     }
   else
     {
-      g_signal_connect_object (GTK_BIN (combo_box)->child, "key_press_event",
+      child = gtk_bin_get_child (GTK_BIN (combo_box));
+
+      g_signal_connect_object (child, "key-press-event",
                               G_CALLBACK (gtk_cell_editable_key_press), 
                               cell_editable, 0);  
 
-      gtk_widget_grab_focus (GTK_WIDGET (GTK_BIN (combo_box)->child));
-      GTK_WIDGET_UNSET_FLAGS (combo_box->priv->button, GTK_CAN_FOCUS);
+      gtk_widget_grab_focus (child);
+      gtk_widget_set_can_focus (combo_box->priv->button, FALSE);
     }
 
   /* we do the immediate popup only for the optionmenu-like 
@@ -5573,14 +5726,6 @@ gtk_combo_box_set_title (GtkComboBox *combo_box,
     }
 }
 
-gboolean
-_gtk_combo_box_editing_canceled (GtkComboBox *combo_box)
-{
-  g_return_val_if_fail (GTK_IS_COMBO_BOX (combo_box), TRUE);
-
-  return combo_box->priv->editing_canceled;
-}
-
 /**
  * gtk_combo_box_get_popup_accessible:
  * @combo_box: a #GtkComboBox
@@ -5590,7 +5735,8 @@ _gtk_combo_box_editing_canceled (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
  */
@@ -5632,8 +5778,8 @@ gtk_combo_box_get_row_separator_func (GtkComboBox *combo_box)
  * gtk_combo_box_set_row_separator_func:
  * @combo_box: a #GtkComboBox
  * @func: a #GtkTreeViewRowSeparatorFunc
- * @data: user data to pass to @func, or %NULL
- * @destroy: destroy notifier for @data, or %NULL
+ * @data: (allow-none): user data to pass to @func, or %NULL
+ * @destroy: (allow-none): destroy notifier for @data, or %NULL
  * 
  * Sets the row separator function, which is used to determine
  * whether a row should be drawn as a separator. If the row separator
@@ -5645,12 +5791,12 @@ void
 gtk_combo_box_set_row_separator_func (GtkComboBox                 *combo_box,
                                      GtkTreeViewRowSeparatorFunc  func,
                                      gpointer                     data,
-                                     GtkDestroyNotify             destroy)
+                                     GDestroyNotify               destroy)
 {
   g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
 
   if (combo_box->priv->row_separator_destroy)
-    (* combo_box->priv->row_separator_destroy) (combo_box->priv->row_separator_data);
+    combo_box->priv->row_separator_destroy (combo_box->priv->row_separator_data);
 
   combo_box->priv->row_separator_func = func;
   combo_box->priv->row_separator_data = data;
@@ -5665,6 +5811,55 @@ gtk_combo_box_set_row_separator_func (GtkComboBox                 *combo_box,
   gtk_widget_queue_draw (GTK_WIDGET (combo_box));
 }
 
+/**
+ * gtk_combo_box_set_button_sensitivity:
+ * @combo_box: a #GtkComboBox
+ * @sensitivity: specify the sensitivity of the dropdown button
+ *
+ * Sets whether the dropdown button of the combo box should be
+ * always sensitive (%GTK_SENSITIVITY_ON), never sensitive (%GTK_SENSITIVITY_OFF)
+ * or only if there is at least one item to display (%GTK_SENSITIVITY_AUTO).
+ *
+ * Since: 2.14
+ **/
+void
+gtk_combo_box_set_button_sensitivity (GtkComboBox        *combo_box,
+                                      GtkSensitivityType  sensitivity)
+{
+  g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
+
+  if (combo_box->priv->button_sensitivity != sensitivity)
+    {
+      combo_box->priv->button_sensitivity = sensitivity;
+      gtk_combo_box_update_sensitivity (combo_box);
+
+      g_object_notify (G_OBJECT (combo_box), "button-sensitivity");
+    }
+}
+
+/**
+ * gtk_combo_box_get_button_sensitivity:
+ * @combo_box: a #GtkComboBox
+ *
+ * Returns whether the combo box sets the dropdown button
+ * sensitive or not when there are no items in the model.
+ *
+ * Return Value: %GTK_SENSITIVITY_ON if the dropdown button
+ *    is sensitive when the model is empty, %GTK_SENSITIVITY_OFF
+ *    if the button is always insensitive or
+ *    %GTK_SENSITIVITY_AUTO if it is only sensitive as long as
+ *    the model has one item to be selected.
+ *
+ * Since: 2.14
+ **/
+GtkSensitivityType
+gtk_combo_box_get_button_sensitivity (GtkComboBox *combo_box)
+{
+  g_return_val_if_fail (GTK_IS_COMBO_BOX (combo_box), FALSE);
+
+  return combo_box->priv->button_sensitivity;
+}
+
 
 /**
  * gtk_combo_box_set_focus_on_click:
@@ -5751,5 +5946,361 @@ gtk_combo_box_buildable_custom_tag_end (GtkBuildable *buildable,
                                            data);
 }
 
-#define __GTK_COMBO_BOX_C__
-#include "gtkaliasdef.c"
+
+static void
+gtk_combo_box_remeasure (GtkComboBox *combo_box)
+{
+  GtkComboBoxPrivate *priv = combo_box->priv;
+  GtkTreeIter iter;
+  GtkTreePath *path;
+
+  if (!priv->model ||
+      !gtk_tree_model_get_iter_first (priv->model, &iter))
+    return;
+
+  priv->minimum_width = priv->natural_width = 0;
+
+  path = gtk_tree_path_new_from_indices (0, -1);
+
+  do
+    {
+      gint row_min = 0, row_nat = 0;
+
+      if (priv->cell_view)
+       gtk_cell_view_get_desired_width_of_row (GTK_CELL_VIEW (priv->cell_view), 
+                                               path, &row_min, &row_nat);
+
+      priv->minimum_width = MAX (priv->minimum_width, row_min);
+      priv->natural_width = MAX (priv->natural_width, row_nat);
+
+      gtk_tree_path_next (path);
+    }
+  while (gtk_tree_model_iter_next (priv->model, &iter));
+
+  gtk_tree_path_free (path);
+}
+
+
+static void
+gtk_combo_box_measure_height_for_width (GtkComboBox *combo_box,
+                                       gint         avail_width, 
+                                       gint        *min_height, 
+                                       gint        *nat_height)
+{
+  GtkWidget             *child;
+  GtkComboBoxPrivate    *priv = combo_box->priv;
+  GtkTreeIter            iter;
+  GtkTreePath           *path;
+  gint                   child_min, child_nat;
+
+  child = gtk_bin_get_child (GTK_BIN (combo_box));
+
+  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))
+    goto out;
+
+  path = gtk_tree_path_new_from_indices (0, -1);
+
+  do
+    {
+      gint row_min = 0, row_nat = 0;
+
+      if (priv->cell_view)
+       gtk_cell_view_get_desired_height_for_width_of_row (GTK_CELL_VIEW (priv->cell_view), 
+                                                          path, avail_width, 
+                                                          &row_min, &row_nat);
+
+      child_min = MAX (child_min, row_min);
+      child_nat = MAX (child_nat, row_nat);
+
+      gtk_tree_path_next (path);
+    }
+  while (gtk_tree_model_iter_next (priv->model, &iter));
+
+  gtk_tree_path_free (path);
+
+ out:
+
+  if (min_height)
+    *min_height = child_min;
+  if (nat_height)
+    *nat_height = child_nat;
+}
+
+
+static void     
+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;
+  GtkStyle              *style;
+  gint                   focus_width, focus_pad;
+  gint                   font_size, arrow_size;
+  PangoContext          *context;
+  PangoFontMetrics      *metrics;
+  PangoFontDescription  *font_desc;
+  GtkWidget             *child;
+  gint                   minimum_width, natural_width;
+  gint                   child_min, child_nat;
+
+  child = gtk_bin_get_child (GTK_BIN (widget));
+  /* common */
+  gtk_widget_get_preferred_width (child, &child_min, &child_nat);
+  gtk_combo_box_remeasure (combo_box);
+
+  child_min  = MAX (child_min,  priv->minimum_width);
+  child_nat  = MAX (child_nat,  priv->natural_width);
+
+  gtk_widget_style_get (GTK_WIDGET (widget),
+                       "focus-line-width", &focus_width,
+                       "focus-padding", &focus_pad,
+                       "arrow-size", &arrow_size,
+                       NULL);
+
+  font_desc = gtk_widget_get_style (child)->font_desc;
+  context = gtk_widget_get_pango_context (GTK_WIDGET (widget));
+  metrics = pango_context_get_metrics (context, font_desc,
+                                      pango_context_get_language (context));
+  font_size = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) +
+                           pango_font_metrics_get_descent (metrics));
+  pango_font_metrics_unref (metrics);
+
+  arrow_size = MAX (arrow_size, font_size);
+
+  gtk_widget_set_size_request (priv->arrow, arrow_size, arrow_size);
+
+  if (!priv->tree_view)
+    {
+      /* menu mode */
+         
+      if (priv->cell_view)
+        {
+          gint sep_width, arrow_width;
+          gint border_width, xthickness, xpad;
+
+         border_width = gtk_container_get_border_width (GTK_CONTAINER (combo_box));
+          xthickness   = gtk_widget_get_style (priv->button)->xthickness;
+
+          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);
+
+          minimum_width  = child_min + sep_width + arrow_width + xpad;
+          natural_width  = child_nat + sep_width + arrow_width + xpad;
+        }
+      else
+        {
+          gint 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;
+        }
+    }
+  else
+    {
+      /* list mode */
+      gint button_width, button_nat_width;
+
+      /* sample + frame */
+      minimum_width = child_min;
+      natural_width = child_nat;
+
+      minimum_width += 2 * focus_width;
+      natural_width += 2 * focus_width;
+      
+      if (priv->cell_view_frame)
+        {
+         if (priv->has_frame)
+           {
+             gint border_width = gtk_container_get_border_width (GTK_CONTAINER (priv->cell_view_frame));
+             gint xpad         = 2 * (border_width + gtk_widget_get_style (GTK_WIDGET (priv->cell_view_frame))->xthickness);
+
+             minimum_width  += xpad;
+             natural_width  += xpad;
+           }
+        }
+
+      /* the button */
+      gtk_widget_get_preferred_width (priv->button, 
+                                      &button_width, &button_nat_width);
+
+      minimum_width += button_width;
+      natural_width += button_nat_width;
+    }
+
+  if (GTK_SHADOW_NONE != priv->shadow_type)
+    {
+      style = gtk_widget_get_style (GTK_WIDGET (widget));
+
+      minimum_width  += 2 * style->xthickness;
+      natural_width  += 2 * style->xthickness;
+    }
+
+  if (minimum_size)
+    *minimum_size = minimum_width;
+
+  if (natural_size)
+    *natural_size = natural_width;
+}
+
+static void
+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_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_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_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, minimum_size, natural_size);
+}
+
+
+static void
+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;
+  GtkStyle              *style;
+  gint                   focus_width, focus_pad;
+  gint                   min_height, nat_height;
+  gint                   size;
+
+  gtk_widget_style_get (GTK_WIDGET (widget),
+                       "focus-line-width", &focus_width,
+                       "focus-padding", &focus_pad,
+                       NULL);
+
+  size = avail_size;
+
+  if (GTK_SHADOW_NONE != priv->shadow_type)
+    size -= gtk_widget_get_style (GTK_WIDGET (widget))->xthickness;
+
+  if (!priv->tree_view)
+    {
+      /* menu mode */
+      if (priv->cell_view)
+        {
+          GtkStyle *button_style;
+         /* calculate x/y padding and separator/arrow size */
+          gint sep_width, arrow_width, sep_height, arrow_height;
+          gint border_width, xthickness, ythickness, xpad, ypad;
+
+         border_width = gtk_container_get_border_width (GTK_CONTAINER (combo_box));
+          button_style = gtk_widget_get_style (priv->button);
+
+          xthickness = button_style->xthickness;
+          ythickness = button_style->ythickness;
+
+          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);
+
+         size -= sep_width + arrow_width + xpad;
+
+         gtk_combo_box_measure_height_for_width (combo_box, size, &min_height, &nat_height);
+
+         arrow_height = MAX (arrow_height, sep_height);
+         min_height = MAX (min_height, arrow_height);
+         nat_height = MAX (nat_height, arrow_height);
+
+         min_height += ypad;
+         nat_height += ypad;
+        }
+      else
+        {
+         /* there is a custom child widget inside (no priv->cell_view) */
+          gint but_width, but_height;
+
+          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;
+
+         gtk_combo_box_measure_height_for_width (combo_box, size, &min_height, &nat_height);
+         
+         min_height = MAX (min_height, but_height);
+         nat_height = MAX (nat_height, but_height);
+        }
+    }
+  else
+    {
+      /* list mode */
+      gint but_width, but_height;
+      gint xpad = 0, ypad = 0;
+
+      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)
+       {
+          GtkStyle *cell_style;
+         gint border_width;
+
+          border_width = gtk_container_get_border_width (GTK_CONTAINER (priv->cell_view_frame));
+          cell_style = gtk_widget_get_style (GTK_WIDGET (priv->cell_view_frame));
+
+         xpad = 2 * (border_width + cell_style->xthickness);
+         ypad = 2 * (border_width + cell_style->ythickness);
+       }
+
+      size -= but_width;
+      size -= 2 * focus_width;
+      size -= xpad;
+
+      gtk_combo_box_measure_height_for_width (combo_box, size, &min_height, &nat_height);
+         
+      min_height = MAX (min_height, but_height);
+      nat_height = MAX (nat_height, but_height);
+
+      min_height += ypad;
+      nat_height += ypad;
+    }
+
+  if (GTK_SHADOW_NONE != priv->shadow_type)
+    {
+      style = gtk_widget_get_style (GTK_WIDGET (widget));
+
+      min_height += 2 * style->ythickness;
+      nat_height += 2 * style->ythickness;
+    }
+
+  if (minimum_size)
+    *minimum_size = min_height;
+
+  if (natural_size)
+    *natural_size = nat_height;
+}