X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fvar-type-dialog.c;h=50ab417c14817c00905f00d705d63c1a5dbc0679;hb=8802135d750fdee1002c7e8bcaeda74a10e26d26;hp=d3eb97edf0515195a63418c9730eb1c53353f7ce;hpb=75fe94ea24fd7b12a0d99b8f36a79d8423e668d4;p=pspp-builds.git diff --git a/src/ui/gui/var-type-dialog.c b/src/ui/gui/var-type-dialog.c index d3eb97ed..50ab417c 100644 --- a/src/ui/gui/var-type-dialog.c +++ b/src/ui/gui/var-type-dialog.c @@ -1,21 +1,18 @@ -/* - PSPPIRE --- A Graphical User Interface for PSPP +/* PSPPIRE - a graphical user interface for PSPP. Copyright (C) 2005, 2006 Free Software Foundation - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ /* This module describes the behaviour of the Variable Type dialog box used @@ -46,7 +43,7 @@ struct tgs struct format_opt { - gchar desc[18]; + gchar desc[21]; struct fmt_spec spec; }; @@ -69,7 +66,8 @@ static const struct format_opt format_option[] = { "mmm yy", {FMT_MOYR, 6, 0} }, { "dd WK yyyy", {FMT_WKYR, 10, 0} }, { "dd WK yy", {FMT_WKYR, 8, 0} }, - { "dd-mmm-yyyy HH:MM", {FMT_DATETIME, 17, 0}} + { "dd-mmm-yyyy HH:MM", {FMT_DATETIME, 17, 0}}, + { "dd-mmm-yyyy HH:MM:SS", {FMT_DATETIME, 20, 0}} }; @@ -175,6 +173,7 @@ on_toggle_2 (GtkToggleButton *togglebutton, gpointer user_data) switch (dialog->active_button) { case BUTTON_STRING: + gtk_widget_show (dialog->entry_width); gtk_widget_show (dialog->width_decimals); gtk_widget_hide (dialog->label_decimals); gtk_widget_hide (dialog->entry_decimals); @@ -207,8 +206,8 @@ on_toggle_2 (GtkToggleButton *togglebutton, gpointer user_data) static gint on_var_type_ok_clicked (GtkWidget *w, gpointer data); +static gint hide_dialog (GtkWidget *w, gpointer data); -#define LEN 20 static void add_to_group (GtkWidget *w, gpointer data) @@ -333,6 +332,11 @@ var_type_dialog_create (GladeXML *xml) g_assert (xml); dialog->window = get_widget_assert (xml,"var_type_dialog"); + dialog->active_button = -1; + + + g_signal_connect (dialog->window, "delete-event", + G_CALLBACK (gtk_widget_hide_on_delete), NULL); gtk_window_set_transient_for (GTK_WINDOW (dialog->window), GTK_WINDOW (get_widget_assert (xml, "data_editor"))); @@ -464,7 +468,7 @@ var_type_dialog_create (GladeXML *xml) for ( i = 0 ; i < sizeof (dollar_format)/sizeof (dollar_format[0]) ; ++i ) { - char *template = fmt_dollar_template (&dollar_format[i]); + char *template = settings_dollar_template (&dollar_format[i]); gtk_list_store_append (list_store, &iter); gtk_list_store_set (list_store, &iter, 0, template, @@ -542,11 +546,17 @@ var_type_dialog_create (GladeXML *xml) GTK_SIGNAL_FUNC (preview_custom), dialog); - /* Connect the OK button */ + /* Connect to the OK button */ g_signal_connect (dialog->ok, "clicked", G_CALLBACK (on_var_type_ok_clicked), dialog); + /* And the cancel button */ + g_signal_connect (get_widget_assert (xml, "var_type_cancel") , "clicked", + G_CALLBACK (hide_dialog), + dialog); + + } return dialog; @@ -781,14 +791,14 @@ on_var_type_ok_clicked (GtkWidget *w, gpointer data) gint decimals = atoi (gtk_entry_get_text (GTK_ENTRY (dialog->entry_decimals))); - gint new_type = VAR_NUMERIC; + gint new_type = VAL_NUMERIC; gint new_width = 0; bool result = false; struct fmt_spec spec; switch (dialog->active_button) { case BUTTON_STRING: - new_type = VAR_STRING; + new_type = VAL_STRING; new_width = width; result = make_output_format_try (&spec, FMT_A, width, 0); break; @@ -832,10 +842,12 @@ on_var_type_ok_clicked (GtkWidget *w, gpointer data) -gint -on_var_type_cancel_clicked (GtkWidget *w, gpointer data) +static gint +hide_dialog (GtkWidget *w, gpointer data) { - gtk_widget_hide (w); + struct var_type_dialog *dialog = data; + + gtk_widget_hide (dialog->window); return FALSE; }