forked from AuroraMiddleware/gtk
Allow out-of-order setting of model and active. Patch by Christian Dywan
* gtk/gtkcombobox.c: Allow out-of-order setting of model and active. Patch by Christian Dywan svn path=/trunk/; revision=21888
This commit is contained in:
parent
856b37bb89
commit
4cf69fddb4
@ -1,3 +1,10 @@
|
||||
2008-12-13 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
Bug 555560 – gtk_combo_box_set_active fails with no model
|
||||
|
||||
* gtk/gtkcombobox.c: Allow out-of-order setting of model and active.
|
||||
Patch by Christian Dywan
|
||||
|
||||
2008-12-13 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
Bug 558306 – Cannot build gdk (gtk+ 2.14.4) on Solaris 8
|
||||
|
@ -81,6 +81,7 @@ struct _GtkComboBoxPrivate
|
||||
gint wrap_width;
|
||||
GtkShadowType shadow_type;
|
||||
|
||||
gint active; /* Only temporary */
|
||||
GtkTreeRowReference *active_row;
|
||||
|
||||
GtkWidget *tree_view;
|
||||
@ -928,6 +929,7 @@ gtk_combo_box_init (GtkComboBox *combo_box)
|
||||
priv->height = 0;
|
||||
priv->wrap_width = 0;
|
||||
|
||||
priv->active = -1;
|
||||
priv->active_row = NULL;
|
||||
priv->col_column = -1;
|
||||
priv->row_column = -1;
|
||||
@ -4839,6 +4841,13 @@ 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_;
|
||||
return;
|
||||
}
|
||||
|
||||
if (index_ != -1)
|
||||
path = gtk_tree_path_new_from_indices (index_, -1);
|
||||
|
||||
@ -5034,6 +5043,13 @@ gtk_combo_box_set_model (GtkComboBox *combo_box,
|
||||
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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user