psppire-var-view.c: New function psppire_var_view_append_names_str
authorJohn Darrington <john@darrington.wattle.id.au>
Sun, 23 Dec 2012 11:49:06 +0000 (12:49 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Sun, 23 Dec 2012 16:19:29 +0000 (17:19 +0100)
src/ui/gui/psppire-var-view.c
src/ui/gui/psppire-var-view.h

index 5ef5b86dac3d706b6e2864b215d2dc1ef25b2d30..c71a5e66103e2821814972461c12b46e1de0aa5a 100644 (file)
@@ -21,6 +21,7 @@
 #include "psppire-var-ptr.h"
 #include "psppire-select-dest.h"
 
+#include <libpspp/str.h>
 #include <data/variable.h>
 
 #include <gettext.h>
@@ -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;
+}
+
+
+
index 090966b526bdbc830d5a48b905658e2ba97d0547..a8fb0565cab64fbcb2bfd1f0f902621451f99d70 100644 (file)
@@ -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);