X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpage-assistant.c;h=683494b947165a815a7a4e441fdca6cb0edeb096;hb=fce028c380d496e42823fd24774e0159ed7cc110;hp=b0b616e2654ac47f448a7b6ade3fc7d9ee5d8c75;hpb=6e29a48cd6e626fb2542d5babcbdcc7f67c071d3;p=pspp diff --git a/src/ui/gui/page-assistant.c b/src/ui/gui/page-assistant.c index b0b616e265..683494b947 100644 --- a/src/ui/gui/page-assistant.c +++ b/src/ui/gui/page-assistant.c @@ -20,7 +20,6 @@ #include #include -#include #include #include #include @@ -46,9 +45,7 @@ #include "ui/gui/psppire-encoding-selector.h" #include "ui/gui/psppire-empty-list-store.h" #include "ui/gui/psppire-var-sheet.h" -#include "ui/gui/psppire-var-store.h" -#include "gl/error.h" #include "gl/intprops.h" #include "gl/xalloc.h" @@ -65,7 +62,6 @@ static void on_cancel (GtkAssistant *assistant, 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 *); -static void close_assistant (struct import_assistant *, int response); /* Initializes IA's asst substructure. PARENT_WINDOW must be the window to use as the assistant window's parent. */ @@ -155,10 +151,15 @@ on_prepare (GtkAssistant *assistant, GtkWidget *page, { int pn = gtk_assistant_get_current_page (assistant); + gtk_widget_show (ia->asst.reset_button); + gtk_widget_hide (ia->asst.paste_button); + if ( ia->spreadsheet) { if (pn == 0) - prepare_sheet_spec_page (ia); + { + prepare_sheet_spec_page (ia); + } else if (pn == 1) { post_sheet_spec_page (ia); @@ -167,10 +168,23 @@ on_prepare (GtkAssistant *assistant, GtkWidget *page, } else { - if (pn == 0) - prepare_separators_page (ia); - else if (pn == 3) - prepare_formats_page (ia); + switch (pn) + { + case 0: + reset_intro_page (ia); + break; + case 1: + reset_first_line_page (ia); + break; + case 2: + prepare_separators_page (ia); + reset_separators_page (ia); + break; + case 3: + prepare_formats_page (ia); + reset_formats_page (ia); + break; + } } @@ -179,18 +193,6 @@ on_prepare (GtkAssistant *assistant, GtkWidget *page, gtk_widget_grab_focus (assistant->apply); else gtk_widget_grab_focus (assistant->forward); - - - - -#if 0 - gtk_widget_show (ia->asst.reset_button); - if (page == ia->formats->page) - gtk_widget_show (ia->asst.paste_button); - else - gtk_widget_hide (ia->asst.paste_button); - -#endif } /* Called when the Cancel button in the assistant is clicked. */ @@ -220,21 +222,38 @@ on_paste (GtkButton *button, struct import_assistant *ia) 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); - - if (page == ia->intro->page) - reset_intro_page (ia); - else if (page == ia->first_line->page) - reset_first_line_page (ia); - else if (page == ia->separators->page) - reset_separators_page (ia); - else if (page == ia->formats->page) - reset_formats_page (ia); - else if (page == ia->sheet_spec->page) - reset_sheet_spec_page (ia); -#endif + gint pn = gtk_assistant_get_current_page (ia->asst.assistant); + + if ( ia->spreadsheet) + { + switch (pn) + { + case 0: + reset_sheet_spec_page (ia); + break; + case 1: + reset_formats_page (ia); + break; + } + } + else + { + switch (pn) + { + case 0: + reset_intro_page (ia); + break; + case 1: + reset_first_line_page (ia); + break; + case 2: + reset_separators_page (ia); + break; + case 3: + reset_formats_page (ia); + break; + } + } } /* Causes the assistant to close, returning RESPONSE for @@ -243,7 +262,10 @@ static void close_assistant (struct import_assistant *ia, int response) { ia->asst.response = response; - g_main_loop_quit (ia->asst.main_loop); + /* Use our loop_done variable until we find out + why g_main_loop_quit (ia->asst.main_loop); doesn't work. + */ + ia->asst.loop_done = true; gtk_widget_hide (GTK_WIDGET (ia->asst.assistant)); }