1 /* $Id$ */
2 /* Copyright (c) 2009-2015 Pierre Pronchery <khorben@defora.org> */
3 /* This file is part of DeforaOS Desktop Editor */
4 /* All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
18 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
23 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
28
29
30
31 #include <stdlib.h>
32 #include <libintl.h>
33 #include <Desktop.h>
34 #include "editor.h"
35 #include "callbacks.h"
36 #include "../config.h"
37 #define _(string) gettext(string)
38
39
40 /* public */
41 /* functions */
on_closex(gpointer data)42 gboolean on_closex(gpointer data)
43 {
44 Editor * editor = data;
45
46 editor_close(editor);
47 return TRUE;
48 }
49
50
51 /* on_edit_copy */
on_edit_copy(gpointer data)52 void on_edit_copy(gpointer data)
53 {
54 Editor * editor = data;
55
56 editor_copy(editor);
57 }
58
59
60 /* on_edit_cut */
on_edit_cut(gpointer data)61 void on_edit_cut(gpointer data)
62 {
63 Editor * editor = data;
64
65 editor_cut(editor);
66 }
67
68
69 /* on_edit_find */
on_edit_find(gpointer data)70 void on_edit_find(gpointer data)
71 {
72 Editor * editor = data;
73
74 on_find(editor);
75 }
76
77
78 /* on_edit_paste */
on_edit_paste(gpointer data)79 void on_edit_paste(gpointer data)
80 {
81 Editor * editor = data;
82
83 editor_paste(editor);
84 }
85
86
87 /* on_edit_preferences */
on_edit_preferences(gpointer data)88 void on_edit_preferences(gpointer data)
89 {
90 Editor * editor = data;
91
92 editor_show_preferences(editor, TRUE);
93 }
94
95
96 /* on_edit_select_all */
on_edit_select_all(gpointer data)97 void on_edit_select_all(gpointer data)
98 {
99 Editor * editor = data;
100
101 editor_select_all(editor);
102 }
103
104
105 /* on_edit_unselect_all */
on_edit_unselect_all(gpointer data)106 void on_edit_unselect_all(gpointer data)
107 {
108 Editor * editor = data;
109
110 editor_unselect_all(editor);
111 }
112
113
114 /* on_file_close */
on_file_close(gpointer data)115 void on_file_close(gpointer data)
116 {
117 Editor * editor = data;
118
119 editor_close(editor);
120 }
121
122
123 /* on_file_new */
on_file_new(gpointer data)124 void on_file_new(gpointer data)
125 {
126 Editor * editor = data;
127
128 editor_open(editor, NULL);
129 }
130
131
132 /* on_file_open */
on_file_open(gpointer data)133 void on_file_open(gpointer data)
134 {
135 Editor * editor = data;
136
137 editor_open_dialog(editor);
138 }
139
140
141 /* on_file_print */
on_file_print(gpointer data)142 void on_file_print(gpointer data)
143 {
144 Editor * editor = data;
145
146 editor_print_dialog(editor);
147 }
148
149
150 /* on_file_properties */
on_file_properties(gpointer data)151 void on_file_properties(gpointer data)
152 {
153 Editor * editor = data;
154
155 editor_show_properties(editor, TRUE);
156 }
157
158
159 /* on_file_save */
on_file_save(gpointer data)160 void on_file_save(gpointer data)
161 {
162 Editor * editor = data;
163
164 editor_save(editor);
165 }
166
167
168 /* on_file_save_as */
on_file_save_as(gpointer data)169 void on_file_save_as(gpointer data)
170 {
171 Editor * editor = data;
172
173 editor_save_as_dialog(editor);
174 }
175
176
177 /* on_help_about */
on_help_about(gpointer data)178 void on_help_about(gpointer data)
179 {
180 Editor * editor = data;
181
182 editor_about(editor);
183 }
184
185
186 /* on_help_contents */
on_help_contents(gpointer data)187 void on_help_contents(gpointer data)
188 {
189 desktop_help_contents(PACKAGE, "editor");
190 }
191
192
193 /* on_insert_file */
on_insert_file(gpointer data)194 void on_insert_file(gpointer data)
195 {
196 Editor * editor = data;
197
198 editor_insert_file_dialog(editor);
199 }
200
201
202 /* toolbar */
203 /* on_close */
on_close(gpointer data)204 void on_close(gpointer data)
205 {
206 Editor * editor = data;
207
208 editor_close(editor);
209 }
210
211
212 /* on_copy */
on_copy(gpointer data)213 void on_copy(gpointer data)
214 {
215 Editor * editor = data;
216
217 editor_copy(editor);
218 }
219
220
221 /* on_cut */
on_cut(gpointer data)222 void on_cut(gpointer data)
223 {
224 Editor * editor = data;
225
226 editor_cut(editor);
227 }
228
229
230 /* on_find */
on_find(gpointer data)231 void on_find(gpointer data)
232 {
233 Editor * editor = data;
234
235 editor_find(editor, NULL);
236 }
237
238
239 /* on_new */
on_new(gpointer data)240 void on_new(gpointer data)
241 {
242 Editor * editor = data;
243
244 editor_open(editor, NULL);
245 }
246
247
248 /* on_open */
on_open(gpointer data)249 void on_open(gpointer data)
250 {
251 Editor * editor = data;
252
253 editor_open_dialog(editor);
254 }
255
256
257 /* on_paste */
on_paste(gpointer data)258 void on_paste(gpointer data)
259 {
260 Editor * editor = data;
261
262 editor_paste(editor);
263 }
264
265
266 /* on_print */
on_print(gpointer data)267 void on_print(gpointer data)
268 {
269 Editor * editor = data;
270
271 editor_print_dialog(editor);
272 }
273
274
275 /* on_save */
on_save(gpointer data)276 void on_save(gpointer data)
277 {
278 Editor * editor = data;
279
280 editor_save(editor);
281 }
282
283
284 /* on_save_as */
on_save_as(gpointer data)285 void on_save_as(gpointer data)
286 {
287 Editor * editor = data;
288
289 editor_save_as_dialog(editor);
290 }
291
292
293 /* on_preferences */
on_preferences(gpointer data)294 void on_preferences(gpointer data)
295 {
296 Editor * editor = data;
297
298 on_edit_preferences(editor);
299 }
300
301
302 /* on_properties */
on_properties(gpointer data)303 void on_properties(gpointer data)
304 {
305 Editor * editor = data;
306
307 on_file_properties(editor);
308 }
309