From: John Darrington Date: Sun, 23 Dec 2012 11:49:06 +0000 (+0100) Subject: psppire-var-view.c: New function psppire_var_view_append_names_str X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7fbadad9d6d9cad8805cafdd9ea157e753029ea0;p=pspp psppire-var-view.c: New function psppire_var_view_append_names_str --- diff --git a/src/ui/gui/psppire-var-view.c b/src/ui/gui/psppire-var-view.c index 5ef5b86dac..c71a5e6610 100644 --- a/src/ui/gui/psppire-var-view.c +++ b/src/ui/gui/psppire-var-view.c @@ -21,6 +21,7 @@ #include "psppire-var-ptr.h" #include "psppire-select-dest.h" +#include #include #include @@ -400,3 +401,33 @@ psppire_var_view_append_names (PsppireVarView *vv, gint column, GString *string) return n_vars; } + + +/* + Append the names of selected variables to STR + Returns the number of variables appended. +*/ +gint +psppire_var_view_append_names_str (PsppireVarView *vv, gint column, struct string *str) +{ + gint n_vars = 0; + GtkTreeIter iter; + + if ( psppire_var_view_get_iter_first (vv, &iter) ) + { + do + { + const struct variable *var = psppire_var_view_get_variable (vv, column, &iter); + ds_put_cstr (str, " "); + ds_put_cstr (str, var_get_name (var)); + + n_vars++; + } + while (psppire_var_view_get_iter_next (vv, &iter)); + } + + return n_vars; +} + + + diff --git a/src/ui/gui/psppire-var-view.h b/src/ui/gui/psppire-var-view.h index 090966b526..a8fb0565ca 100644 --- a/src/ui/gui/psppire-var-view.h +++ b/src/ui/gui/psppire-var-view.h @@ -64,6 +64,8 @@ struct _PsppireVarViewClass GType psppire_var_view_get_type (void); gint psppire_var_view_append_names (PsppireVarView *vv, gint column, GString *string); +struct string; +gint psppire_var_view_append_names_str (PsppireVarView *vv, gint column, struct string *); gboolean psppire_var_view_get_iter_first (PsppireVarView *vv, GtkTreeIter *iter);