-rw-r--r-- | src/napkin.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/napkin.cc b/src/napkin.cc index d9ba0c9..78f44f8 100644 --- a/src/napkin.cc +++ b/src/napkin.cc | |||
@@ -4,97 +4,97 @@ using std::cerr; | |||
4 | using std::endl; | 4 | using std::endl; |
5 | #include <fstream> | 5 | #include <fstream> |
6 | using std::ofstream; | 6 | using std::ofstream; |
7 | #include <cstdlib> | 7 | #include <cstdlib> |
8 | using std::min; | 8 | using std::min; |
9 | #include <stdexcept> | 9 | #include <stdexcept> |
10 | using std::runtime_error; | 10 | using std::runtime_error; |
11 | #include <list> | 11 | #include <list> |
12 | using std::list; | 12 | using std::list; |
13 | #include <vector> | 13 | #include <vector> |
14 | using std::vector; | 14 | using std::vector; |
15 | #include <string> | 15 | #include <string> |
16 | using std::string; | 16 | using std::string; |
17 | #include <gtkmm/main.h> | 17 | #include <gtkmm/main.h> |
18 | #include <gtkmm/window.h> | 18 | #include <gtkmm/window.h> |
19 | #include <gtkmm/box.h> | 19 | #include <gtkmm/box.h> |
20 | #include <gtkmm/statusbar.h> | 20 | #include <gtkmm/statusbar.h> |
21 | #include <gtkmm/uimanager.h> | 21 | #include <gtkmm/uimanager.h> |
22 | #include <gtkmm/stock.h> | 22 | #include <gtkmm/stock.h> |
23 | #include <gtkmm/toolbar.h> | 23 | #include <gtkmm/toolbar.h> |
24 | #include <gtkmm/filechooserdialog.h> | 24 | #include <gtkmm/filechooserdialog.h> |
25 | #include <gtkmm/messagedialog.h> | 25 | #include <gtkmm/messagedialog.h> |
26 | #include <gtkmm/aboutdialog.h> | 26 | #include <gtkmm/aboutdialog.h> |
27 | #include <napkin/exception.h> | 27 | #include <napkin/exception.h> |
28 | #include <napkin/util.h> | 28 | #include <napkin/util.h> |
29 | #include <napkin/st/decode.h> | 29 | #include <napkin/st/decode.h> |
30 | #include <napkin/st/download.h> | 30 | #include <napkin/st/download.h> |
31 | 31 | ||
32 | #include "db.h" | 32 | #include "db.h" |
33 | #include "sleep_timeline.h" | 33 | #include "sleep_timeline.h" |
34 | #include "dialogs.h" | 34 | #include "dialogs.h" |
35 | #include "sleep_history.h" | 35 | #include "sleep_history.h" |
36 | 36 | ||
37 | #include "config.h" | 37 | #include "config.h" |
38 | 38 | ||
39 | class napkin_ui : public Gtk::Window { | 39 | class napkin_ui : public Gtk::Window { |
40 | public: | 40 | public: |
41 | Gtk::VBox w_outer_box; | 41 | Gtk::VBox w_outer_box; |
42 | Gtk::Statusbar w_status_bar; | 42 | Gtk::Statusbar w_status_bar; |
43 | napkin::gtk::sleep_history_t w_history; | 43 | napkin::gtk::sleep_history_t w_history; |
44 | Glib::RefPtr<Gtk::UIManager> uiman; | 44 | Glib::RefPtr<Gtk::UIManager> uiman; |
45 | Glib::RefPtr<Gtk::ActionGroup> agroup; | 45 | Glib::RefPtr<Gtk::ActionGroup> agroup; |
46 | napkin::db_t db; | 46 | napkin::db_t db; |
47 | Glib::RefPtr<Gtk::Action> a_remove; | 47 | Glib::RefPtr<Gtk::Action> a_remove; |
48 | 48 | ||
49 | napkin_ui() | 49 | napkin_ui() |
50 | : w_history(db) | 50 | : w_history(db) |
51 | { | 51 | { |
52 | static char *ui_info = | 52 | static const char *ui_info = |
53 | "<ui>" | 53 | "<ui>" |
54 | "<menubar name='menu_bar'>" | 54 | "<menubar name='menu_bar'>" |
55 | "<menu action='menu_sleep'>" | 55 | "<menu action='menu_sleep'>" |
56 | #ifndef NDEBUG | 56 | #ifndef NDEBUG |
57 | "<menu action='menu_sleep_add'>" | 57 | "<menu action='menu_sleep_add'>" |
58 | #endif | 58 | #endif |
59 | "<menuitem action='sleep_add_from_sleeptracker'/>" | 59 | "<menuitem action='sleep_add_from_sleeptracker'/>" |
60 | #ifndef NDEBUG | 60 | #ifndef NDEBUG |
61 | "<menuitem action='sleep_add_from_datafile'/>" | 61 | "<menuitem action='sleep_add_from_datafile'/>" |
62 | "</menu>" | 62 | "</menu>" |
63 | #endif | 63 | #endif |
64 | "<menuitem action='sleep_remove'/>" | 64 | "<menuitem action='sleep_remove'/>" |
65 | "<menuitem action='exit'/>" | 65 | "<menuitem action='exit'/>" |
66 | "</menu>" | 66 | "</menu>" |
67 | "<menu action='menu_help'>" | 67 | "<menu action='menu_help'>" |
68 | "<menuitem action='help_about'/>" | 68 | "<menuitem action='help_about'/>" |
69 | "</menu>" | 69 | "</menu>" |
70 | "</menubar>" | 70 | "</menubar>" |
71 | "<toolbar action='tool_bar'>" | 71 | "<toolbar action='tool_bar'>" |
72 | "<toolitem action='sleep_add_from_sleeptracker'/>" | 72 | "<toolitem action='sleep_add_from_sleeptracker'/>" |
73 | "<toolitem action='sleep_remove'/>" | 73 | "<toolitem action='sleep_remove'/>" |
74 | "<separator expand='true'/>" | 74 | "<separator expand='true'/>" |
75 | #ifndef NDEBUG | 75 | #ifndef NDEBUG |
76 | "<toolitem action='debug'/>" | 76 | "<toolitem action='debug'/>" |
77 | "<separator/>" | 77 | "<separator/>" |
78 | #endif | 78 | #endif |
79 | "<toolitem action='exit'/>" | 79 | "<toolitem action='exit'/>" |
80 | "</toolbar>" | 80 | "</toolbar>" |
81 | "</ui>"; | 81 | "</ui>"; |
82 | agroup = Gtk::ActionGroup::create(); | 82 | agroup = Gtk::ActionGroup::create(); |
83 | agroup->add(Gtk::Action::create("menu_sleep","Sleep")); | 83 | agroup->add(Gtk::Action::create("menu_sleep","Sleep")); |
84 | agroup->add(Gtk::Action::create("menu_sleep_add","Add")); | 84 | agroup->add(Gtk::Action::create("menu_sleep_add","Add")); |
85 | agroup->add(Gtk::Action::create("sleep_add_from_sleeptracker",Gtk::Stock::CONNECT, | 85 | agroup->add(Gtk::Action::create("sleep_add_from_sleeptracker",Gtk::Stock::CONNECT, |
86 | "from sleeptracker","import sleeptracker data from watch"), | 86 | "from sleeptracker","import sleeptracker data from watch"), |
87 | Gtk::AccelKey("<Ctrl>d"), | 87 | Gtk::AccelKey("<Ctrl>d"), |
88 | sigc::mem_fun(*this,&napkin_ui::on_sleep_add_from_sleeptracker)); | 88 | sigc::mem_fun(*this,&napkin_ui::on_sleep_add_from_sleeptracker)); |
89 | #ifndef NDEBUG | 89 | #ifndef NDEBUG |
90 | agroup->add(Gtk::Action::create("sleep_add_from_datafile",Gtk::Stock::CONVERT, | 90 | agroup->add(Gtk::Action::create("sleep_add_from_datafile",Gtk::Stock::CONVERT, |
91 | "from data file","import sleeptracker data stored in a file"), | 91 | "from data file","import sleeptracker data stored in a file"), |
92 | sigc::mem_fun(*this,&napkin_ui::on_sleep_add_from_datafile)); | 92 | sigc::mem_fun(*this,&napkin_ui::on_sleep_add_from_datafile)); |
93 | #endif | 93 | #endif |
94 | agroup->add(a_remove=Gtk::Action::create("sleep_remove",Gtk::Stock::REMOVE, | 94 | agroup->add(a_remove=Gtk::Action::create("sleep_remove",Gtk::Stock::REMOVE, |
95 | "Remove","remove highlighted sleep event from the database"), | 95 | "Remove","remove highlighted sleep event from the database"), |
96 | Gtk::AccelKey("delete"), | 96 | Gtk::AccelKey("delete"), |
97 | sigc::mem_fun(*this,&napkin_ui::on_remove)); | 97 | sigc::mem_fun(*this,&napkin_ui::on_remove)); |
98 | agroup->add(Gtk::Action::create("exit",Gtk::Stock::QUIT,"Exit","Exit "PACKAGE_NAME), | 98 | agroup->add(Gtk::Action::create("exit",Gtk::Stock::QUIT,"Exit","Exit "PACKAGE_NAME), |
99 | Gtk::AccelKey("<control>w"), | 99 | Gtk::AccelKey("<control>w"), |
100 | sigc::mem_fun(*this,&napkin_ui::on_quit)); | 100 | sigc::mem_fun(*this,&napkin_ui::on_quit)); |