From 78ad55989777021c291440f5f2b3797d9f58a4f4 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Tue, 13 Nov 2012 19:37:07 +0100 Subject: [PATCH] Small refactoring and cleanup of psppire-selector.c Made explicit variables from some expressions. This provides the opportinutiy to test if they are valid. --- src/ui/gui/psppire-selector.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/ui/gui/psppire-selector.c b/src/ui/gui/psppire-selector.c index ef6e983cfe..194caf1b80 100644 --- a/src/ui/gui/psppire-selector.c +++ b/src/ui/gui/psppire-selector.c @@ -593,11 +593,11 @@ select_selection (PsppireSelector *selector) GtkTreeSelection* selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW (selector->source)); - GList *selected_rows = - gtk_tree_selection_get_selected_rows (selection, NULL); + GList *selected_rows = gtk_tree_selection_get_selected_rows (selection, NULL); - GtkTreeModel *childmodel = - gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (gtk_tree_view_get_model (GTK_TREE_VIEW (selector->source)))); + GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (selector->source)); + + GtkTreeModel *childmodel = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (model)); g_return_if_fail (selector->select_items); @@ -615,14 +615,12 @@ select_selection (PsppireSelector *selector) GtkTreeIter iter; GtkTreePath *path = item->data; - gtk_tree_model_get_iter (GTK_TREE_MODEL (gtk_tree_view_get_model (GTK_TREE_VIEW (selector->source))), - &iter, path); + g_return_if_fail (model); - gtk_tree_model_filter_convert_iter_to_child_iter - (GTK_TREE_MODEL_FILTER (gtk_tree_view_get_model (GTK_TREE_VIEW (selector->source))), - &child_iter, - &iter); + gtk_tree_model_get_iter (model, &iter, path); + gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (model), + &child_iter, &iter); selector->select_items (child_iter, selector->dest, childmodel, -- 2.30.2