More generic use of event.
[familia.git] / src / gui.c
1 /****************************************************************************
2  *  Familia Lignum                                                          *
3  *  Copyright (C) 2011-2013 Rafał Długołęcki <bugz@dlugolecki.net.pl>       *
4  *                                                                          *
5  ****************************************************************************/
6
7 /**
8  * Only functions from this file should be used in gui.glade file.
9  */
10 #include <gtk/gtk.h>
11 #include <stdlib.h>
12
13 #include "debug.h"
14
15 #include "dialogs/openfile_dialog.h"
16 #include "dialogs/about_dialog.h"
17
18 void project_new()
19 {
20         debug("TODO: Project/New");
21 }
22
23 /**
24  * Wrapper for openfile_dialog. Should be used only in gui to properly handle
25  * gui events.
26  */
27 void project_open()
28 {
29         debug("Project/Open");
30         openfile_dialog();
31 }
32
33 void project_save()
34 {
35         debug("TODO: Project/Save");
36 }
37
38 void project_save_as()
39 {
40         debug("TODO: Project/Save As");
41 }
42
43 void project_ready()
44 {
45         debug("TODO: Project/Ready");
46 }
47
48 /**
49  * Wrapper for order_free. Should be used only in gui to properly release
50  * memory and handle gui events.
51  */
52 void project_close()
53 {
54         /* Project should be a pointer to the appropriate structure */
55         int project = 0;
56         debug("Project/Close");
57         if (project) {
58                 debug("> Project is in memory. Releasing data..");
59 /*              order_free(project);*/
60 /*              project = NULL;*/
61         }
62 }
63
64 /**
65  * Wrapper for gtk_main_quit. Should be used only in gui to properly release
66  * memory and handle gui events.
67  */
68 void program_close()
69 {
70         debug("Program/Close");
71         project_close();
72         gtk_main_quit();
73 }
74
75 /**
76  * Wrapper for about_dialog. Should be used only in gui to properly handle
77  * gui events.
78  */
79 void program_about()
80 {
81         debug("Help/About");
82         about_dialog();
83 }