Esempio n. 1
0
/* Pops up the Ks_One_Sample dialog box */
void
ks_one_sample_dialog (PsppireDataWindow *dw)
{
  struct ks_one_sample fd;
  gint response;

  PsppireVarStore *vs;

  GtkWidget *dialog ;
  GtkWidget *source ;

  fd.xml = builder_new ("ks-one-sample.ui");

  dialog = get_widget_assert   (fd.xml, "ks-one-sample-dialog");
  source = get_widget_assert   (fd.xml, "dict-view");

  fd.cb[CB_NORMAL] = get_widget_assert (fd.xml, "checkbutton-normal");
  fd.cb[CB_POISSON] = get_widget_assert (fd.xml, "checkbutton-poisson");
  fd.cb[CB_UNIFORM] = get_widget_assert (fd.xml, "checkbutton-uniform");
  fd.cb[CB_EXPONENTIAL] = get_widget_assert (fd.xml, "checkbutton-exp");

  fd.de = dw;

  g_signal_connect_swapped (dialog, "refresh", G_CALLBACK (refresh),  &fd);


  fd.variables = get_widget_assert   (fd.xml, "psppire-var-view1");

  g_object_get (fd.de->data_editor, "var-store", &vs, NULL);

  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (fd.de));

  g_object_get (vs, "dictionary", &fd.dict, NULL);
  g_object_set (source, "model", fd.dict,
		"predicate", var_is_numeric,
		NULL);

  psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (dialog),
				      dialog_state_valid, &fd);

  response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));

  switch (response)
    {
    case GTK_RESPONSE_OK:
      g_free (execute_syntax_string (dw, generate_syntax (&fd)));
      break;
    case PSPPIRE_RESPONSE_PASTE:
      g_free (paste_syntax_to_window (generate_syntax (&fd)));
      break;
    default:
      break;
    }

  g_object_unref (fd.xml);
}
Esempio n. 2
0
void
transpose_dialog (PsppireDataWindow *de)
{
  gint response ;
  PsppireDict *dict = NULL;

  GtkBuilder *xml = builder_new ("psppire.ui");

  PsppireVarStore *vs = NULL;

  GtkWidget *dialog = get_widget_assert (xml, "transpose-dialog");
  GtkWidget *source = get_widget_assert (xml, "source-treeview");
  GtkWidget *selector2 = get_widget_assert (xml, "psppire-selector3");

  g_object_get (de->data_editor, "var-store", &vs, NULL);

  g_object_get (vs, "dictionary", &dict, NULL);
  g_object_set (source, "model", dict, NULL);

  psppire_selector_set_filter_func (PSPPIRE_SELECTOR (selector2),
				 is_currently_in_entry);


  g_signal_connect (dialog, "refresh", G_CALLBACK (refresh),  xml);

  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));

  psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (dialog),
				      dialog_state_valid, xml);

  response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));

  switch (response)
    {
    case GTK_RESPONSE_OK:
      g_free (execute_syntax_string (de, generate_syntax (dict, xml)));
      break;
    case PSPPIRE_RESPONSE_PASTE:
      {
	gchar *syntax = generate_syntax (dict, xml);
        paste_syntax_to_window (syntax);

	g_free (syntax);
      }
      break;
    default:
      break;
    }

  g_object_unref (xml);
}
static void
run_opts_dialog (PsppireDialogActionExamine *ed)
{
  gint response;

  switch (ed->opts)
    {
    case OPT_LISTWISE:
      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ed->listwise), TRUE);
      break;
    case OPT_PAIRWISE:
      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ed->pairwise), TRUE);
      break;
    case OPT_REPORT:
      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ed->report), TRUE);
      break;
    default:
      g_assert_not_reached ();
      break;
    };

  response = psppire_dialog_run (PSPPIRE_DIALOG (ed->opts_dialog));

  if ( response == PSPPIRE_RESPONSE_CONTINUE )
    {
      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ed->listwise)))
	ed->opts = OPT_LISTWISE;
      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ed->pairwise)))
	ed->opts = OPT_PAIRWISE;
      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ed->report)))
	ed->opts = OPT_REPORT;
  }
}
static void
run_stats_dialog (PsppireDialogActionExamine *ed)
{
  gint response;

  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ed->descriptives_button),
				ed->stats & STAT_DESCRIPTIVES);

  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ed->extremes_button),
				ed->stats & STAT_EXTREMES);

  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ed->percentiles_button),
				ed->stats & STAT_PERCENTILES);

  response = psppire_dialog_run (PSPPIRE_DIALOG (ed->stats_dialog));

  if ( response == PSPPIRE_RESPONSE_CONTINUE )
    {
      ed->stats = 0;
      if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ed->descriptives_button) ))
	ed->stats |= STAT_DESCRIPTIVES;

      if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ed->extremes_button) ))
	ed->stats |= STAT_EXTREMES;

      if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ed->percentiles_button) ))
	ed->stats |= STAT_PERCENTILES;
    }
}
Esempio n. 5
0
static void
on_format_clicked (struct crosstabs_dialog *cd)
{
  int ret;

  if (cd->current_opts.avalue)
    {
      gtk_toggle_button_set_active (cd->avalue, TRUE);
    }
  if (cd->current_opts.table)
    {
      gtk_toggle_button_set_active (cd->table_button, TRUE);
    }
  if (cd->current_opts.pivot)
    {
      gtk_toggle_button_set_active (cd->pivot_button, TRUE);
    }

  ret = psppire_dialog_run (PSPPIRE_DIALOG (cd->format_dialog));

  if ( ret == PSPPIRE_RESPONSE_CONTINUE )
    {
      cd->current_opts.avalue = (gtk_toggle_button_get_active (cd->avalue) == TRUE ) 
	? TRUE : FALSE;
      cd->current_opts.table = (gtk_toggle_button_get_active (cd->table_button) == TRUE)
	? TRUE : FALSE;
      cd->current_opts.pivot = (gtk_toggle_button_get_active (cd->pivot_button) == TRUE)
	? TRUE : FALSE;
    }
}
Esempio n. 6
0
static void
psppire_dialog_get_property (GObject         *object,
			     guint            prop_id,
			     GValue          *value,
			     GParamSpec      *pspec)
{
  PsppireDialog *dialog = PSPPIRE_DIALOG (object);

  switch (prop_id)
    {
    case PROP_ORIENTATION:
      {
	if ( GTK_IS_VBOX (dialog->box) || GTK_VPANED (dialog->box))
	  g_value_set_enum (value, PSPPIRE_VERTICAL);
	else if ( GTK_IS_HBOX (dialog->box) || GTK_HPANED (dialog->box))
	  g_value_set_enum (value, PSPPIRE_HORIZONTAL);
	else if ( GTK_IS_TABLE (dialog->box))
	  g_value_set_enum (value, PSPPIRE_TABULAR);
      }
      break;
    case PROP_SLIDING:
      g_value_set_boolean (value, dialog->slidable);
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
    };
}
Esempio n. 7
0
static void
run_old_and_new_dialog (struct recode_dialog *rd)
{
  gint response;
  GtkListStore *local_store = clone_list_store (rd->value_map);

  psppire_acr_set_model (rd->acr, local_store);
  psppire_acr_set_get_value_func (rd->acr, set_value, rd);

  gtk_window_set_title (GTK_WINDOW (rd->old_and_new_dialog),
			rd->different
			? _("Recode into Different Variables: Old and New Values ")
			: _("Recode into Same Variables: Old and New Values")
			);


  {
    /* Find the type of the first variable (it's invariant that
       all variables are of the same type) */
    const struct variable *v;
    GtkTreeIter iter;
    GtkTreeModel *model =
      gtk_tree_view_get_model (GTK_TREE_VIEW (rd->variable_treeview));

    gboolean not_empty = gtk_tree_model_get_iter_first (model, &iter);

    g_return_if_fail (not_empty);

    gtk_tree_model_get (model, &iter, 0, &v, -1);

    rd->input_var_is_string = var_is_alpha (v);

    g_object_set (rd->old_value_chooser, "is-string", rd->input_var_is_string, NULL);

    gtk_widget_set_sensitive (rd->toggle [BUTTON_NEW_SYSMIS],
			      var_is_numeric (v));

    gtk_widget_set_sensitive (rd->convert_button, var_is_alpha (v));
  }


  response = psppire_dialog_run (rd->old_and_new_dialog);
  psppire_acr_set_model (rd->acr, NULL);


  if ( response == PSPPIRE_RESPONSE_CONTINUE )
    {
      g_object_unref (rd->value_map);
      rd->value_map = clone_list_store (local_store);
    }
  else
    g_object_unref (local_store);


  psppire_dialog_notify_change (PSPPIRE_DIALOG (rd->dialog));
}
Esempio n. 8
0
static void
run_type_label_dialog (GtkButton *b, gpointer data)
{
  struct compute_dialog *cd = data;
  gint response;

  GtkWidget *subdialog = get_widget_assert (cd->xml, "type-and-label-dialog");
  GtkWidget *dialog = get_widget_assert (cd->xml, "compute-variable-dialog");

  gtk_window_set_transient_for (GTK_WINDOW (subdialog), GTK_WINDOW (dialog));

  reset_type_label_dialog (cd);
  response = psppire_dialog_run (PSPPIRE_DIALOG (subdialog));
  if ( response == PSPPIRE_RESPONSE_CONTINUE)
    cd->use_type = TRUE;
}
static void
on_statistics_clicked (PsppireDialogActionCrosstabs *cd)
{
  GtkListStore *liststore = clone_list_store (GTK_LIST_STORE (cd->stat));

  gint ret = psppire_dialog_run (PSPPIRE_DIALOG (cd->stat_dialog));

  if ( ret == PSPPIRE_RESPONSE_CONTINUE )
    {
      g_object_unref (liststore);
    }
  else
    {
      gtk_tree_view_set_model (GTK_TREE_VIEW (cd->stat_view) , GTK_TREE_MODEL (liststore));
      cd->stat = GTK_TREE_MODEL (liststore);
    }
}
Esempio n. 10
0
struct paired_samples_dialog *
two_sample_dialog_create (PsppireDataWindow *de)
{
  GtkWidget *dict_view ;
  GtkWidget *selector ;
  struct paired_samples_dialog *tt_d = g_malloc (sizeof *tt_d);

  PsppireVarStore *vs = NULL;

  tt_d->xml = builder_new ("paired-samples.ui");

  dict_view = get_widget_assert (tt_d->xml, "paired-samples-t-test-treeview1");

  selector = get_widget_assert (tt_d->xml, "psppire-selector3");

  tt_d->dialog = get_widget_assert (tt_d->xml, "t-test-paired-samples-dialog");

  g_object_get (de->data_editor, "var-store", &vs, NULL);

  g_object_get (vs, "dictionary", &tt_d->dict, NULL);
  tt_d->pairs_treeview =
   get_widget_assert (tt_d->xml, "paired-samples-t-test-treeview2");

  gtk_window_set_transient_for (GTK_WINDOW (tt_d->dialog), GTK_WINDOW (de));


  g_object_set (dict_view, "model", tt_d->dict,
		"predicate",
		var_is_numeric, NULL);

  
  tt_d->list_store = gtk_tree_view_get_model (GTK_TREE_VIEW (tt_d->pairs_treeview));

  psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector),
				    select_as_pair_member,
				    tt_d);

  g_signal_connect_swapped (tt_d->dialog, "refresh",
			    G_CALLBACK (refresh),  tt_d);

  psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (tt_d->dialog),
				      dialog_state_valid, tt_d);

  return tt_d;
}
Esempio n. 11
0
void
glade_psppire_dialog_post_create (GladeWidgetAdaptor *adaptor,
				  GObject            *object,
				  GladeCreateReason   reason)
{
  GladeWidget *widget ;

  GladeWidget  *box_widget;

  PsppireDialog    *dialog = PSPPIRE_DIALOG (object);

  g_return_if_fail (PSPPIRE_IS_DIALOG (dialog));

  widget = glade_widget_get_from_gobject (GTK_WIDGET (dialog));
  if (!widget)
    return;


  if (reason == GLADE_CREATE_USER)
    {
      /* HIG compliant border-width defaults on dialogs */
      glade_widget_property_set (widget, "border-width", 5);
    }

  box_widget = glade_widget_adaptor_create_internal
    (widget, G_OBJECT(dialog->box),
     "hbox", "dialog", FALSE, reason);

  /* These properties are controlled by the GtkDialog style properties:
   * "content-area-border", "button-spacing" and "action-area-border",
   * so we must disable their use.
   */
  glade_widget_remove_property (box_widget, "border-width");

  /* Only set these on the original create. */
  if (reason == GLADE_CREATE_USER)
    {

      /* HIG compliant spacing defaults on dialogs */
      glade_widget_property_set (box_widget, "spacing", 2);

      glade_widget_property_set (box_widget, "size", 2);

    }
}
Esempio n. 12
0
static void
range_subdialog (GtkButton *b, gpointer data)
{
  gint response;
  struct select_cases_dialog *scd = data;

  gint n_cases = psppire_data_store_get_case_count (scd->data_store);

  GtkWidget *parent_dialog = get_widget_assert (scd->xml,
						"select-cases-dialog");

  GtkWidget *dialog = get_widget_assert (scd->xml,
					 "select-cases-range-dialog");

  GtkWidget *first = get_widget_assert (scd->xml,
					"range-dialog-first");

  GtkWidget *last = get_widget_assert (scd->xml,
					"range-dialog-last");


  gtk_spin_button_set_range (GTK_SPIN_BUTTON (last),  1,  n_cases);
  gtk_spin_button_set_range (GTK_SPIN_BUTTON (first), 1,  n_cases);

  gtk_window_set_transient_for (GTK_WINDOW (dialog),
				GTK_WINDOW (parent_dialog));


  response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
  if ( response == PSPPIRE_RESPONSE_CONTINUE)
    {
      GtkWidget *first = get_widget_assert (scd->xml, "range-dialog-first");
      GtkWidget *last = get_widget_assert (scd->xml, "range-dialog-last");
      GtkWidget *l1 = get_widget_assert (scd->xml, "range-sample-label");
      gchar *text = widget_printf (_("%d thru %d"), first, last);

      gtk_label_set_text (GTK_LABEL (l1), text);

      g_free (text);
    }
}
Esempio n. 13
0
static void
on_cell_clicked (struct crosstabs_dialog *cd)
{
  GtkListStore *liststore;
  int ret;

  liststore = clone_list_store (GTK_LIST_STORE (cd->cell));

  ret = psppire_dialog_run (PSPPIRE_DIALOG (cd->cell_dialog));

  if ( ret == PSPPIRE_RESPONSE_CONTINUE )
    {
      g_object_unref (liststore);
    }
  else
    {
      g_object_unref (cd->cell);
      gtk_tree_view_set_model (GTK_TREE_VIEW (cd->cell_view) , GTK_TREE_MODEL (liststore));
      cd->cell = GTK_TREE_MODEL (liststore);
    }
}
Esempio n. 14
0
/* Pops up the dialog box */
void
t_test_paired_samples_dialog (PsppireDataWindow *de)
{
    gint response;
    struct paired_samples_dialog *tt_d = two_sample_dialog_create (de);
    struct tt_options_dialog *opts = tt_options_dialog_create (GTK_WINDOW (de));

    GtkWidget *bb = gtk_hbutton_box_new ();
    GtkWidget *opt = gtk_button_new_with_mnemonic (_("_Options"));
    gtk_box_pack_start (GTK_BOX (bb), opt, TRUE, TRUE, 5);

    gtk_widget_show_all (bb);
    two_sample_dialog_add_widget (tt_d, bb);

    g_signal_connect_swapped (opt, "clicked", G_CALLBACK (tt_options_dialog_run), opts);

    tt_d->refresh = refresh;
    tt_d->valid = valid;
    tt_d->aux = opts;

    gtk_window_set_title (GTK_WINDOW (tt_d->dialog), _("Paired Samples T Test"));

    response = psppire_dialog_run (PSPPIRE_DIALOG (tt_d->dialog));

    switch (response)
    {
    case GTK_RESPONSE_OK:
        g_free (execute_syntax_string (de, generate_syntax (tt_d, opts)));
        break;
    case PSPPIRE_RESPONSE_PASTE:
        g_free (paste_syntax_to_window (generate_syntax (tt_d, opts)));
        break;
    default:
        break;
    }

    two_sample_dialog_destroy (tt_d);
    tt_options_dialog_destroy (opts);
}
static void
on_format_clicked (PsppireDialogActionCrosstabs *cd)
{
  int ret;

  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cd->avalue_button), cd->format_options_avalue);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cd->table_button), cd->format_options_table);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cd->pivot_button), cd->format_options_pivot);

  ret = psppire_dialog_run (PSPPIRE_DIALOG (cd->format_dialog));

  if ( ret == PSPPIRE_RESPONSE_CONTINUE )
    {
      cd->format_options_avalue =
	gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cd->avalue_button));

      cd->format_options_table =
	gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cd->table_button));

      cd->format_options_pivot = 
	gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cd->pivot_button));
    }
}
Esempio n. 16
0
static void
psppire_dialog_set_property (GObject         *object,
			     guint            prop_id,
			     const GValue    *value,
			     GParamSpec      *pspec)

