The dictionary 'var_deleted' callback is the last chance to look at
a variable as it is getting deleted from a dictionary. For some of
the information in the variable, it legitimately doesn't make any
sense to get it from the variable itself at this point, e.g. the
index into the dictionary or the case, since it no longer is in
a dictionary. But for most of it, it's reasonable to get it from
the variable itself, but the callback doesn't provide any way to
do that, because it doesn't pass in the variable, just a dictionary
index that is no longer correct.
This commit changes the 'var_deleted' interface to pass in the
variable plus the information that can no longer be obtained from
the variable itself. An upcoming change to the GUI will make use
of this.
This commit also adapts all the existing users to the new interface.
{
int dict_index = var_get_dict_index (v);
const int case_index = var_get_case_index (v);
{
int dict_index = var_get_dict_index (v);
const int case_index = var_get_case_index (v);
- const int width = var_get_width (v);
assert (dict_contains_var (d, v));
assert (dict_contains_var (d, v));
/* Free memory. */
var_clear_vardict (v);
/* Free memory. */
var_clear_vardict (v);
if ( d->changed ) d->changed (d, d->changed_data);
invalidate_proto (d);
if (d->callbacks && d->callbacks->var_deleted )
if ( d->changed ) d->changed (d, d->changed_data);
invalidate_proto (d);
if (d->callbacks && d->callbacks->var_deleted )
- d->callbacks->var_deleted (d, dict_index, case_index, width, d->cb_data);
+ d->callbacks->var_deleted (d, v, dict_index, case_index, d->cb_data);
+
+ var_destroy (v);
}
/* Deletes the COUNT variables listed in VARS from D. This is
}
/* Deletes the COUNT variables listed in VARS from D. This is
struct dict_callbacks
{
void (*var_added) (struct dictionary *, int, void *);
struct dict_callbacks
{
void (*var_added) (struct dictionary *, int, void *);
- void (*var_deleted) (struct dictionary *, int, int, int, void *);
+ void (*var_deleted) (struct dictionary *, const struct variable *,
+ int dict_index, int case_index, void *);
void (*var_changed) (struct dictionary *, int, void *);
void (*var_resized) (struct dictionary *, int, int, void *);
void (*weight_changed) (struct dictionary *, int, void *);
void (*var_changed) (struct dictionary *, int, void *);
void (*var_resized) (struct dictionary *, int, int, void *);
void (*weight_changed) (struct dictionary *, int, void *);
VOID:BOXED,BOXED
VOID:INT,INT
VOID:INT,LONG
VOID:BOXED,BOXED
VOID:INT,INT
VOID:INT,LONG
VOID:INT,INT,INT,INT
VOID:INT,POINTER
VOID:OBJECT,OBJECT
VOID:INT,INT,INT,INT
VOID:INT,POINTER
VOID:OBJECT,OBJECT
/* PSPPIRE - a graphical user interface for PSPP.
/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-delete_variable_callback (PsppireDict *dict, gint posn,
- gint x UNUSED, gint y UNUSED, gpointer data)
+delete_variable_callback (PsppireDict *dict,
+ const struct variable *var UNUSED,
+ gint dict_idx, gint case_idx UNUSED, gpointer data)
{
PsppireDataEditor *de = PSPPIRE_DATA_EDITOR (data);
PsppireAxis *var_vaxis;
g_object_get (de->var_sheet, "vertical-axis", &var_vaxis, NULL);
{
PsppireDataEditor *de = PSPPIRE_DATA_EDITOR (data);
PsppireAxis *var_vaxis;
g_object_get (de->var_sheet, "vertical-axis", &var_vaxis, NULL);
- psppire_axis_delete (var_vaxis, posn, 1);
+ psppire_axis_delete (var_vaxis, dict_idx, 1);
- psppire_axis_delete (de->haxis, posn, 1);
+ psppire_axis_delete (de->haxis, dict_idx, 1);
/* PSPPIRE - a graphical user interface for PSPP.
/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2006, 2008, 2009, 2010 Free Software Foundation
+ Copyright (C) 2006, 2008, 2009, 2010, 2012 Free Software Foundation
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
A callback which occurs after a variable has been deleted.
*/
static void
A callback which occurs after a variable has been deleted.
*/
static void
-delete_variable_callback (GObject *obj, gint dict_index,
- gint case_index, gint width,
+delete_variable_callback (GObject *obj, const struct variable *var UNUSED,
+ gint dict_index, gint case_index,
gpointer data)
{
PsppireDataStore *store = PSPPIRE_DATA_STORE (data);
gpointer data)
{
PsppireDataStore *store = PSPPIRE_DATA_STORE (data);
G_SIGNAL_RUN_FIRST,
0,
NULL, NULL,
G_SIGNAL_RUN_FIRST,
0,
NULL, NULL,
- psppire_marshal_VOID__INT_INT_INT,
+ psppire_marshal_VOID__POINTER_INT_INT,
-delcb (struct dictionary *d, int dict_idx, int case_idx, int width, void *pd)
+delcb (struct dictionary *d, const struct variable *var,
+ int dict_idx, int case_idx, void *pd)
{
g_signal_emit (pd, signals [VARIABLE_DELETED], 0,
{
g_signal_emit (pd, signals [VARIABLE_DELETED], 0,
- dict_idx, case_idx, width );
+ var, dict_idx, case_idx);
/* PSPPIRE - a graphical user interface for PSPP.
/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2006, 2009, 2010, 2011 Free Software Foundation
+ Copyright (C) 2006, 2009, 2010, 2011, 2012 Free Software Foundation
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-var_delete_callback (GtkWidget *w, gint dict_idx, gint case_idx, gint val_cnt, gpointer data)
+var_delete_callback (GtkWidget *w, const struct variable *var UNUSED,
+ gint dict_idx, gint case_idx UNUSED, gpointer data)
{
PsppireSheetModel *model = PSPPIRE_SHEET_MODEL (data);
{
PsppireSheetModel *model = PSPPIRE_SHEET_MODEL (data);