projects
/
pspp-builds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge commit 'origin/stable'
[pspp-builds.git]
/
src
/
ui
/
gui
/
dialog-common.c
diff --git
a/src/ui/gui/dialog-common.c
b/src/ui/gui/dialog-common.c
index c6832df4d05d4b783200f6a5e33bdd33fae463f2..5d52204ce566ad89cdb1807adda7be338bf846e5 100644
(file)
--- a/
src/ui/gui/dialog-common.c
+++ b/
src/ui/gui/dialog-common.c
@@
-15,18
+15,23
@@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
+
+#include <libpspp/i18n.h>
#include "dialog-common.h"
#include "dialog-common.h"
+#include "psppire-var-ptr.h"
+
#include "helper.h"
/* Append the names of selected variables to STRING.
TREEVIEW is the treeview containing the variables.
#include "helper.h"
/* Append the names of selected variables to STRING.
TREEVIEW is the treeview containing the variables.
+ COLUMN is the column in the treeview containing the variables.
DICT is the dictionary for those variables.
*/
gint
append_variable_names (GString *string,
DICT is the dictionary for those variables.
*/
gint
append_variable_names (GString *string,
- PsppireDict *dict, GtkTreeView *treeview)
+ PsppireDict *dict, GtkTreeView *treeview
, gint column
)
{
gint n_vars = 0;
GtkTreeIter iter;
{
gint n_vars = 0;
GtkTreeIter iter;
@@
-39,12
+44,23
@@
append_variable_names (GString *string,
do
{
GValue value = {0};
do
{
GValue value = {0};
- struct variable *var;
+ struct variable *var
= NULL
;
GtkTreePath *path = gtk_tree_model_get_path (list_store, &iter);
GtkTreePath *path = gtk_tree_model_get_path (list_store, &iter);
- gtk_tree_model_get_value (list_store, &iter,
0
, &value);
+ gtk_tree_model_get_value (list_store, &iter,
column
, &value);
+ /* FIXME: G_TYPE_INT should be deprecated.
+ As well as being simpler, it'd be unecessary to pass dict */
+ if ( G_VALUE_TYPE (&value) == G_TYPE_INT )
var = psppire_dict_get_variable (dict, g_value_get_int (&value));
var = psppire_dict_get_variable (dict, g_value_get_int (&value));
+
+ else if ( G_VALUE_TYPE (&value) == PSPPIRE_VAR_PTR_TYPE)
+ var = g_value_get_boxed (&value);
+
+ else
+ g_critical ("Unsupported type \"%s\", in variable name treeview.",
+ G_VALUE_TYPE_NAME (&value));
+
g_value_unset (&value);
g_string_append (string, " ");
g_value_unset (&value);
g_string_append (string, " ");
@@
-98,14
+114,9
@@
cell_var_name (GtkTreeViewColumn *tree_column,
gpointer data)
{
PsppireDict *dict = data;
gpointer data)
{
PsppireDict *dict = data;
- struct variable *var;
- gchar *name;
-
- var = get_selected_variable (tree_model, iter, dict);
+ const struct variable *var = get_selected_variable (tree_model, iter, dict);
- name = pspp_locale_to_utf8 (var_get_name (var), -1, NULL);
- g_object_set (cell, "text", name, NULL);
- g_free (name);
+ g_object_set (cell, "text", var_get_name (var), NULL);
}
}
@@
-178,16
+189,15
@@
homogeneous_types (GtkWidget *source, GtkWidget *dest)
for (l = list; l ; l = l->next)
{
GtkTreePath *path = l->data;
for (l = list; l ; l = l->next)
{
GtkTreePath *path = l->data;
- GtkTreePath *fpath;
- gint *idx;
- const struct variable *v;
+ GtkTreePath *fpath =
+ gtk_tree_model_filter_convert_path_to_child_path (GTK_TREE_MODEL_FILTER (model), path);
-
fpath = gtk_tree_model_filter_convert_path_to_child_path (GTK_TREE_MODEL_FILTER (model),
path);
+
gint *idx = gtk_tree_path_get_indices (f
path);
-
idx = gtk_tree_path_get_indices (fpath
);
+
const struct variable *v = psppire_dict_get_variable (dict, idx[0]
);
-
v = psppire_dict_get_variable (dict, idx[0]
);
+
gtk_tree_path_free (fpath
);
if ( type != -1 )
{
if ( type != -1 )
{
@@
-242,8
+252,6
@@
homogeneous_types (GtkWidget *source, GtkWidget *dest)
gboolean
numeric_only (GtkWidget *source, GtkWidget *dest)
{
gboolean
numeric_only (GtkWidget *source, GtkWidget *dest)
{
- gboolean ok;
- GtkTreeIter iter;
gboolean retval = TRUE;
GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (source));
gboolean retval = TRUE;
GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (source));
@@
-267,17
+275,14
@@
numeric_only (GtkWidget *source, GtkWidget *dest)
for (l = list; l ; l = l->next)
{
GtkTreePath *path = l->data;
for (l = list; l ; l = l->next)
{
GtkTreePath *path = l->data;
- GtkTreePath *fpath;
- gint *idx;
-
- const struct variable *v;
-
- fpath = gtk_tree_model_filter_convert_path_to_child_path
+ GtkTreePath *fpath = gtk_tree_model_filter_convert_path_to_child_path
(GTK_TREE_MODEL_FILTER (model), path);
(GTK_TREE_MODEL_FILTER (model), path);
- idx = gtk_tree_path_get_indices (fpath);
+ gint *idx = gtk_tree_path_get_indices (fpath);
+
+ const struct variable *v = psppire_dict_get_variable (dict, idx[0]);
-
v = psppire_dict_get_variable (dict, idx[0]
);
+
gtk_tree_path_free (fpath
);
if ( var_is_alpha (v))
{
if ( var_is_alpha (v))
{