separators construction is initialisation
authorJohn Darrington <john@darrington.wattle.id.au>
Thu, 24 Jan 2013 18:09:47 +0000 (19:09 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Sat, 16 Feb 2013 14:03:24 +0000 (15:03 +0100)
src/ui/gui/page-assistant.c
src/ui/gui/page-separators.c
src/ui/gui/text-data-import-dialog.c
src/ui/gui/text-data-import-dialog.h

index c27d6c3472d2dd4be30921aa6d63f5ad7cf82fd5..f6ca9e8d10a57dcd003b7c1e62c05133349e7dea 100644 (file)
@@ -80,9 +80,9 @@ init_assistant (GtkWindow *parent_window)
 
   ia->sheet_spec = sheet_spec_page_create (ia);
   ia->intro = intro_page_create (ia);
+  ia->separators = separators_page_create (ia);
 
   ia->first_line = xzalloc (sizeof *ia->first_line);
-  ia->separators = xzalloc (sizeof *ia->separators);
   ia->formats = xzalloc (sizeof *ia->formats);
 
 
@@ -107,6 +107,7 @@ init_assistant (GtkWindow *parent_window)
   g_object_set (G_OBJECT (a->fixed_renderer),
                 "family", "Monospace",
                 (void *) NULL);
+
   return ia;
 }
 
index d16f0fe3d21c20992e481f7220b2dca889abed36..999950bcaf45f8d13213c148b9a5eb589344d78c 100644 (file)
 #define _(msgid) gettext (msgid)
 #define N_(msgid) msgid
 
-\f
+/* Page where the user chooses field separators. */
+struct separators_page
+  {
+    /* How to break lines into columns. */
+    struct string separators;   /* Field separators. */
+    struct string quotes;       /* Quote characters. */
+    bool escape;                /* Doubled quotes yield a quote mark? */
+
+    GtkWidget *page;
+    GtkWidget *custom_cb;
+    GtkWidget *custom_entry;
+    GtkWidget *quote_cb;
+    GtkWidget *quote_combo;
+    GtkEntry *quote_entry;
+    GtkWidget *escape_cb;
+    GtkTreeView *fields_tree_view;
+  };
+
 /* The "separators" page of the assistant. */
 
 static void revise_fields_preview (struct import_assistant *ia);
@@ -130,14 +147,15 @@ set_quote_list (GtkComboBoxEntry *cb)
 }
 
 /* Initializes IA's separators substructure. */
-void
-init_separators_page (struct import_assistant *ia)
+
+struct separators_page *
+separators_page_create (struct import_assistant *ia)
 {
   GtkBuilder *builder = ia->asst.builder;
-  struct separators_page *p = ia->separators;
+
   size_t i;
 
-  choose_likely_separators (ia);
+  struct separators_page *p = xzalloc (sizeof *p);
 
   p->page = add_page_to_assistant (ia, get_widget_assert (builder, "Separators"),
                                    GTK_ASSISTANT_PAGE_CONTENT);
@@ -148,7 +166,6 @@ init_separators_page (struct import_assistant *ia)
   p->quote_cb = get_widget_assert (builder, "quote-cb");
   p->escape_cb = get_widget_assert (builder, "escape");
 
-  set_separators (ia);
   set_quote_list (GTK_COMBO_BOX_ENTRY (p->quote_combo));
   p->fields_tree_view = GTK_TREE_VIEW (get_widget_assert (builder, "fields"));
   g_signal_connect (p->quote_combo, "changed",
@@ -164,6 +181,8 @@ init_separators_page (struct import_assistant *ia)
                       "toggled", G_CALLBACK (on_separator_toggle), ia);
   g_signal_connect (p->escape_cb, "toggled",
                     G_CALLBACK (on_separator_toggle), ia);
+
+  return p;
 }
 
 /* Frees IA's separators substructure. */
@@ -329,7 +348,6 @@ static void
 choose_column_names (struct import_assistant *ia)
 {
   const struct first_line_page *f = ia->first_line;
-  struct separators_page *s = ia->separators;
   struct dictionary *dict;
   unsigned long int generated_name_count = 0;
   struct column *col;
index fc1485ff8abfb161be681747b91c8d7fa508af39..6e978a3940a52541e79ca2ec6ed8d8e93419dc06 100644 (file)
@@ -82,7 +82,6 @@ text_data_import_assistant (PsppireDataWindow *dw)
 
   ssp = ia->sheet_spec;
   init_first_line_page (ia);
-  init_separators_page (ia);
 
   init_formats_page (ia);
 
index 29d4ab9bd30dc24c568c98c27ebac6967c4c9ae8..a0f2a1a797a2f7e67c541a3ebd341187d078c8f9 100644 (file)
@@ -71,24 +71,6 @@ struct first_line_page
   };
 
 
-/* Page where the user chooses field separators. */
-struct separators_page
-  {
-    /* How to break lines into columns. */
-    struct string separators;   /* Field separators. */
-    struct string quotes;       /* Quote characters. */
-    bool escape;                /* Doubled quotes yield a quote mark? */
-
-    GtkWidget *page;
-    GtkWidget *custom_cb;
-    GtkWidget *custom_entry;
-    GtkWidget *quote_cb;
-    GtkWidget *quote_combo;
-    GtkEntry *quote_entry;
-    GtkWidget *escape_cb;
-    GtkTreeView *fields_tree_view;
-  };
-
 /* Page where the user verifies and adjusts input formats. */
 struct formats_page
   {