summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2006-12-27 07:17:53 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2006-12-27 07:17:53 +0000
commit8d286a7239b71571a6abcff9b101d50cdc2dc795 (patch)
tree1104b63f61e57bab6ac05b012eba47bb14e5cc45 /gtk
parentda91672d465004ab354326589eabd684ad4e44ea (diff)
downloadgdk-pixbuf-8d286a7239b71571a6abcff9b101d50cdc2dc795.tar.gz
Accept NULL.
2006-12-27 Matthias Clasen <mclasen@redhat.com> * gtk/gtkcellview.c (gtk_cell_view_set_model): Accept NULL. * gtk/gtkcombobox.c (gtk_combo_box_set_model): (gtk_combo_box_unset_model): Handle repeated unsetting of models without warnings. (#367529, Robert Ancell)
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkcellview.c2
-rw-r--r--gtk/gtkcombobox.c17
2 files changed, 7 insertions, 12 deletions
diff --git a/gtk/gtkcellview.c b/gtk/gtkcellview.c
index 89a60c348..405a8ba0a 100644
--- a/gtk/gtkcellview.c
+++ b/gtk/gtkcellview.c
@@ -874,7 +874,7 @@ gtk_cell_view_set_model (GtkCellView *cell_view,
GtkTreeModel *model)
{
g_return_if_fail (GTK_IS_CELL_VIEW (cell_view));
- g_return_if_fail (GTK_IS_TREE_MODEL (model));
+ g_return_if_fail (model == NULL || GTK_IS_TREE_MODEL (model));
if (cell_view->priv->model)
{
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index c9ab32293..23af2f8ae 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -2224,7 +2224,7 @@ gtk_combo_box_unset_model (GtkComboBox *combo_box)
}
if (combo_box->priv->cell_view)
- gtk_cell_view_set_displayed_row (GTK_CELL_VIEW (combo_box->priv->cell_view), NULL);
+ gtk_cell_view_set_model (GTK_CELL_VIEW (combo_box->priv->cell_view), NULL);
}
static void
@@ -4714,20 +4714,15 @@ gtk_combo_box_set_model (GtkComboBox *combo_box,
GtkTreeModel *model)
{
g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
-
- if (!model)
- {
- gtk_combo_box_unset_model (combo_box);
- return;
- }
-
- g_return_if_fail (GTK_IS_TREE_MODEL (model));
+ g_return_if_fail (model == NULL || GTK_IS_TREE_MODEL (model));
if (model == combo_box->priv->model)
return;
- if (combo_box->priv->model)
- gtk_combo_box_unset_model (combo_box);
+ gtk_combo_box_unset_model (combo_box);
+
+ if (model == NULL)
+ return;
combo_box->priv->model = model;
g_object_ref (combo_box->priv->model);