summaryrefslogtreecommitdiff
path: root/gtk/gtkcombobox.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2015-07-28 18:57:48 +0200
committerBenjamin Otte <otte@redhat.com>2015-07-31 04:03:44 +0200
commit62c43aac4399f60b41efcbf3c824d5d47dc2a652 (patch)
tree9bb2a1ad79671bf5d0565dd089a56f3eb7da7d05 /gtk/gtkcombobox.c
parentec338b0ab6a17e901e08f7ca88f25f64b520f591 (diff)
downloadgtk+-62c43aac4399f60b41efcbf3c824d5d47dc2a652.tar.gz
combobox: Create cell view identically
... in the two places it can be created.
Diffstat (limited to 'gtk/gtkcombobox.c')
-rw-r--r--gtk/gtkcombobox.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index a079158b2a..3d5545a5b4 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -1523,6 +1523,19 @@ gtk_combo_box_button_toggled (GtkWidget *widget,
}
static void
+gtk_combo_box_create_cell_view (GtkComboBox *combo_box)
+{
+ GtkComboBoxPrivate *priv = combo_box->priv;
+
+ priv->cell_view = gtk_cell_view_new_with_context (priv->area, NULL);
+ gtk_cell_view_set_fit_model (GTK_CELL_VIEW (priv->cell_view), TRUE);
+ gtk_cell_view_set_model (GTK_CELL_VIEW (priv->cell_view), priv->model);
+ gtk_widget_set_parent (priv->cell_view, GTK_WIDGET (combo_box));
+ _gtk_bin_set_child (GTK_BIN (combo_box), priv->cell_view);
+ gtk_widget_show (priv->cell_view);
+}
+
+static void
gtk_combo_box_add (GtkContainer *container,
GtkWidget *widget)
{
@@ -1618,16 +1631,7 @@ gtk_combo_box_remove (GtkContainer *container,
}
if (!priv->cell_view)
- {
- priv->cell_view = gtk_cell_view_new ();
- gtk_widget_set_parent (priv->cell_view, GTK_WIDGET (container));
- _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),
- priv->model);
- }
-
+ gtk_combo_box_create_cell_view (combo_box);
if (appears_as_list)
gtk_combo_box_list_setup (combo_box);
@@ -4556,7 +4560,6 @@ gtk_combo_box_format_entry_text (GtkComboBox *combo_box,
return text;
}
-
static void
gtk_combo_box_constructed (GObject *object)
{
@@ -4571,12 +4574,7 @@ gtk_combo_box_constructed (GObject *object)
g_object_ref_sink (priv->area);
}
- priv->cell_view = gtk_cell_view_new_with_context (priv->area, NULL);
- gtk_cell_view_set_fit_model (GTK_CELL_VIEW (priv->cell_view), TRUE);
- gtk_cell_view_set_model (GTK_CELL_VIEW (priv->cell_view), priv->model);
- gtk_widget_set_parent (priv->cell_view, GTK_WIDGET (combo_box));
- _gtk_bin_set_child (GTK_BIN (combo_box), priv->cell_view);
- gtk_widget_show (priv->cell_view);
+ gtk_combo_box_create_cell_view (combo_box);
gtk_combo_box_check_appearance (combo_box);