PsppireImportAssistant *asst = PSPPIRE_IMPORT_ASSISTANT (w);
gtk_widget_show_all (w);
- asst->main_loop = g_main_loop_new (NULL, TRUE);
- g_main_loop_run (asst->main_loop);
- g_main_loop_unref (asst->main_loop);
+ int response = psppire_import_assistant_run (asst);
- if (!asst->file_name)
- goto end;
-
- switch (asst->response)
+ switch (response)
{
case GTK_RESPONSE_APPLY:
{
break;
}
- end:
gtk_widget_destroy (GTK_WIDGET (asst));
}
{
PsppireImportAssistant *ia = PSPPIRE_IMPORT_ASSISTANT (object);
-
if (ia->spreadsheet)
spreadsheet_unref (ia->spreadsheet);
g_object_unref (ia->builder);
+ ia->response = -1;
+ g_main_loop_unref (ia->main_loop);
+
if (G_OBJECT_CLASS (parent_class)->finalize)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
ia->spreadsheet = NULL;
+ ia->main_loop = g_main_loop_new (NULL, TRUE);
+
g_signal_connect (ia, "prepare", G_CALLBACK (on_prepare), ia);
g_signal_connect (ia, "cancel", G_CALLBACK (on_cancel), ia);
g_signal_connect (ia, "close", G_CALLBACK (on_close), ia);
unsigned long int generated_name_count = 0;
dict_clear (ia->dict);
- g_print ("%s:%d XXX %d\n", __FILE__, __LINE__, gtk_tree_model_get_n_columns (ia->delimiters_model));
-
for (i = 0; i < gtk_tree_model_get_n_columns (ia->delimiters_model) - 1; ++i)
{
const gchar *candidate_name = NULL;
candidate_name = psppire_delimited_text_get_header_title (PSPPIRE_DELIMITED_TEXT (ia->delimiters_model), i);
}
- g_print ("%s:%d CN is %s\n", __FILE__, __LINE__, candidate_name);
-
char *name = dict_make_unique_var_name (ia->dict,
candidate_name,
&generated_name_count);
-
+
dict_create_var_assert (ia->dict, name, 0);
free (name);
}
return ds_cstr (&s);
}
+
+
+int
+psppire_import_assistant_run (PsppireImportAssistant *asst)
+{
+ g_main_loop_run (asst->main_loop);
+ return asst->response;
+}
+
/* START Page where the user chooses field separators. */
/* How to break lines into columns. */
- // struct string separators; /* Field separators. */
struct string quotes; /* Quote characters. */
GtkWidget *custom_cb;
gchar *psppire_import_assistant_generate_syntax (PsppireImportAssistant *);
+int psppire_import_assistant_run (PsppireImportAssistant *asst);
+
G_END_DECLS
#endif /* __PSPPIRE_IMPORT_ASSISTANT_H__ */