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 3431b35e80568563548fb58f7c20e1d13c108ee0..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
@@
-19,28
+19,27
@@
#include "split-file-dialog.h"
#include "psppire-selector.h"
#include "psppire-dialog.h"
#include "split-file-dialog.h"
#include "psppire-selector.h"
#include "psppire-dialog.h"
-#include "
helpe
r.h"
-#include "
data-editor
.h"
+#include "
executo
r.h"
+#include "
psppire-data-window
.h"
#include "dict-display.h"
#include "dict-display.h"
-#include <language/syntax-string-source.h>
-#include "syntax-editor.h"
+#include "helper.h"
#include <data/dictionary.h>
#include <data/dictionary.h>
+#include "psppire-var-view.h"
+
#include <gtk/gtk.h>
#include <gtk/gtk.h>
-#include <glade/glade.h>
#include "dialog-common.h"
/* FIXME: These shouldn't be here */
#include "dialog-common.h"
/* FIXME: These shouldn't be here */
-#include <gtksheet/gtksheet.h>
#include "psppire-var-store.h"
struct split_file_dialog
{
/* The XML that created the dialog */
#include "psppire-var-store.h"
struct split_file_dialog
{
/* The XML that created the dialog */
- G
ladeXML
*xml;
+ G
tkBuilder
*xml;
/* The dictionary to which this dialog pertains */
PsppireDict *dict;
/* The dictionary to which this dialog pertains */
PsppireDict *dict;
@@
-49,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;
};
@@
-60,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)))
@@
-70,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));
+ gint n_vars = psppire_var_view_append_names (PSPPIRE_VAR_VIEW (sfd->tv), 0, varlist);
if ( n_vars > 0 )
{
if ( n_vars > 0 )
{
@@
-110,7
+104,7
@@
static void
on_off_toggled (GtkToggleButton *togglebutton,
gpointer user_data)
{
on_off_toggled (GtkToggleButton *togglebutton,
gpointer user_data)
{
- G
ladeXML
*xml = user_data;
+ G
tkBuilder
*xml = user_data;
GtkWidget *dest = get_widget_assert (xml, "split-file-grouping-vars");
GtkWidget *selector = get_widget_assert (xml, "split-file-selector");
GtkWidget *source = get_widget_assert (xml, "split-file-dict-treeview");
GtkWidget *dest = get_widget_assert (xml, "split-file-grouping-vars");
GtkWidget *selector = get_widget_assert (xml, "split-file-selector");
GtkWidget *source = get_widget_assert (xml, "split-file-dict-treeview");
@@
-136,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 )
@@
-149,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);
@@
-165,81
+159,50
@@
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;
- struct data_editor *de = 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 ;
- GtkSheet *var_sheet ;
-
- sfd.xml = XML_NEW ("psppire.glade");
+ sfd.xml = builder_new ("split-file.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");
-
var_sheet = GTK_SHEET (get_widget_assert (de->xml, "variable_sheet
"));
+
sfd.tv = GTK_TREE_VIEW (get_widget_assert (sfd.xml, "split-file-grouping-vars
"));
-
vs = PSPPIRE_VAR_STORE (gtk_sheet_get_model (var_sheet)
);
+
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);
- attach_dictionary_to_treeview (GTK_TREE_VIEW (source),
- vs->dict,
- GTK_SELECTION_MULTIPLE, 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);
-
g_signal_connect (dialog, "refresh", G_CALLBACK (refresh), &sfd);
g_signal_connect (dialog, "refresh", G_CALLBACK (refresh), &sfd);
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
+
response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
switch (response)
{
case GTK_RESPONSE_OK:
response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
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);
-
- struct syntax_editor *se =
- (struct syntax_editor *) window_create (WINDOW_SYNTAX, NULL);
-
- gtk_text_buffer_insert_at_cursor (se->buffer, syntax, -1);
-
- g_free (syntax);
- }
+ g_free (paste_syntax_to_window (generate_syntax (&sfd)));
break;
default:
break;
break;
default:
break;