849f1432ad7de8ba2274bf2cbd4c56d2851ceb80
[pspp-builds.git] / src / ui / gui / psppire.c
1 /* 
2     PSPPIRE --- A Graphical User Interface for PSPP
3     Copyright (C) 2004, 2005  Free Software Foundation
4     Written by John Darrington
5
6     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with this program; if not, write to the Free Software
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19     02110-1301, USA. */
20
21 /*
22  * Initial main.c file generated by Glade. Edit as required.
23  * Glade will not overwrite this file.
24  */
25
26
27 #include <gtk/gtk.h>
28 #include <gtk/gtk.h>
29 #include <glade/glade.h>
30 #include "menu-actions.h"
31 #include "psppire-dict.h"
32 #include "psppire-var-store.h"
33 #include "psppire-data-store.h"
34
35 #include "helper.h"
36 #include "data-sheet.h"
37 #include "var-sheet.h"
38 #include "psppire-case-array.h"
39
40 GladeXML *xml;
41
42
43 PsppireDict *the_dictionary = 0;
44 PsppireCaseArray *the_cases = 0;
45
46
47 PsppireDataStore *data_store = 0;
48
49
50 int 
51 main(int argc, char *argv[]) 
52 {
53
54   gtk_init(&argc, &argv);
55
56   glade_init();
57
58   the_dictionary = psppire_dict_new();
59
60   /* Create the model for the var_sheet */
61   PsppireVarStore *var_store = psppire_var_store_new(the_dictionary);
62
63   /* Create the model for the data sheet */
64   the_cases = psppire_case_array_new(100, 20);
65
66   data_store = psppire_data_store_new(the_dictionary, the_cases);
67
68
69   /* load the interface */
70   xml = glade_xml_new("psppire.glade", NULL, NULL);
71
72   if ( !xml ) 
73     {
74       g_print("Is psppire.glade in current directory?\n");
75       return 1;
76     }
77
78   GtkWidget *data_editor = get_widget_assert(xml, "data_editor");
79   gtk_window_set_icon_from_file(GTK_WINDOW(data_editor), "psppicon.png",0);
80
81   /* connect the signals in the interface */
82   glade_xml_signal_autoconnect(xml);
83
84   GtkSheet *var_sheet  = GTK_SHEET(get_widget_assert(xml, "variable_sheet"));
85   GtkSheet *data_sheet = GTK_SHEET(get_widget_assert(xml, "data_sheet"));
86
87   gtk_sheet_set_model(var_sheet, G_SHEET_MODEL(var_store));
88   
89   gtk_sheet_set_model(data_sheet, G_SHEET_MODEL(data_store));
90
91
92   gtk_init_add(callbacks_on_init, 0);
93
94   /* start the event loop */
95   gtk_main();
96   return 0;
97 }
98