X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fdict-display.c;h=77da88bd98826c9791151af09edccc4de1d9b186;hb=df11254fddfd186f3d947c9891ab85eca20739ab;hp=160cdb2a1b8e635c4ad72a08892ca11edbddef9d;hpb=93b5d67c0fdc08137f308f332fede32543e7bc8e;p=pspp diff --git a/src/ui/gui/dict-display.c b/src/ui/gui/dict-display.c index 160cdb2a1b..77da88bd98 100644 --- a/src/ui/gui/dict-display.c +++ b/src/ui/gui/dict-display.c @@ -23,6 +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 @@ -151,5 +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 ; +} +