gtk+ r21889 - in branches/gtk-2-14: . gtk
- From: matthiasc svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk+ r21889 - in branches/gtk-2-14: . gtk
- Date: Sat, 13 Dec 2008 08:13:01 +0000 (UTC)
Author: matthiasc
Date: Sat Dec 13 08:13:01 2008
New Revision: 21889
URL: http://svn.gnome.org/viewvc/gtk+?rev=21889&view=rev
Log:
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
Modified:
branches/gtk-2-14/ChangeLog
branches/gtk-2-14/gtk/gtkcombobox.c
Modified: branches/gtk-2-14/gtk/gtkcombobox.c
==============================================================================
--- branches/gtk-2-14/gtk/gtkcombobox.c (original)
+++ branches/gtk-2-14/gtk/gtkcombobox.c Sat Dec 13 08:13:01 2008
@@ -81,6 +81,7 @@
gint wrap_width;
GtkShadowType shadow_type;
+ gint active; /* Only temporary */
GtkTreeRowReference *active_row;
GtkWidget *tree_view;
@@ -928,6 +929,7 @@
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 @@
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_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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]