static char *
-generate_syntax (PsppireDialogAction *act)
+generate_syntax (const PsppireDialogAction *act)
{
PsppireDialogActionAggregate *agg = PSPPIRE_DIALOG_ACTION_AGGREGATE (act);
return FALSE;
liststore = GTK_TREE_MODEL (PSPPIRE_ACR (agg->summary_acr)->list_store);
-
+
if ( ! gtk_tree_model_get_iter_first (liststore, &iter))
return FALSE;
gpointer data)
{
PsppireDialogActionAggregate *agg = data;
-
+
GString *string = g_string_new ("");
append_summary_spec (agg, iter, string);
-
+
g_object_set (cell, "text", string->str, NULL);
g_string_free (string, TRUE);
_("Cancel"), GTK_RESPONSE_CANCEL,
_("Save"), GTK_RESPONSE_ACCEPT,
NULL);
-
+
g_object_set (dialog, "local-only", FALSE, NULL);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
}
-enum
+enum
{
SUMMARY_COL_VARNAME = 0,
SUMMARY_COL_VARLABEL,
double arg1, arg2;
gchar *text1 = g_strdup ("");
gchar *text2 = g_strdup ("");
-
+
GtkTreeIter iter;
GtkTreeModel *model = gtk_tree_view_get_model (tv);
GtkTreeSelection *sel = gtk_tree_view_get_selection (tv);
gtk_entry_set_text (GTK_ENTRY (agg->summary_var_name_entry), varname);
gtk_entry_set_text (GTK_ENTRY (agg->summary_var_label_entry), label);
gtk_entry_set_text (GTK_ENTRY (agg->summary_sv_entry), srcvar);
-
+
text1 = c_xasprintf ("%.*g", DBL_DIG + 1, arg1);
text2 = c_xasprintf ("%.*g", DBL_DIG + 1, arg2);
}
-static void
-psppire_dialog_action_aggregate_activate (GtkAction *a)
+static GtkBuilder *
+psppire_dialog_action_aggregate_activate (PsppireDialogAction *a, GVariant *param)
{
PsppireDialogActionAggregate *act = PSPPIRE_DIALOG_ACTION_AGGREGATE (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 ("aggregate.ui");
- g_hash_table_insert (thing, a, xml);
-
+ GtkBuilder *xml = builder_new ("aggregate.ui");
- pda->dialog = get_widget_assert (xml, "aggregate-dialog");
- pda->source = get_widget_assert (xml, "dict-view");
+ pda->dialog = get_widget_assert (xml, "aggregate-dialog");
+ pda->source = get_widget_assert (xml, "dict-view");
+ GtkWidget *break_selector = get_widget_assert (xml, "break-selector");
+ act->pane = get_widget_assert (xml, "hbox1");
- GtkWidget *break_selector = get_widget_assert (xml, "break-selector");
+ act->break_variables = get_widget_assert (xml, "psppire-var-view1");
+ act->filename_radiobutton = get_widget_assert (xml, "filename-radiobutton");
+ act->filename_button = get_widget_assert (xml, "filename-button");
+ act->filename_box = get_widget_assert (xml, "filename-box");
+ act->filename_label = get_widget_assert (xml, "filename-label");
+ act->replace_radiobutton = get_widget_assert (xml, "replace-radiobutton");
+ act->add_radiobutton = get_widget_assert (xml, "add-radiobutton");
+ act->function_combo = get_widget_assert (xml, "function-combo");
- act->pane = get_widget_assert (xml, "hbox1");
-
- act->break_variables = get_widget_assert (xml, "psppire-var-view1");
- act->filename_radiobutton = get_widget_assert (xml, "filename-radiobutton");
- act->filename_button = get_widget_assert (xml, "filename-button");
- act->filename_box = get_widget_assert (xml, "filename-box");
- act->filename_label = get_widget_assert (xml, "filename-label");
- act->replace_radiobutton = get_widget_assert (xml, "replace-radiobutton");
- act->add_radiobutton = get_widget_assert (xml, "add-radiobutton");
- act->function_combo = get_widget_assert (xml, "function-combo");
+ act->summary_acr = get_widget_assert (xml, "psppire-acr1");
+ act->summary_var_name_entry = get_widget_assert (xml, "summary-var-name-entry");
- act->summary_acr = get_widget_assert (xml, "psppire-acr1");
- act->summary_var_name_entry = get_widget_assert (xml, "summary-var-name-entry");
+ act->summary_arg1 = get_widget_assert (xml, "summary-arg1");
+ act->summary_arg2 = get_widget_assert (xml, "summary-arg2");
- act->summary_arg1 = get_widget_assert (xml, "summary-arg1");
- act->summary_arg2 = get_widget_assert (xml, "summary-arg2");
+ act->summary_arg1_entry = get_widget_assert (xml, "summary-arg-entry1");
+ act->summary_arg2_entry = get_widget_assert (xml, "summary-arg-entry2");
- act->summary_arg1_entry = get_widget_assert (xml, "summary-arg-entry1");
- act->summary_arg2_entry = get_widget_assert (xml, "summary-arg-entry2");
+ act->summary_var_label_entry = get_widget_assert (xml, "summary-var-label-entry");
- act->summary_var_label_entry = get_widget_assert (xml, "summary-var-label-entry");
+ act->summary_sv = get_widget_assert (xml, "source-var");
+ act->summary_sv_entry = get_widget_assert (xml, "source-var-entry");
- act->summary_sv = get_widget_assert (xml, "source-var");
- act->summary_sv_entry = get_widget_assert (xml, "source-var-entry");
+ act->sorted_button = get_widget_assert (xml, "sorted-radiobutton");
+ act->needs_sort_button = get_widget_assert (xml, "needs-sort-radiobutton");
- act->sorted_button = get_widget_assert (xml, "sorted-radiobutton");
- act->needs_sort_button = get_widget_assert (xml, "needs-sort-radiobutton");
+ {
+ GtkTreeViewColumn *column ;
- {
- GtkTreeViewColumn *column ;
+ GList *l ;
- GList *l ;
+ GtkCellRenderer *cell_renderer ;
- GtkCellRenderer *cell_renderer ;
+ GtkListStore *list = gtk_list_store_new (6,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_INT,
+ G_TYPE_STRING,
+ G_TYPE_DOUBLE,
+ G_TYPE_DOUBLE);
- GtkListStore *list = gtk_list_store_new (6,
- G_TYPE_STRING,
- G_TYPE_STRING,
- G_TYPE_INT,
- G_TYPE_STRING,
- G_TYPE_DOUBLE,
- G_TYPE_DOUBLE);
+ psppire_acr_set_model (PSPPIRE_ACR (act->summary_acr), list);
+ g_object_unref (list);
- psppire_acr_set_model (PSPPIRE_ACR (act->summary_acr), list);
- g_object_unref (list);
+ psppire_acr_set_get_value_func (PSPPIRE_ACR (act->summary_acr),
+ get_summary_spec, act);
- psppire_acr_set_get_value_func (PSPPIRE_ACR (act->summary_acr),
- get_summary_spec, act);
+ column = gtk_tree_view_get_column (PSPPIRE_ACR (act->summary_acr)->tv, 0);
- column = gtk_tree_view_get_column (PSPPIRE_ACR (act->summary_acr)->tv, 0);
+ l = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column));
- l = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column));
+ cell_renderer = l->data;
- cell_renderer = l->data;
+ gtk_tree_view_column_set_cell_data_func (column,
+ cell_renderer,
+ render_summary,
+ act,
+ NULL);
- gtk_tree_view_column_set_cell_data_func (column,
- cell_renderer,
- render_summary,
- act,
- NULL);
+ g_signal_connect_swapped (PSPPIRE_ACR (act->summary_acr)->tv,
+ "cursor-changed", G_CALLBACK (on_acr_change), act);
+ }
- g_signal_connect_swapped (PSPPIRE_ACR (act->summary_acr)->tv,
- "cursor-changed", G_CALLBACK (on_acr_change), act);
- }
-
- g_signal_connect_swapped (act->summary_var_name_entry, "changed", G_CALLBACK (update_acr), act);
- g_signal_connect_swapped (act->function_combo, "changed", G_CALLBACK (update_acr), act);
- g_signal_connect_swapped (act->summary_sv_entry, "changed", G_CALLBACK (update_acr), act);
- g_signal_connect_swapped (act->summary_arg1_entry, "changed", G_CALLBACK (update_acr), act);
- g_signal_connect_swapped (act->summary_arg2_entry, "changed", G_CALLBACK (update_acr), act);
+ g_signal_connect_swapped (act->summary_var_name_entry, "changed", G_CALLBACK (update_acr), act);
+ g_signal_connect_swapped (act->function_combo, "changed", G_CALLBACK (update_acr), act);
+ g_signal_connect_swapped (act->summary_sv_entry, "changed", G_CALLBACK (update_acr), act);
+ g_signal_connect_swapped (act->summary_arg1_entry, "changed", G_CALLBACK (update_acr), act);
+ g_signal_connect_swapped (act->summary_arg2_entry, "changed", G_CALLBACK (update_acr), act);
- g_signal_connect_swapped (act->function_combo, "changed",
- G_CALLBACK (update_arguments), act);
+ g_signal_connect_swapped (act->function_combo, "changed",
+ G_CALLBACK (update_arguments), act);
- populate_combo_model (GTK_COMBO_BOX (act->function_combo));
+ populate_combo_model (GTK_COMBO_BOX (act->function_combo));
- psppire_selector_set_filter_func (PSPPIRE_SELECTOR (break_selector), NULL);
+ psppire_selector_set_filter_func (PSPPIRE_SELECTOR (break_selector), NULL);
- g_signal_connect (act->filename_radiobutton, "toggled",
- G_CALLBACK (set_sensitivity_from_toggle), act->filename_box );
+ g_signal_connect (act->filename_radiobutton, "toggled",
+ G_CALLBACK (set_sensitivity_from_toggle), act->filename_box );
- g_signal_connect_swapped (act->filename_button, "clicked",
- G_CALLBACK (choose_filename), act);
+ g_signal_connect_swapped (act->filename_button, "clicked",
+ G_CALLBACK (choose_filename), act);
- psppire_dialog_action_set_refresh (pda, refresh);
- psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid);
- }
+ psppire_dialog_action_set_refresh (pda, refresh);
+ psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid);
- if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_aggregate_parent_class)->activate)
- PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_aggregate_parent_class)->activate (pda);
+ return xml;
}
static void
psppire_dialog_action_aggregate_class_init (PsppireDialogActionAggregateClass *class)
{
- psppire_dialog_action_set_activation (class, psppire_dialog_action_aggregate_activate);
+ PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_aggregate_activate;
PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax;
}
g_string_append (string, ds_cstr (&ss));
ds_destroy (&ss);
}
-
+
g_string_append_printf (string, " = %s", funcname);
if ( has_src_vars != AGR_SV_NO)
{
struct string dss;
ds_init_cstr (&dss, " (");
-
+
ds_put_cstr (&dss, srcvar);
if ( arity > 0)