{
  PsppireDialog *dialog = PSPPIRE_DIALOG (object);

  switch (prop_id)
    {
    case PROP_SLIDING:
      dialog->slidable = g_value_get_boolean (value);
      break;
    case PROP_ORIENTATION:
      dialog->orientation = g_value_get_enum (value);
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
    };

  dialog_set_container (dialog);
}
Esempio n. 17
0
static void
sample_subdialog (GtkButton *b, gpointer data)
{
  gint response;
  struct select_cases_dialog *scd = data;

  gint case_count = psppire_data_store_get_case_count (scd->data_store);

  GtkWidget *parent_dialog = get_widget_assert (scd->xml,
						"select-cases-dialog");
  GtkWidget *dialog = get_widget_assert (scd->xml,
					 "select-cases-random-sample-dialog");
  GtkWidget *percent = get_widget_assert (scd->xml,
					  "radiobutton-sample-percent");
  GtkWidget *sample_n_cases = get_widget_assert (scd->xml,
						 "radiobutton-sample-n-cases");
  GtkWidget *table = get_widget_assert (scd->xml,
					"select-cases-random-sample-table");

  if ( ! scd->hbox1 )
    {
      scd->hbox1 = psppire_scanf_new (gettext (label1), &scd->spinbutton);

      gtk_widget_show (scd->hbox1);

      gtk_table_attach_defaults (GTK_TABLE (table),
				 scd->hbox1, 1, 2, 0, 1);

      g_signal_connect (percent, "toggled",
			G_CALLBACK (set_sensitivity_from_toggle), scd->hbox1);

      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (percent), TRUE);
    }


  if ( ! scd->hbox2 )
    {
      scd->hbox2 =
	psppire_scanf_new (gettext (label2), &scd->spinbutton1, &scd->spinbutton2);

      gtk_spin_button_set_range (GTK_SPIN_BUTTON (scd->spinbutton1),
				 1, case_count);

      gtk_spin_button_set_range (GTK_SPIN_BUTTON (scd->spinbutton2),
				 1, case_count);

      gtk_widget_show (scd->hbox2);
      gtk_widget_set_sensitive (scd->hbox2, FALSE);

      gtk_table_attach_defaults (GTK_TABLE (table),
				 scd->hbox2, 1, 2, 1, 2);

      g_signal_connect (sample_n_cases, "toggled",
			G_CALLBACK (set_sensitivity_from_toggle), scd->hbox2);

      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sample_n_cases), FALSE);
    }


  gtk_window_set_transient_for (GTK_WINDOW (dialog),
				GTK_WINDOW (parent_dialog));

  response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));

  if ( response != PSPPIRE_RESPONSE_CONTINUE)
    {
      g_signal_handlers_disconnect_by_func
	(G_OBJECT (percent),
	 G_CALLBACK (set_sensitivity_from_toggle),
	 scd->hbox1);

      g_signal_handlers_disconnect_by_func
	(G_OBJECT (sample_n_cases),
	 G_CALLBACK (set_sensitivity_from_toggle),
	 scd->hbox2);

      gtk_widget_destroy(scd->hbox1);
      gtk_widget_destroy(scd->hbox2);
      scd->hbox1 = scd->hbox2 = NULL;
    }
  else
    {
      gchar *text;
      GtkWidget *l0 = get_widget_assert (scd->xml, "random-sample-label");

      if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (percent)))
	{
	  text = widget_printf (gettext(label1), scd->spinbutton);
	  gtk_label_set_text (GTK_LABEL (l0), text);
	}
      else
	{
	  text =
	    widget_printf (gettext(label2), scd->spinbutton1, scd->spinbutton2);
	  gtk_label_set_text (GTK_LABEL (l0), text);

	}
      g_free (text);

    }
}
Esempio n. 18
0
/* Pops up the Select Cases dialog box */
void
select_cases_dialog (PsppireDataWindow *de)
{
  gint response;
  struct select_cases_dialog scd = {0,0,0,0,0,0};
  GtkWidget *dialog   ;
  GtkWidget *entry = NULL;
  GtkWidget *selector ;
  GtkWidget *button_range;
  GtkWidget *button_sample;

  scd.xml = builder_new ("select-cases.ui");

  g_object_get (de->data_editor, "data-store", &scd.data_store, NULL);

  button_range = get_widget_assert (scd.xml, "button-range");
  button_sample = get_widget_assert (scd.xml, "button-sample");
  entry = get_widget_assert (scd.xml, "filter-variable-entry");
  selector = get_widget_assert (scd.xml, "psppire-selector-filter");

  {
    GtkWidget *button_if =
      get_widget_assert (scd.xml, "button-if");

    GtkWidget *radiobutton_if =
      get_widget_assert (scd.xml, "radiobutton-if");

    GtkWidget *radiobutton_all =
      get_widget_assert (scd.xml, "radiobutton-all");

    GtkWidget *radiobutton_sample =
      get_widget_assert (scd.xml, "radiobutton-sample");

    GtkWidget *radiobutton_range =
      get_widget_assert (scd.xml, "radiobutton-range");

    GtkWidget *radiobutton_filter =
      get_widget_assert (scd.xml, "radiobutton-filter-variable");

    GtkWidget *range_label =
      get_widget_assert (scd.xml, "range-sample-label");

    GtkWidget *sample_label =
      get_widget_assert (scd.xml, "random-sample-label");

    g_signal_connect (radiobutton_all, "toggled",
		      G_CALLBACK (set_sensitivity_from_toggle_invert),
		      get_widget_assert (scd.xml, "filter-delete-button-box")
		      );

    g_signal_connect (button_if, "clicked",
		      G_CALLBACK (set_radiobutton), radiobutton_if);

    g_signal_connect (button_sample, "clicked",
		      G_CALLBACK (set_radiobutton), radiobutton_sample);

    g_signal_connect (button_range,  "clicked",
		      G_CALLBACK (set_radiobutton), radiobutton_range);

    g_signal_connect (selector, "clicked",
		      G_CALLBACK (set_radiobutton), radiobutton_filter);

    g_signal_connect (selector, "selected",
		      G_CALLBACK (set_radiobutton), radiobutton_filter);

    g_signal_connect (radiobutton_range, "toggled",
		      G_CALLBACK (set_sensitivity_from_toggle),
		      range_label
		      );

    g_signal_connect (radiobutton_sample, "toggled",
		      G_CALLBACK (set_sensitivity_from_toggle),
		      sample_label
		      );

    g_signal_connect (radiobutton_filter, "toggled",
		      G_CALLBACK (set_sensitivity_from_toggle),
		      entry
		      );
  }



  dialog = get_widget_assert (scd.xml, "select-cases-dialog");
  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));

  {
    GtkWidget *source = get_widget_assert   (scd.xml, "select-cases-treeview");

    g_object_set (source, "model",
		  scd.data_store->dict,
		  "selection-mode",
		  GTK_SELECTION_SINGLE, NULL);

    psppire_selector_set_filter_func (PSPPIRE_SELECTOR (selector),
				   is_currently_in_entry);
  }



  g_signal_connect (button_range,
		    "clicked", G_CALLBACK (range_subdialog), &scd);


  g_signal_connect (button_sample,
		    "clicked", G_CALLBACK (sample_subdialog), &scd);


  response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));

  switch (response)
    {
    case GTK_RESPONSE_OK:
      g_free (execute_syntax_string (de, generate_syntax (&scd)));
      break;
    case PSPPIRE_RESPONSE_PASTE:
      g_free (paste_syntax_to_window (generate_syntax (&scd)));
      break;
    default:
      break;
    }

  g_object_unref (scd.xml);
}
Esempio n. 19
0
/* Pops up the Crosstabs dialog box */
void
crosstabs_dialog (PsppireDataWindow *de)
{
  gint response;
  struct crosstabs_dialog cd;

  GtkBuilder *xml = builder_new ("crosstabs.ui");
  PsppireVarStore *vs = NULL;
  PsppireDict *dict = NULL;


  GtkWidget *dialog = get_widget_assert   (xml, "crosstabs-dialog");
  GtkWidget *source = get_widget_assert   (xml, "dict-treeview");
  GtkWidget *dest_rows =   get_widget_assert   (xml, "rows");
  GtkWidget *dest_cols =   get_widget_assert   (xml, "cols");
  GtkWidget *format_button = get_widget_assert (xml, "format-button");
  GtkWidget *stat_button = get_widget_assert (xml, "stats-button");
  GtkWidget *cell_button = get_widget_assert (xml, "cell-button");


  cd.stat_view = get_widget_assert (xml, "stats-view");
  cd.cell_view = get_widget_assert (xml, "cell-view");

  g_object_get (de->data_editor, "var-store", &vs, NULL);

  put_checkbox_items_in_treeview (GTK_TREE_VIEW(cd.stat_view),
				  B_CS_STATS_DEFAULT,
				  N_CROSSTABS_STATS,
				  stats
				  );
  put_checkbox_items_in_treeview (GTK_TREE_VIEW(cd.cell_view),
				  B_CS_CELL_DEFAULT,
				  N_CROSSTABS_CELLS,
				  cells
				  );

  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));

  g_object_get (vs, "dictionary", &dict, NULL);
  g_object_set (source, "model", dict, NULL);

  cd.row_vars = GTK_TREE_VIEW (dest_rows);
  cd.col_vars = GTK_TREE_VIEW (dest_cols);
  g_object_get (vs, "dictionary", &cd.dict, NULL);
  cd.format_dialog = get_widget_assert (xml, "format-dialog");
  cd.table_button = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "print-tables"));
  cd.pivot_button = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "pivot"));
  cd.stat_dialog = get_widget_assert (xml, "stat-dialog");
  cd.cell_dialog = get_widget_assert (xml, "cell-dialog");

  cd.stat = gtk_tree_view_get_model (GTK_TREE_VIEW (cd.stat_view));
  cd.cell = gtk_tree_view_get_model (GTK_TREE_VIEW (cd.cell_view));
  cd.avalue = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "ascending"));
  cd.current_opts.avalue = TRUE;
  cd.current_opts.table = TRUE;
  cd.current_opts.pivot = TRUE;

  gtk_window_set_transient_for (GTK_WINDOW (cd.format_dialog), GTK_WINDOW (de));
  gtk_window_set_transient_for (GTK_WINDOW (cd.cell_dialog), GTK_WINDOW (de));
  gtk_window_set_transient_for (GTK_WINDOW (cd.stat_dialog), GTK_WINDOW (de));

  g_signal_connect (dialog, "refresh", G_CALLBACK (refresh),  &cd);

  psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (dialog),
				      dialog_state_valid, &cd);

  g_signal_connect_swapped (format_button, "clicked",
			    G_CALLBACK (on_format_clicked),  &cd);
  g_signal_connect_swapped (stat_button, "clicked",
			    G_CALLBACK (on_statistics_clicked),  &cd);
  g_signal_connect_swapped (cell_button, "clicked",
			    G_CALLBACK (on_cell_clicked),  &cd);

  response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));


  switch (response)
    {
    case GTK_RESPONSE_OK:
      g_free (execute_syntax_string (de, generate_syntax (&cd)));
      break;
    case PSPPIRE_RESPONSE_PASTE:
      g_free (paste_syntax_to_window (generate_syntax (&cd)));
      break;
    default:
      break;
    }

  g_object_unref (xml);
}
static void
run_define_groups (PsppireDialogActionIndepSamps *act)
{
  gint response;
  PsppireDialogAction *da = PSPPIRE_DIALOG_ACTION (act);

  if ( act->dg_table2->parent)
    gtk_container_remove (GTK_CONTAINER (act->dg_table2->parent), act->dg_table2);

  if ( act->dg_table1->parent)
    gtk_container_remove (GTK_CONTAINER (act->dg_table1->parent), act->dg_table1);


  if ( var_is_numeric (act->grp_var))
    {
      gtk_table_attach_defaults (GTK_TABLE (act->dg_table1), act->dg_table2,
  				 1, 2, 1, 2);

      gtk_container_add (GTK_CONTAINER (act->dg_box), act->dg_table1);
    }
  else
    {
      gtk_container_add (GTK_CONTAINER (act->dg_box), act->dg_table2);
      act->group_defn = GROUPS_VALUES;
    }


  psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (act->dg_dialog),
  				      define_groups_state_valid, act);

  psppire_value_entry_set_variable (PSPPIRE_VALUE_ENTRY (act->dg_grp_entry[0]), act->grp_var);
  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 )
    {
      gtk_toggle_button_set_active
  	(GTK_TOGGLE_BUTTON (act->dg_cut_point_toggle_button), TRUE);

      gtk_toggle_button_set_active
  	(GTK_TOGGLE_BUTTON (act->dg_values_toggle_button), TRUE);
    }
  else
    {
      gtk_toggle_button_set_active
  	(GTK_TOGGLE_BUTTON (act->dg_values_toggle_button), TRUE);

      gtk_toggle_button_set_active
  	(GTK_TOGGLE_BUTTON (act->dg_cut_point_toggle_button), TRUE);
    }

  g_signal_emit_by_name (act->dg_grp_entry[0], "changed");
  g_signal_emit_by_name (act->dg_grp_entry[1], "changed");
  g_signal_emit_by_name (act->dg_cut_point_entry, "changed");

  response = psppire_dialog_run (PSPPIRE_DIALOG (act->def_grps_dialog));

  if (response == PSPPIRE_RESPONSE_CONTINUE)
    {
      const int width = var_get_width (act->grp_var);

      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (act->dg_values_toggle_button)))
	{
	  act->group_defn = GROUPS_VALUES;

          psppire_value_entry_get_value (PSPPIRE_VALUE_ENTRY (act->dg_grp_entry[0]),
					 &act->grp_val[0], width);

          psppire_value_entry_get_value (PSPPIRE_VALUE_ENTRY (act->dg_grp_entry[1]),
					 &act->grp_val[1], width);
	}
      else
	{
	  act->group_defn = GROUPS_CUT_POINT;

          psppire_value_entry_get_value (PSPPIRE_VALUE_ENTRY (act->dg_cut_point_entry),
					 &act->cut_point, width);
	}

      psppire_dialog_notify_change (PSPPIRE_DIALOG (da->dialog));
    }
}
Esempio n. 21
0
static void
recode_dialog (PsppireDataWindow *de, gboolean diff)
{
  gint response;

  struct recode_dialog rd;

  GtkBuilder *builder = builder_new ("recode.ui");

  GtkWidget *selector = get_widget_assert (builder, "psppire-selector1");

  GtkWidget *oldandnew = get_widget_assert (builder, "button1");


  GtkWidget *output_variable_box = get_widget_assert (builder,"frame4");

  PsppireVarStore *vs = NULL;
  g_object_get (de->data_editor, "var-store", &vs, NULL);

  rd.change_button = get_widget_assert (builder, "change-button");
  rd.varmap = NULL;
  rd.dialog = get_widget_assert   (builder, "recode-dialog");
  rd.dict_treeview = get_widget_assert (builder, "treeview1");
  rd.variable_treeview =   get_widget_assert (builder, "treeview2");
  rd.new_name_entry = get_widget_assert (builder, "dest-name-entry");
  rd.new_label_entry = get_widget_assert (builder, "dest-label-entry");

  g_object_get (vs, "dictionary", &rd.dict, NULL);

  rd.value_map = gtk_list_store_new (2,
				     old_value_get_type (),
				     new_value_get_type ()
				     );

  g_object_set (output_variable_box, "visible", diff, NULL);

  if ( diff )
    gtk_window_set_title (GTK_WINDOW (rd.dialog),
			  _("Recode into Different Variables"));
  else
    gtk_window_set_title (GTK_WINDOW (rd.dialog),
			  _("Recode into Same Variables"));

  rd.different = diff;

  gtk_window_set_transient_for (GTK_WINDOW (rd.dialog), GTK_WINDOW (de));

  g_object_set (rd.dict_treeview, "model", rd.dict, NULL);

  if (rd.different)
    {
      GtkTreeSelection *sel;

      GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();

      GtkTreeViewColumn *col = gtk_tree_view_column_new_with_attributes (_("New"),
									 renderer,
									 "text", NULL,
									 NULL);

      gtk_tree_view_column_set_cell_data_func (col, renderer,
					       render_new_var_name,
					       &rd, NULL);


      gtk_tree_view_append_column (GTK_TREE_VIEW (rd.variable_treeview), col);


      col = gtk_tree_view_get_column (GTK_TREE_VIEW (rd.variable_treeview), 0);

      g_object_set (col, "title", _("Old"), NULL);

      g_object_set (rd.variable_treeview, "headers-visible", TRUE, NULL);

      rd.varmap = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, nlp_destroy);

      sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (rd.variable_treeview));

      g_signal_connect (sel, "changed",
			G_CALLBACK (on_selection_change), &rd);

      g_signal_connect (rd.change_button, "clicked",
			G_CALLBACK (on_change_clicked),  &rd);

    }

  psppire_selector_set_allow (PSPPIRE_SELECTOR (selector), homogeneous_types);

  /* Set up the Old & New Values subdialog */
  {
    rd.string_button = get_widget_assert (builder, "checkbutton1");
    rd.width_entry   = get_widget_assert (builder, "spinbutton1");

    rd.convert_button           = get_widget_assert (builder, "checkbutton2");

    rd.old_value_chooser = get_widget_assert (builder, "val-chooser");

    rd.new_value_entry = get_widget_assert (builder, "entry1");


    rd.toggle[BUTTON_NEW_VALUE]  = get_widget_assert (builder, "radiobutton1");
    rd.toggle[BUTTON_NEW_SYSMIS] = get_widget_assert (builder, "radiobutton2");
    rd.toggle[BUTTON_NEW_COPY]   = get_widget_assert (builder, "radiobutton3");

    rd.new_copy_label = get_widget_assert (builder, "label3");
    rd.strings_box    = get_widget_assert (builder, "table3");

    rd.old_and_new_dialog =
      PSPPIRE_DIALOG (get_widget_assert (builder, "old-new-values-dialog"));

    gtk_window_set_transient_for (GTK_WINDOW (rd.old_and_new_dialog),
				  GTK_WINDOW (de));

    rd.acr = PSPPIRE_ACR (get_widget_assert (builder, "psppire-acr1"));

    g_signal_connect_swapped (rd.toggle[BUTTON_NEW_VALUE], "toggled",
		      G_CALLBACK (set_acr), &rd);

    g_signal_connect_swapped (rd.new_value_entry, "changed",
		      G_CALLBACK (set_acr), &rd);

    {
      GtkTreeSelection *sel;
      /* Remove the ACR's default column.  We don't like it */
      GtkTreeViewColumn *column = gtk_tree_view_get_column (rd.acr->tv, 0);
      gtk_tree_view_remove_column (rd.acr->tv, column);


      column =
	gtk_tree_view_column_new_with_attributes (_("Old"),
						  gtk_cell_renderer_text_new (),
						  "text", 0,
						  NULL);

      gtk_tree_view_append_column (rd.acr->tv, column);

      column =
	gtk_tree_view_column_new_with_attributes (_("New"),
						  gtk_cell_renderer_text_new (),
						  "text", 1,
						  NULL);

      gtk_tree_view_append_column (rd.acr->tv, column);
      g_object_set (rd.acr->tv, "headers-visible", TRUE, NULL);


      sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (rd.acr->tv));
      g_signal_connect (sel, "changed",
			G_CALLBACK (on_acr_selection_change), &rd);
    }


    g_signal_connect_swapped (oldandnew, "clicked",
			      G_CALLBACK (run_old_and_new_dialog), &rd);


    g_signal_connect (rd.toggle[BUTTON_NEW_VALUE], "toggled",
		      G_CALLBACK (toggle_sensitivity), rd.new_value_entry);

    g_signal_connect (rd.string_button, "toggled",
		      G_CALLBACK (toggle_sensitivity), rd.width_entry);

    g_signal_connect (rd.string_button, "toggled",
		      G_CALLBACK (on_string_toggled), &rd);

    g_signal_connect (rd.convert_button, "toggled",
		      G_CALLBACK (on_convert_toggled), &rd);

    g_signal_connect_swapped (rd.old_and_new_dialog, "show",
			      G_CALLBACK (on_old_new_show), &rd);
  }

  g_signal_connect (rd.dialog, "refresh", G_CALLBACK (refresh),  &rd);


  psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (rd.dialog),
				      dialog_state_valid, &rd);

  response = psppire_dialog_run (PSPPIRE_DIALOG (rd.dialog));

  switch (response)
    {
    case GTK_RESPONSE_OK:
      g_free (execute_syntax_string (de, generate_syntax (&rd)));
      break;
    case PSPPIRE_RESPONSE_PASTE:
      g_free (paste_syntax_to_window (generate_syntax (&rd)));
      break;
    default:
      break;
    }

  if (rd.varmap)
    g_hash_table_destroy (rd.varmap);

  gtk_list_store_clear (GTK_LIST_STORE (rd.value_map));
  g_object_unref (rd.value_map);

  g_object_unref (builder);
}
Esempio n. 22
0
/* Pops up the Compute dialog box */
void
compute_dialog (PsppireDataWindow *de)
{
  gint response;

  PsppireVarStore *vs = NULL;
  struct compute_dialog scd;

  GtkBuilder *xml = builder_new ("compute.ui");

  GtkWidget *dialog = get_widget_assert   (xml, "compute-variable-dialog");

  GtkWidget *dict_view = get_widget_assert (xml, "compute-treeview1");
  GtkWidget *functions = get_widget_assert (xml, "compute-treeview2");
  GtkWidget *keypad    = get_widget_assert (xml, "psppire-keypad1");
  GtkWidget *target    = get_widget_assert (xml, "compute-entry1");
  GtkWidget *var_selector = get_widget_assert (xml, "compute-selector1");
  GtkWidget *func_selector = get_widget_assert (xml, "compute-selector2");
  GtkWidget *type_and_label = get_widget_assert (xml, "compute-button1");

  GtkWidget *expression =
	get_widget_assert (xml, "radio-button-expression-label");


  g_object_get (de->data_editor, "var-store", &vs, NULL);
  g_object_get (vs, "dictionary", &scd.dict, NULL);
  scd.use_type = FALSE;

  g_signal_connect (expression, "toggled",
		    G_CALLBACK(on_expression_toggle), &scd);

  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));

  
  g_object_set (dict_view, "model", scd.dict,
		"selection-mode", GTK_SELECTION_SINGLE,
		NULL);

  psppire_selector_set_select_func (PSPPIRE_SELECTOR (var_selector),
				    insert_source_row_into_text_view, NULL);

  function_list_populate (GTK_TREE_VIEW (functions));

  psppire_selector_set_select_func (PSPPIRE_SELECTOR (func_selector),
				    insert_function_into_syntax_area, NULL);

  scd.xml = xml;

  psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (dialog),
				      contents_plausible, &scd);

  g_signal_connect (target, "changed", G_CALLBACK (on_target_change), &scd);

  g_signal_connect (dialog, "refresh", G_CALLBACK (refresh),  &scd);

  g_signal_connect (keypad, "insert-syntax",
		    G_CALLBACK (on_keypad_button),  xml);

  g_signal_connect (keypad, "erase",
		    G_CALLBACK (erase),  xml);


  g_signal_connect (type_and_label, "clicked",
		    G_CALLBACK (run_type_label_dialog),  &scd);



  response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));


  switch (response)
    {
    case GTK_RESPONSE_OK:
      g_free (execute_syntax_string (de, generate_syntax (&scd)));
      break;
    case PSPPIRE_RESPONSE_PASTE:
      g_free (paste_syntax_to_window (generate_syntax (&scd)));
      break;
    default:
      break;
    }

  g_object_unref (xml);
}
Esempio n. 23
0
void
comments_dialog (PsppireDataWindow *de)
{
    GtkTextIter iter;
    gint response ;
    struct comment_dialog cd;

    GtkBuilder *xml = builder_new ("psppire.ui");

    GtkWidget *dialog = get_widget_assert (xml, "comments-dialog");
    GtkWidget *textview = get_widget_assert (xml, "comments-textview1");
    GtkWidget *label = get_widget_assert (xml, "column-number-label");
    GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview));

    PsppireVarStore *vs = NULL;

    g_object_get (de->data_editor, "var-store", &vs, NULL);

    gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));

    {
        PangoContext * context ;
        PangoLayout *  layout ;
        PangoRectangle rect;

        /* Since we're going to truncate lines to 80 chars,
           we need a monospaced font otherwise it'll look silly */
        PangoFontDescription *font_desc =
            pango_font_description_from_string ("monospace");

        gtk_widget_modify_font (textview, font_desc);


        /* and let's just make sure that a complete line fits into the
           widget's width */
        context = gtk_widget_create_pango_context (textview);
        layout = pango_layout_new (context);

        pango_layout_set_text (layout, "M", 1);

        pango_layout_set_font_description (layout, font_desc);

        pango_layout_get_extents (layout, NULL, &rect);

        g_object_set (textview, "width-request",
                      PANGO_PIXELS (rect.width) * DOC_LINE_LENGTH + 20, NULL);

        g_object_unref (G_OBJECT (layout));
        g_object_unref (G_OBJECT (context));

        pango_font_description_free (font_desc);
    }

    cd.xml = xml;
    g_object_get (vs, "dictionary", &cd.dict, NULL);

    g_signal_connect (buffer, "mark-set",
                      G_CALLBACK (set_column_number), label);

    g_signal_connect_after (buffer, "insert-text",
                            G_CALLBACK (wrap_line), NULL);

    gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
    gtk_text_buffer_place_cursor (buffer, &iter);


    g_signal_connect (dialog, "refresh", G_CALLBACK (refresh),  &cd);


    response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));

    switch (response)
    {
    case GTK_RESPONSE_OK:
        g_free (execute_syntax_string (de, generate_syntax (&cd)));
        break;
    case PSPPIRE_RESPONSE_PASTE:
        g_free (paste_syntax_to_window (generate_syntax (&cd)));
        break;
    default:
        break;
    }


    g_object_unref (xml);
}
static void
run_define_groups (struct tt_indep_samples_dialog *ttd)
{
  struct tt_groups_dialog *grps = ttd->grps;

  gint response;

  GtkWidget *box = get_widget_assert (ttd->xml, "dialog-hbox2");

  const gchar *text = gtk_entry_get_text (GTK_ENTRY (ttd->groups_entry));

  const struct variable *v = psppire_dict_lookup_var (ttd->dict, text);

  if ( grps->table2->parent)
    gtk_container_remove (GTK_CONTAINER (grps->table2->parent), grps->table2);

  if ( grps->table1->parent)
    gtk_container_remove (GTK_CONTAINER (grps->table1->parent), grps->table1);


  if ( var_is_numeric (v))
    {
      gtk_table_attach_defaults (GTK_TABLE (grps->table1), grps->table2,
				 1, 2, 1, 2);

      gtk_container_add (GTK_CONTAINER (box), grps->table1);
    }
  else
    {
      gtk_container_add (GTK_CONTAINER (box), grps->table2);
      grps->group_defn = GROUPS_VALUES;
    }


  psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (grps->dialog),
				      define_groups_state_valid, grps);

  if ( grps->group_defn != GROUPS_CUT_POINT )
    {
      gtk_toggle_button_set_active
	(GTK_TOGGLE_BUTTON (grps->cut_point_toggle_button), TRUE);

      gtk_toggle_button_set_active
	(GTK_TOGGLE_BUTTON (grps->values_toggle_button), TRUE);

      gtk_entry_set_text (GTK_ENTRY (grps->grp_entry[0]), grps->val[0]);
      gtk_entry_set_text (GTK_ENTRY (grps->grp_entry[1]), grps->val[1]);

      gtk_entry_set_text (GTK_ENTRY (grps->cut_point_entry), "");
    }
  else
    {
      gtk_toggle_button_set_active
	(GTK_TOGGLE_BUTTON (grps->values_toggle_button), TRUE);

      gtk_toggle_button_set_active
	(GTK_TOGGLE_BUTTON (grps->cut_point_toggle_button), TRUE);

      gtk_entry_set_text (GTK_ENTRY (grps->grp_entry[0]), "");
      gtk_entry_set_text (GTK_ENTRY (grps->grp_entry[1]), "");

      gtk_entry_set_text (GTK_ENTRY (grps->cut_point_entry), grps->val[0]);
    }

  g_signal_emit_by_name (grps->grp_entry[0], "changed");
  g_signal_emit_by_name (grps->grp_entry[1], "changed");
  g_signal_emit_by_name (grps->cut_point_entry, "changed");

  response = psppire_dialog_run (PSPPIRE_DIALOG (grps->dialog));

  if (response == PSPPIRE_RESPONSE_CONTINUE)
    {
      g_free (grps->val[0]);
      g_free (grps->val[1]);

      if (gtk_toggle_button_get_active
	  (GTK_TOGGLE_BUTTON (grps->values_toggle_button)))
	{
	  grps->group_defn = GROUPS_VALUES;

	  grps->val[0] =
	    xstrdup (gtk_entry_get_text (GTK_ENTRY (grps->grp_entry[0])));

	  grps->val[1] =
	    xstrdup (gtk_entry_get_text (GTK_ENTRY (grps->grp_entry[1])));
	}
      else
	{
	  grps->group_defn = GROUPS_CUT_POINT;

	  grps->val[1] = NULL;

	  grps->val[0] =
	    xstrdup (gtk_entry_get_text (GTK_ENTRY (grps->cut_point_entry)));
	}

      psppire_dialog_notify_change (PSPPIRE_DIALOG (ttd->dialog));
    }
}
/* Pops up the dialog box */
void
t_test_independent_samples_dialog (PsppireDataWindow *de)
{
  struct tt_indep_samples_dialog tt_d;
  gint response;

  PsppireVarStore *vs = NULL;

  GtkBuilder *xml = builder_new ("t-test.ui");

  GtkWidget *dict_view =
    get_widget_assert (xml, "indep-samples-t-test-treeview1");

  GtkWidget *selector2 =
    get_widget_assert (xml, "indep-samples-t-test-selector2");

  GtkWidget *selector1 =
    get_widget_assert (xml, "indep-samples-t-test-selector1");

  GtkWidget *options_button =
    get_widget_assert (xml, "indep-samples-t-test-options-button");

  g_object_get (de->data_editor, "var-store", &vs, NULL);

  tt_d.dialog = get_widget_assert (xml, "t-test-independent-samples-dialog");
  tt_d.xml = xml;
  g_object_get (vs, "dictionary", &tt_d.dict, NULL);

  tt_d.define_groups_button = get_widget_assert (xml, "define-groups-button");
  tt_d.groups_entry = get_widget_assert (xml, "indep-samples-t-test-entry");
  tt_d.opts = tt_options_dialog_create (GTK_WINDOW (de));
  tt_d.grps = tt_groups_dialog_create (xml, GTK_WINDOW (de));


  gtk_window_set_transient_for (GTK_WINDOW (tt_d.dialog), GTK_WINDOW (de));

  g_object_set (dict_view, "model", tt_d.dict, NULL);

  psppire_selector_set_allow (PSPPIRE_SELECTOR (selector1),
			      numeric_only);


  psppire_selector_set_filter_func (PSPPIRE_SELECTOR (selector2),
				 is_currently_in_entry);

  g_signal_connect_swapped (tt_d.define_groups_button, "clicked",
			    G_CALLBACK (run_define_groups), &tt_d);


  g_signal_connect_swapped (options_button, "clicked",
			    G_CALLBACK (tt_options_dialog_run), tt_d.opts);


  g_signal_connect_swapped (tt_d.dialog, "refresh", G_CALLBACK (refresh),
			    &tt_d);

  g_signal_connect (tt_d.groups_entry, "changed",
		    G_CALLBACK (set_define_groups_sensitivity), &tt_d);


  psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (tt_d.dialog),
				      dialog_state_valid, &tt_d);

  response = psppire_dialog_run (PSPPIRE_DIALOG (tt_d.dialog));

  switch (response)
    {
    case GTK_RESPONSE_OK:
      g_free (execute_syntax_string (de, generate_syntax (&tt_d)));
      break;
    case PSPPIRE_RESPONSE_PASTE:
      g_free (paste_syntax_to_window (generate_syntax (&tt_d)));
      break;
    default:
      break;
    }

  tt_options_dialog_destroy (tt_d.opts);
  tt_groups_dialog_destroy (tt_d.grps);

  g_object_unref (xml);
}