improve deletion of consecutive variables #55357
[pspp] / src / ui / gui / var-type-dialog.c
index 52811c9af5047c5af6205452f5c0198166b0e381..514d983c3d719529f776c19d257212d2557dfa3f 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPPIRE - a graphical user interface for PSPP.
-    Copyright (C) 2005, 2006, 2010, 2011, 2012  Free Software Foundation
+    Copyright (C) 2005, 2006, 2010, 2011, 2012, 2015  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
@@ -51,7 +51,9 @@ static const struct fmt_spec date_format[] =
     {FMT_WKYR, 10, 0},
     {FMT_WKYR, 8, 0},
     {FMT_DATETIME, 17, 0},
-    {FMT_DATETIME, 20, 0}
+    {FMT_DATETIME, 20, 0},
+    {FMT_YMDHMS, 16, 0},
+    {FMT_YMDHMS, 20, 0}
   };
 
 
@@ -197,12 +199,11 @@ psppire_var_type_dialog_new (const struct fmt_spec *format)
 {
   return PSPPIRE_VAR_TYPE_DIALOG (
     g_object_new (PSPPIRE_TYPE_VAR_TYPE_DIALOG,
-                  "orientation", PSPPIRE_HORIZONTAL,
                   "format", format,
                   NULL));
 }
 
-void
+gint
 psppire_var_type_dialog_run (GtkWindow *parent_window,
                              struct fmt_spec *format)
 {
@@ -213,10 +214,13 @@ psppire_var_type_dialog_run (GtkWindow *parent_window,
   gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
   gtk_widget_show (GTK_WIDGET (dialog));
 
-  if (psppire_dialog_run (PSPPIRE_DIALOG (dialog)) == GTK_RESPONSE_OK)
+  gint result = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
+  if (result == GTK_RESPONSE_OK)
     *format = *psppire_var_type_dialog_get_format (dialog);
 
   gtk_widget_destroy (GTK_WIDGET (dialog));
+
+  return result;
 }
 
 
@@ -531,7 +535,7 @@ psppire_var_type_dialog_constructor (GType                  type,
 
   xml = builder_new ("var-type-dialog.ui");
 
-  content_area = GTK_CONTAINER (PSPPIRE_DIALOG (dialog)->box);
+  content_area = GTK_CONTAINER (PSPPIRE_DIALOG (dialog));
   gtk_container_add (GTK_CONTAINER (content_area),
                      get_widget_assert (xml, "var-type-dialog"));
 
@@ -827,6 +831,8 @@ psppire_var_type_dialog_set_state (PsppireVarTypeDialog *dialog)
     case FMT_MOYR:
     case FMT_WKYR:
     case FMT_DATETIME:
+    case FMT_YMDHMS:
+    case FMT_MTIME:
     case FMT_TIME:
     case FMT_DTIME:
     case FMT_WKDAY: