/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2011 Free Software Foundation
+ Copyright (C) 2011, 2012 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
#include "count-dialog.h"
#include <gtk/gtk.h>
-#include "helper.h"
+#include "builder-wrapper.h"
#include "psppire-dialog.h"
#include "psppire-selector.h"
#include "psppire-val-chooser.h"
#include "psppire-acr.h"
#include "dialog-common.h"
+
#include <ui/syntax-gen.h>
#include "executor.h"
+#include "helper.h"
struct cnt_dialog
{
void count_dialog (PsppireDataWindow *de)
{
gint response;
- PsppireVarStore *vs = NULL;
struct cnt_dialog cnt;
GtkBuilder *builder = builder_new ("count.ui");
g_signal_connect (cnt.dialog, "refresh", G_CALLBACK (refresh), &cnt);
- g_object_get (de->data_editor, "var-store", &vs, NULL);
-
- g_object_get (vs, "dictionary", &cnt.dict, NULL);
+ g_object_get (de->data_editor, "dictionary", &cnt.dict, NULL);
gtk_window_set_transient_for (GTK_WINDOW (cnt.dialog), GTK_WINDOW (de));
}
+ g_object_unref (cnt.value_list);
g_object_unref (builder);
}
const gchar *s = NULL;
gboolean ok;
GtkTreeIter iter;
- GString *str = g_string_sized_new (100);
+ struct string dds;
+
+ ds_init_empty (&dds);
- g_string_append (str, "\nCOUNT ");
+ ds_put_cstr (&dds, "\nCOUNT ");
- g_string_append (str, gtk_entry_get_text (GTK_ENTRY (cnt->target)));
+ ds_put_cstr (&dds, gtk_entry_get_text (GTK_ENTRY (cnt->target)));
- g_string_append (str, " =");
+ ds_put_cstr (&dds, " =");
- psppire_var_view_append_names (PSPPIRE_VAR_VIEW (cnt->variable_treeview), 0, str);
+ psppire_var_view_append_names_str (PSPPIRE_VAR_VIEW (cnt->variable_treeview), 0, &dds);
- g_string_append (str, "(");
+ ds_put_cstr (&dds, "(");
for (ok = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (cnt->value_list),
&iter);
ok;
ov = g_value_get_boxed (&a_value);
- g_string_append (str, " ");
- old_value_append_syntax (str, ov);
+ ds_put_cstr (&dds, " ");
+ old_value_append_syntax (&dds, ov);
}
- g_string_append (str, ").");
+ ds_put_cstr (&dds, ").");
s = gtk_entry_get_text (GTK_ENTRY (cnt->label));
if (0 != strcmp (s, ""))
{
- struct string ds;
- ds_init_empty (&ds);
- g_string_append (str, "\nVARIABLE LABELS ");
-
- g_string_append (str, gtk_entry_get_text (GTK_ENTRY (cnt->target)));
+ ds_put_cstr (&dds, "\nVARIABLE LABELS ");
- g_string_append (str, " ");
+ ds_put_cstr (&dds, gtk_entry_get_text (GTK_ENTRY (cnt->target)));
- syntax_gen_string (&ds, ss_cstr (s));
+ ds_put_cstr (&dds, " ");
- g_string_append (str, ds_cstr (&ds));
+ syntax_gen_string (&dds, ss_cstr (s));
- g_string_append (str, ".");
- ds_destroy (&ds);
+ ds_put_cstr (&dds, ".");
}
- g_string_append (str, "\nEXECUTE.\n");
+ ds_put_cstr (&dds, "\nEXECUTE.\n");
- text = str->str;
+ text = ds_steal_cstr (&dds);
- g_string_free (str, FALSE);
+ ds_destroy (&dds);
return text;
}