X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fdict-display.c;h=77da88bd98826c9791151af09edccc4de1d9b186;hb=220a0c409390225346a8072917073e25a971e624;hp=ada7fb40fcbd5ab45ad55edca1c5508c5a4c8c07;hpb=21f2e65c7c2555bf5422920651eab07d1e8f5154;p=pspp diff --git a/src/ui/gui/dict-display.c b/src/ui/gui/dict-display.c index ada7fb40fc..77da88bd98 100644 --- a/src/ui/gui/dict-display.c +++ b/src/ui/gui/dict-display.c @@ -23,7 +23,10 @@ #include "dict-display.h" #include "psppire-dict.h" +#include "psppire-dictview.h" +#include "psppire-var-ptr.h" #include "psppire-var-view.h" +#include "psppire-select-dest.h" #include #include "helper.h" #include @@ -152,3 +155,33 @@ is_currently_in_entry (GtkTreeModel *model, GtkTreeIter *iter, return result; } +gboolean +is_currently_in_varview (GtkTreeModel *model, GtkTreeIter *iter, PsppireSelector *sel) +{ + gboolean ret = false; + + /* First, fetch the variable from the source */ + + PsppireDictView *dv = PSPPIRE_DICT_VIEW (sel->source); + + GtkTreePath *path = gtk_tree_model_get_path (model, iter); + + gint *idx = gtk_tree_path_get_indices (path); + + const struct variable *var = psppire_dict_get_variable (dv->dict, *idx); + + + /* Now test if that variable exists in the destination */ + + GValue value = {0}; + + g_value_init (&value, PSPPIRE_VAR_PTR_TYPE); + g_value_set_boxed (&value, var); + + ret = psppire_select_dest_widget_contains_var (PSPPIRE_SELECT_DEST_WIDGET (sel->dest), &value); + + g_value_unset (&value); + + return ret ; +} +