#include <gtk/gtk.h>
-
+#include "widget-io.h"
#include "checkbox-treeview.h"
#include "descriptives-dialog.h"
\f
/* The "intro" page of the assistant. */
-static void on_intro_amount_changed (GtkToggleButton *button,
- struct import_assistant *);
+static void on_intro_amount_changed (struct import_assistant *);
/* Initializes IA's intro substructure. */
static void
GtkBuilder *builder = ia->asst.builder;
struct intro_page *p = &ia->intro;
struct string s;
+ GtkWidget *hbox_n_cases ;
+ GtkWidget *hbox_percent ;
+ GtkWidget *table ;
+
+
+ p->n_cases_spin = gtk_spin_button_new_with_range (0, INT_MAX, 100);
+
+ hbox_n_cases = widget_scanf (_("Only the first %4d cases"), &p->n_cases_spin);
+
+ table = get_widget_assert (builder, "button-table");
+
+ gtk_table_attach_defaults (GTK_TABLE (table), hbox_n_cases,
+ 1, 2,
+ 1, 2);
+
+ p->percent_spin = gtk_spin_button_new_with_range (0, 100, 10);
+
+ hbox_percent = widget_scanf (_("Only the first %3d %% of file (approximately)"), &p->percent_spin);
+
+ gtk_table_attach_defaults (GTK_TABLE (table), hbox_percent,
+ 1, 2,
+ 2, 3);
p->page = add_page_to_assistant (ia, get_widget_assert (builder, "Intro"),
GTK_ASSISTANT_PAGE_INTRO);
+
p->all_cases_button = get_widget_assert (builder, "import-all-cases");
+
p->n_cases_button = get_widget_assert (builder, "import-n-cases");
- p->n_cases_spin = get_widget_assert (builder, "n-cases-spin");
+
p->percent_button = get_widget_assert (builder, "import-percent");
- p->percent_spin = get_widget_assert (builder, "percent-spin");
- g_signal_connect (p->all_cases_button, "toggled",
+
+ g_signal_connect_swapped (p->all_cases_button, "toggled",
G_CALLBACK (on_intro_amount_changed), ia);
- g_signal_connect (p->n_cases_button, "toggled",
+ g_signal_connect_swapped (p->n_cases_button, "toggled",
G_CALLBACK (on_intro_amount_changed), ia);
- g_signal_connect (p->percent_button, "toggled",
+ g_signal_connect_swapped (p->percent_button, "toggled",
G_CALLBACK (on_intro_amount_changed), ia);
+ on_intro_amount_changed (ia);
+
ds_init_empty (&s);
ds_put_cstr (&s, _("This assistant will guide you through the process of "
"importing data into PSPP from a text file with one line "
/* Called when one of the radio buttons is clicked. */
static void
-on_intro_amount_changed (GtkToggleButton *button UNUSED,
- struct import_assistant *ia)
+on_intro_amount_changed (struct import_assistant *ia)
{
struct intro_page *p = &ia->intro;
gtk_toggle_button_get_active (
GTK_TOGGLE_BUTTON (p->n_cases_button)));
- gtk_widget_set_sensitive (ia->intro.percent_spin,
+ gtk_widget_set_sensitive (p->percent_spin,
gtk_toggle_button_get_active (
GTK_TOGGLE_BUTTON (p->percent_button)));
}
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="left_padding">12</property>
<child>
- <object class="GtkVBox" id="vbox1">
+ <object class="GtkTable" id="button-table">
<property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">2</property>
<child>
<object class="GtkRadioButton" id="import-all-cases">
- <property name="label" translatable="yes">All cases</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
- <property name="position">0</property>
+ <property name="x_options"></property>
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox1">
+ <object class="GtkRadioButton" id="import-n-cases">
<property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkRadioButton" id="import-n-cases">
- <property name="label" translatable="yes">Only first </property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">import-all-cases</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkSpinButton" id="n-cases-spin">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="adjustment">adjustment2</property>
- <property name="climb_rate">10</property>
- <property name="snap_to_ticks">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes"> cases</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">import-all-cases</property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options"></property>
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox3">
+ <object class="GtkRadioButton" id="import-percent">
<property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkRadioButton" id="import-percent">
- <property name="label" translatable="yes">Only first </property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">import-all-cases</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkSpinButton" id="percent-spin">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="adjustment">adjustment1</property>
- <property name="snap_to_ticks">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">% of file (approximately)</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">import-all-cases</property>
</object>
<packing>
- <property name="position">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">All cases</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
</child>
</object>
<property name="upper">100</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
- <property name="page_size">0</property>
</object>
<object class="GtkAdjustment" id="adjustment2">
<property name="value">1000</property>
<property name="upper">100000000</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
- <property name="page_size">0</property>
</object>
</interface>