value_destroy (&act->cut_point, width);
value_destroy (&act->grp_val[0], width);
value_destroy (&act->grp_val[1], width);
+ var_unref (act->grp_var);
act->grp_var = NULL;
act->grp_var_width = -1;
}
{
gboolean result = FALSE;
- if (var)
+ if (var)
{
union value val;
const int width = var_get_width (var);
if (psppire_value_entry_get_value (ve, &val, width))
{
- if (var_is_value_missing (var, &val, MV_SYSTEM))
+ if (var_is_value_missing (var, &val) == MV_SYSTEM)
{
result = TRUE;
}
PsppireDialogAction *da = PSPPIRE_DIALOG_ACTION (act);
GtkWidget *parent1 = gtk_widget_get_parent (act->dg_table1);
GtkWidget *parent2 = gtk_widget_get_parent (act->dg_table2);
-
+
g_return_if_fail (act->grp_var);
-
+
if (parent1)
gtk_container_remove (GTK_CONTAINER (parent1), act->dg_table1);
psppire_value_entry_set_variable (PSPPIRE_VALUE_ENTRY (act->dg_grp_entry[1]), act->grp_var);
psppire_value_entry_set_variable (PSPPIRE_VALUE_ENTRY (act->dg_cut_point_entry), act->grp_var);
- if (act->group_defn != GROUPS_CUT_POINT )
+ if (act->group_defn != GROUPS_CUT_POINT)
{
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (act->dg_cut_point_toggle_button), TRUE);
PsppireDialogAction *da = PSPPIRE_DIALOG_ACTION (act);
const gchar *text = gtk_entry_get_text (entry);
- const struct variable *v = da->dict ? psppire_dict_lookup_var (da->dict, text) : NULL;
+ struct variable *v = da->dict ? psppire_dict_lookup_var (da->dict, text) : NULL;
gtk_widget_set_sensitive (act->define_groups_button, v != NULL);
}
else
{
- value_str_rw (&act->cut_point, width)[0] = '\0';
- value_str_rw (&act->grp_val[0], width)[0] = '\0';
- value_str_rw (&act->grp_val[1], width)[0] = '\0';
+ act->cut_point.s[0] = '\0';
+ act->grp_val[0].s[0] = '\0';
+ act->grp_val[1].s[0] = '\0';
}
}
- act->grp_var = v;
+ struct variable *old_grp_var = act->grp_var;
+ if (v)
+ act->grp_var = var_ref (v);
+ if (old_grp_var)
+ var_unref (old_grp_var);
act->grp_var_width = v ? var_get_width (v) : -1;
}
}
-static void
-psppire_dialog_action_indep_samps_activate (PsppireDialogAction *a)
+static GtkBuilder *
+psppire_dialog_action_indep_samps_activate (PsppireDialogAction *a, GVariant *param)
{
PsppireDialogActionIndepSamps *act = PSPPIRE_DIALOG_ACTION_INDEP_SAMPS (a);
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
- GHashTable *thing = psppire_dialog_action_get_hash_table (pda);
- GtkBuilder *xml = g_hash_table_lookup (thing, a);
- if (!xml)
- {
- xml = builder_new ("indep-samples.ui");
- g_hash_table_insert (thing, a, xml);
- }
+ GtkBuilder *xml = builder_new ("indep-samples.ui");
- pda->dialog = get_widget_assert (xml,"independent-samples-dialog");
+ pda->dialog = get_widget_assert (xml,"independent-samples-dialog");
pda->source = get_widget_assert (xml, "indep-samples-treeview1");
act->define_groups_button = get_widget_assert (xml, "define-groups-button");
act->options_button = get_widget_assert (xml, "indep-samples-options-button");
G_CALLBACK (on_grp_var_change), act);
on_grp_var_change (GTK_ENTRY (act->group_var_entry), act);
+
+ return xml;
}
g_string_append (str, "(");
{
- const union value *val =
+ const union value *val =
(act->group_defn == GROUPS_VALUES) ?
&act->grp_val[0] :
&act->cut_point;
- struct string strx;
+ struct string strx;
ds_init_empty (&strx);
syntax_gen_value (&strx, val, var_get_width (act->grp_var),
var_get_print_format (act->grp_var));
-
+
g_string_append (str, ds_cstr (&strx));
ds_destroy (&strx);
}
{
struct string strx;
ds_init_empty (&strx);
-
+
syntax_gen_value (&strx, &act->grp_val[1], var_get_width (act->grp_var),
var_get_print_format (act->grp_var));
-
+
g_string_append (str, ds_cstr (&strx));
ds_destroy (&strx);
}
static void
psppire_dialog_action_indep_samps_class_init (PsppireDialogActionIndepSampsClass *class)
{
- psppire_dialog_action_set_activation (class, psppire_dialog_action_indep_samps_activate);
+ PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_indep_samps_activate;
PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax;
}