static void on_close (GtkAssistant *assistant, struct import_assistant *);
static void on_paste (GtkButton *button, struct import_assistant *);
static void on_reset (GtkButton *button, struct import_assistant *);
static void on_close (GtkAssistant *assistant, struct import_assistant *);
static void on_paste (GtkButton *button, struct import_assistant *);
static void on_reset (GtkButton *button, struct import_assistant *);
/* Initializes IA's asst substructure. PARENT_WINDOW must be the
window to use as the assistant window's parent. */
struct import_assistant *
init_assistant (GtkWindow *parent_window)
{
/* Initializes IA's asst substructure. PARENT_WINDOW must be the
window to use as the assistant window's parent. */
struct import_assistant *
init_assistant (GtkWindow *parent_window)
{
-
- ia->intro = xzalloc (sizeof *ia->intro);
- ia->sheet_spec = xzalloc (sizeof *ia->sheet_spec);
- ia->first_line = xzalloc (sizeof *ia->first_line);
- ia->separators = xzalloc (sizeof *ia->separators);
- ia->formats = xzalloc (sizeof *ia->formats);
-
a->builder = builder_new ("text-data-import.ui");
a->assistant = GTK_ASSISTANT (gtk_assistant_new ());
a->builder = builder_new ("text-data-import.ui");
a->assistant = GTK_ASSISTANT (gtk_assistant_new ());
+
+ a->prop_renderer = gtk_cell_renderer_text_new ();
+ g_object_ref_sink (a->prop_renderer);
+ a->fixed_renderer = gtk_cell_renderer_text_new ();
+ g_object_ref_sink (a->fixed_renderer);
+ g_object_set (G_OBJECT (a->fixed_renderer),
+ "family", "Monospace",
+ (void *) NULL);
+
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);
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);
gtk_window_set_transient_for (GTK_WINDOW (a->assistant), parent_window);
gtk_window_set_icon_name (GTK_WINDOW (a->assistant), "pspp");
gtk_window_set_transient_for (GTK_WINDOW (a->assistant), parent_window);
gtk_window_set_icon_name (GTK_WINDOW (a->assistant), "pspp");
- a->prop_renderer = gtk_cell_renderer_text_new ();
- g_object_ref_sink (a->prop_renderer);
- a->fixed_renderer = gtk_cell_renderer_text_new ();
- g_object_ref_sink (a->fixed_renderer);
- g_object_set (G_OBJECT (a->fixed_renderer),
- "family", "Monospace",
- (void *) NULL);
on_prepare (GtkAssistant *assistant, GtkWidget *page,
struct import_assistant *ia)
{
on_prepare (GtkAssistant *assistant, GtkWidget *page,
struct import_assistant *ia)
{
- if (gtk_assistant_get_page_type (assistant, page)
- == GTK_ASSISTANT_PAGE_CONFIRM)
- gtk_widget_grab_focus (assistant->apply);
+ if ( ia->spreadsheet)
+ {
+ if (pn == 0)
+ {
+ prepare_sheet_spec_page (ia);
+ }
+ else if (pn == 1)
+ {
+ post_sheet_spec_page (ia);
+ prepare_formats_page (ia);
+ }
+ }
- gtk_widget_grab_focus (assistant->forward);
-
-
- /* Prepare .... */
- if (page == ia->separators->page)
- prepare_separators_page (ia);
- else if (page == ia->formats->page)
- prepare_formats_page (ia);
- else if (page == ia->sheet_spec->page && ssp->spreadsheet)
-
- gtk_widget_show (ia->asst.reset_button);
- if (page == ia->formats->page)
- gtk_widget_show (ia->asst.paste_button);
+ if (gtk_assistant_get_page_type (assistant, page)
+ == GTK_ASSISTANT_PAGE_CONFIRM)
+ gtk_widget_grab_focus (assistant->apply);
/* Called when the Reset button is clicked. */
static void
on_reset (GtkButton *button, struct import_assistant *ia)
/* Called when the Reset button is clicked. */
static void
on_reset (GtkButton *button, struct import_assistant *ia)
gint page_num = gtk_assistant_get_current_page (ia->asst.assistant);
GtkWidget *page = gtk_assistant_get_nth_page (ia->asst.assistant, page_num);
gint page_num = gtk_assistant_get_current_page (ia->asst.assistant);
GtkWidget *page = gtk_assistant_get_nth_page (ia->asst.assistant, page_num);
close_assistant (struct import_assistant *ia, int response)
{
ia->asst.response = response;
close_assistant (struct import_assistant *ia, int response)
{
ia->asst.response = response;