projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
table-casereader: Put space between columns.
[pspp]
/
src
/
ui
/
gui
/
split-file-dialog.c
diff --git
a/src/ui/gui/split-file-dialog.c
b/src/ui/gui/split-file-dialog.c
index 458a3c53532a1eafdddbd9552f14cc4b11286ffc..9aacdffd4c80e578f4d578b9c390ee1e1bf197d7 100644
(file)
--- a/
src/ui/gui/split-file-dialog.c
+++ b/
src/ui/gui/split-file-dialog.c
@@
-1,5
+1,5
@@
/* PSPPIRE - a graphical user interface for PSPP.
/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2007 Free Software Foundation
+ Copyright (C) 2007
, 2010
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
@@
-22,10
+22,11
@@
#include "executor.h"
#include "psppire-data-window.h"
#include "dict-display.h"
#include "executor.h"
#include "psppire-data-window.h"
#include "dict-display.h"
-#include <language/syntax-string-source.h>
#include "helper.h"
#include <data/dictionary.h>
#include "helper.h"
#include <data/dictionary.h>
+#include "psppire-var-view.h"
+
#include <gtk/gtk.h>
#include <gtk/gtk.h>
@@
-47,7
+48,6
@@
struct split_file_dialog
upon which the file should be split */
GtkTreeView *tv;
upon which the file should be split */
GtkTreeView *tv;
-
PsppireSelector *selector;
};
PsppireSelector *selector;
};
@@
-58,9
+58,6
@@
generate_syntax (const struct split_file_dialog *sfd)
gchar *text;
GtkWidget *off = get_widget_assert (sfd->xml, "split-radiobutton0");
gchar *text;
GtkWidget *off = get_widget_assert (sfd->xml, "split-radiobutton0");
- GtkWidget *vars =
- get_widget_assert (sfd->xml, "split-file-grouping-vars");
-
GString *string = g_string_new ("SPLIT FILE OFF.");
if ( ! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (off)))
GString *string = g_string_new ("SPLIT FILE OFF.");
if ( ! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (off)))
@@
-68,8
+65,7
@@
generate_syntax (const struct split_file_dialog *sfd)
GString * varlist = g_string_sized_new (80);
GtkWidget *sort = get_widget_assert (sfd->xml, "split-radiobutton3");
GtkWidget *layered = get_widget_assert (sfd->xml, "split-radiobutton1");
GString * varlist = g_string_sized_new (80);
GtkWidget *sort = get_widget_assert (sfd->xml, "split-radiobutton3");
GtkWidget *layered = get_widget_assert (sfd->xml, "split-radiobutton1");
- gint n_vars = append_variable_names (varlist,
- sfd->dict, GTK_TREE_VIEW (vars), 0);
+ gint n_vars = psppire_var_view_append_names (PSPPIRE_VAR_VIEW (sfd->tv), 0, varlist);
if ( n_vars > 0 )
{
if ( n_vars > 0 )
{
@@
-134,7
+130,6
@@
refresh (PsppireDialog *dialog, struct split_file_dialog *d)
gint n_vars = dict_get_split_cnt (d->dict->dict);
gint n_vars = dict_get_split_cnt (d->dict->dict);
-
gtk_list_store_clear (GTK_LIST_STORE (liststore));
if ( n_vars == 0 )
gtk_list_store_clear (GTK_LIST_STORE (liststore));
if ( n_vars == 0 )
@@
-147,10
+142,11
@@
refresh (PsppireDialog *dialog, struct split_file_dialog *d)
for (i = 0 ; i < n_vars; ++i )
{
for (i = 0 ; i < n_vars; ++i )
{
- gint idx = var_get_dict_index (vars[i]);
-
gtk_list_store_append (GTK_LIST_STORE (liststore), &iter);
gtk_list_store_append (GTK_LIST_STORE (liststore), &iter);
- gtk_list_store_set (GTK_LIST_STORE (liststore), &iter, 0, idx, -1);
+
+ gtk_list_store_set (GTK_LIST_STORE (liststore), &iter,
+ 0, vars[i],
+ -1);
}
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(on), TRUE);
}
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(on), TRUE);
@@
-163,50
+159,36
@@
refresh (PsppireDialog *dialog, struct split_file_dialog *d)
/* Pops up the Split File dialog box */
void
/* Pops up the Split File dialog box */
void
-split_file_dialog (
GObject *o, gpointer data
)
+split_file_dialog (
PsppireDataWindow *de
)
{
gint response;
{
gint response;
- PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data);
struct split_file_dialog sfd;
PsppireVarStore *vs ;
GtkWidget *dialog ;
GtkWidget *source ;
struct split_file_dialog sfd;
PsppireVarStore *vs ;
GtkWidget *dialog ;
GtkWidget *source ;
- GtkWidget *dest ;
GtkWidget *selector ;
GtkWidget *on_off ;
GtkWidget *selector ;
GtkWidget *on_off ;
- sfd.xml = builder_new ("
psppir
e.ui");
+ sfd.xml = builder_new ("
split-fil
e.ui");
dialog = get_widget_assert (sfd.xml, "split-file-dialog");
source = get_widget_assert (sfd.xml, "split-file-dict-treeview");
dialog = get_widget_assert (sfd.xml, "split-file-dialog");
source = get_widget_assert (sfd.xml, "split-file-dict-treeview");
- dest = get_widget_assert (sfd.xml, "split-file-grouping-vars");
selector = get_widget_assert (sfd.xml, "split-file-selector");
on_off = get_widget_assert (sfd.xml, "split-radiobutton0");
selector = get_widget_assert (sfd.xml, "split-file-selector");
on_off = get_widget_assert (sfd.xml, "split-radiobutton0");
+ sfd.tv = GTK_TREE_VIEW (get_widget_assert (sfd.xml, "split-file-grouping-vars"));
+
g_object_get (de->data_editor, "var-store", &vs, NULL);
g_object_get (de->data_editor, "var-store", &vs, NULL);
- sfd.dict = vs->dict;
- sfd.tv = GTK_TREE_VIEW (dest);
- sfd.selector = PSPPIRE_SELECTOR (
- get_widget_assert (sfd.xml, "split-file-selector"));
+ g_object_get (vs, "dictionary", &sfd.dict, NULL);
- g_object_set (source, "dictionary",
- vs->dict, NULL);
+ sfd.selector = PSPPIRE_SELECTOR (get_widget_assert (sfd.xml, "split-file-selector"));
+ g_object_set (source, "model", sfd.dict, NULL);
g_signal_connect (on_off, "toggled", G_CALLBACK(on_off_toggled), sfd.xml);
g_signal_connect (on_off, "toggled", G_CALLBACK(on_off_toggled), sfd.xml);
-
- set_dest_model (GTK_TREE_VIEW (dest), vs->dict);
-
- psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector),
- source,
- dest,
- insert_source_row_into_tree_view,
- NULL,
- NULL);
-
g_signal_connect (dialog, "refresh", G_CALLBACK (refresh), &sfd);
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
g_signal_connect (dialog, "refresh", G_CALLBACK (refresh), &sfd);
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
@@
-217,22
+199,10
@@
split_file_dialog (GObject *o, gpointer data)
switch (response)
{
case GTK_RESPONSE_OK:
switch (response)
{
case GTK_RESPONSE_OK:
- {
- gchar *syntax = generate_syntax (&sfd);
-
- struct getl_interface *sss = create_syntax_string_source (syntax);
- execute_syntax (sss);
-
- g_free (syntax);
- }
+ g_free (execute_syntax_string (generate_syntax (&sfd)));
break;
case PSPPIRE_RESPONSE_PASTE:
break;
case PSPPIRE_RESPONSE_PASTE:
- {
- gchar *syntax = generate_syntax (&sfd);
- paste_syntax_in_new_window (syntax);
-
- g_free (syntax);
- }
+ g_free (paste_syntax_to_window (generate_syntax (&sfd)));
break;
default:
break;
break;
default:
break;