projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Frequencies Dialog: Avoid initialising things more than once per dialog
[pspp]
/
src
/
ui
/
gui
/
aggregate-dialog.c
diff --git
a/src/ui/gui/aggregate-dialog.c
b/src/ui/gui/aggregate-dialog.c
index a5c243a8e2de40c5fa4f80d5f581248f471807a0..c6f5ad838f925ab61b6d6d53a06b211f7980e13f 100644
(file)
--- a/
src/ui/gui/aggregate-dialog.c
+++ b/
src/ui/gui/aggregate-dialog.c
@@
-1,5
+1,5
@@
/* PSPPIRE - a graphical user interface for PSPP.
/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2010, 2011, 2012 Free Software Foundation
+ Copyright (C) 2010, 2011, 2012
, 2013, 2014
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
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
@@
-18,6
+18,8
@@
#include "dialog-common.h"
#include "dialog-common.h"
+#include <float.h>
+#include <gl/c-xvasprintf.h>
#include <language/stats/aggregate.h>
#include <ui/syntax-gen.h>
#include <language/stats/aggregate.h>
#include <ui/syntax-gen.h>
@@
-93,15
+95,6
@@
struct aggregate
static char * generate_syntax (const struct aggregate *rd);
static char * generate_syntax (const struct aggregate *rd);
-/* Makes widget W's sensitivity follow the active state of TOGGLE */
-static void
-sensitive_if_active (GtkToggleButton *toggle, GtkWidget *w)
-{
- gboolean active = gtk_toggle_button_get_active (toggle);
-
- gtk_widget_set_sensitive (w, active);
-}
-
static void update_arguments (struct aggregate *agg);
static void update_arguments (struct aggregate *agg);
@@
-160,11
+153,12
@@
choose_filename (struct aggregate *fd)
GtkFileFilter *filter;
GtkWidget *dialog = gtk_file_chooser_dialog_new (_("Aggregate destination file"),
GtkFileFilter *filter;
GtkWidget *dialog = gtk_file_chooser_dialog_new (_("Aggregate destination file"),
- GTK_WINDOW (fd->de),
- GTK_FILE_CHOOSER_ACTION_SAVE,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
- NULL);
+ GTK_WINDOW (fd->de),
+ GTK_FILE_CHOOSER_ACTION_SAVE,
+ _("Cancel"), GTK_RESPONSE_CANCEL,
+ _("Save"), GTK_RESPONSE_ACCEPT,
+ NULL);
+
g_object_set (dialog, "local-only", FALSE, NULL);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
g_object_set (dialog, "local-only", FALSE, NULL);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
@@
-175,6
+169,11
@@
choose_filename (struct aggregate *fd)
gtk_file_filter_add_mime_type (filter, "application/x-spss-sav");
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
gtk_file_filter_add_mime_type (filter, "application/x-spss-sav");
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
+ filter = gtk_file_filter_new ();
+ gtk_file_filter_set_name (filter, _("Compressed System Files (*.zsav)"));
+ gtk_file_filter_add_pattern (filter, "*.zsav");
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
+
filter = gtk_file_filter_new ();
gtk_file_filter_set_name (filter, _("Portable Files (*.por) "));
gtk_file_filter_add_mime_type (filter, "application/x-spss-por");
filter = gtk_file_filter_new ();
gtk_file_filter_set_name (filter, _("Portable Files (*.por) "));
gtk_file_filter_add_mime_type (filter, "application/x-spss-por");
@@
-435,15
+434,14
@@
on_acr_change (const struct aggregate *agg, GtkTreeView *tv)
gtk_entry_set_text (GTK_ENTRY (agg->summary_var_label_entry), label);
gtk_entry_set_text (GTK_ENTRY (agg->summary_sv_entry), srcvar);
gtk_entry_set_text (GTK_ENTRY (agg->summary_var_label_entry), label);
gtk_entry_set_text (GTK_ENTRY (agg->summary_sv_entry), srcvar);
- text =
g_strdup_printf ("%g"
, arg1);
+ text =
c_xasprintf ("%.*g", DBL_DIG + 1
, arg1);
gtk_entry_set_text (GTK_ENTRY (agg->summary_arg1_entry), text);
g_free (text);
gtk_entry_set_text (GTK_ENTRY (agg->summary_arg1_entry), text);
g_free (text);
- text =
g_strdup_printf ("%g"
, arg2);
+ text =
c_xasprintf ("%.*g", DBL_DIG + 1
, arg2);
gtk_entry_set_text (GTK_ENTRY (agg->summary_arg2_entry), text);
g_free (text);
gtk_entry_set_text (GTK_ENTRY (agg->summary_arg2_entry), text);
g_free (text);
-
gtk_combo_box_set_active (GTK_COMBO_BOX (agg->function_combo), f_idx);
}
gtk_combo_box_set_active (GTK_COMBO_BOX (agg->function_combo), f_idx);
}
@@
-577,7
+575,7
@@
aggregate_dialog (PsppireDataWindow *dw)
dialog_state_valid, &fd);
g_signal_connect (fd.filename_radiobutton, "toggled",
dialog_state_valid, &fd);
g_signal_connect (fd.filename_radiobutton, "toggled",
- G_CALLBACK (se
nsitive_if_activ
e), fd.filename_box );
+ G_CALLBACK (se
t_sensitivity_from_toggl
e), fd.filename_box );
g_signal_connect_swapped (fd.filename_button, "clicked",
G_CALLBACK (choose_filename), &fd);
g_signal_connect_swapped (fd.filename_button, "clicked",
G_CALLBACK (choose_filename), &fd);
@@
-679,17
+677,22
@@
append_summary_spec (const struct aggregate *agg, GtkTreeIter *iter, GString *st
if ( has_src_vars != AGR_SV_NO)
{
if ( has_src_vars != AGR_SV_NO)
{
- g_string_append (string, " (");
+ struct string dss;
+ ds_init_cstr (&dss, " (");
-
g_string_append (string
, srcvar);
+
ds_put_cstr (&dss
, srcvar);
if ( arity > 0)
if ( arity > 0)
-
g_string_append_printf (string, ", %g"
, arg1);
+
ds_put_c_format (&dss, ", %.*g", DBL_DIG + 1
, arg1);
if ( arity > 1)
if ( arity > 1)
- g_string_append_printf (string, ", %g", arg2);
+ ds_put_c_format (&dss, ", %.*g", DBL_DIG + 1, arg2);
+
+ ds_put_cstr (&dss, ")");
+
+ g_string_append (string, ds_cstr (&dss));
-
g_string_append (string, ")"
);
+
ds_destroy (&dss
);
}
free (label);
}
free (label);