ia->separators = xzalloc (sizeof *ia->separators);
ia->formats = xzalloc (sizeof *ia->formats);
+
g_signal_connect (a->assistant, "prepare", G_CALLBACK (on_prepare), ia);
g_signal_connect (a->assistant, "cancel", G_CALLBACK (on_cancel), ia);
g_signal_connect (a->assistant, "close", G_CALLBACK (on_close), ia);
struct sheet_spec_page *ssp = ia->sheet_spec;
int pn = gtk_assistant_get_current_page (assistant);
+ g_print ("%s:%d Page %d %p\n", __FILE__, __LINE__, pn, page);
+#if 0
if (pn == 1 && ssp->spreadsheet)
post_sheet_spec_page (ia);
}
+#endif
gtk_widget_show (ia->asst.reset_button);
if (page == ia->formats->page)
static void
on_reset (GtkButton *button, struct import_assistant *ia)
{
+#if 0
gint page_num = gtk_assistant_get_current_page (ia->asst.assistant);
GtkWidget *page = gtk_assistant_get_nth_page (ia->asst.assistant, page_num);
reset_formats_page (ia);
else if (page == ia->sheet_spec->page)
reset_sheet_spec_page (ia);
+#endif
}
/* Causes the assistant to close, returning RESPONSE for
\f
/* The "intro" page of the assistant. */
+/* The introduction page of the assistant. */
+struct intro_page
+ {
+ GtkWidget *page;
+ GtkWidget *all_cases_button;
+ GtkWidget *n_cases_button;
+ GtkWidget *n_cases_spin;
+ GtkWidget *percent_button;
+ GtkWidget *percent_spin;
+ };
+
static void on_intro_amount_changed (struct intro_page *);
/* Initializes IA's intro substructure. */
p->page = add_page_to_assistant (ia, get_widget_assert (builder, "Intro"),
GTK_ASSISTANT_PAGE_INTRO);
+
+ g_print ("%s:%d Added page %p\n", __FILE__, __LINE__, p->page);
p->all_cases_button = get_widget_assert (builder, "import-all-cases");
gtk_toggle_button_get_active (
GTK_TOGGLE_BUTTON (p->percent_button)));
}
+
+
+void
+intro_append_syntax (const struct intro_page *p, struct string *s)
+{
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (p->n_cases_button)))
+ ds_put_format (s, " /IMPORTCASES=FIRST %d\n",
+ gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (p->n_cases_spin)));
+ else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (p->percent_button)))
+ ds_put_format (s, " /IMPORTCASES=PERCENT %d\n",
+ gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (p->percent_spin)));
+ else
+ ds_put_cstr (s, " /IMPORTCASES=ALL\n");
+}
ia->file.file_name);
if (ia->file.encoding && strcmp (ia->file.encoding, "Auto"))
syntax_gen_pspp (&s, " /ENCODING=%sq\n", ia->file.encoding);
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (
- ia->intro->n_cases_button)))
- ds_put_format (&s, " /IMPORTCASES=FIRST %d\n",
- gtk_spin_button_get_value_as_int (
- GTK_SPIN_BUTTON (ia->intro->n_cases_spin)));
- else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (
- ia->intro->percent_button)))
- ds_put_format (&s, " /IMPORTCASES=PERCENT %d\n",
- gtk_spin_button_get_value_as_int (
- GTK_SPIN_BUTTON (ia->intro->percent_spin)));
- else
- ds_put_cstr (&s, " /IMPORTCASES=ALL\n");
+
+ intro_append_syntax (ia->intro, &s);
+
ds_put_cstr (&s,
" /ARRANGEMENT=DELIMITED\n"
" /DELCASE=LINE\n");
};
-/* The introduction page of the assistant. */
-struct intro_page
- {
- GtkWidget *page;
- GtkWidget *all_cases_button;
- GtkWidget *n_cases_button;
- GtkWidget *n_cases_spin;
- GtkWidget *percent_button;
- GtkWidget *percent_spin;
- };
-
/* Page where the user chooses the first line of data. */
struct first_line_page
{
void update_assistant (struct import_assistant *ia);
-
bool init_file (struct import_assistant *ia, GtkWindow *parent_window);
void destroy_file (struct import_assistant *ia);
-void init_intro_page (struct import_assistant *);
-void reset_intro_page (struct import_assistant *);
-
void init_sheet_spec_page (struct import_assistant *);
void prepare_sheet_spec_page (struct import_assistant *ia);
void reset_sheet_spec_page (struct import_assistant *);