1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 /*
3  *  ianjuta-document.c -- Autogenerated from libanjuta.idl
4  *
5  *  This program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2 of the License, or
8  *  (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU Library General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with this program; if not, write to the Free Software
17  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
20 /**
21  * SECTION:ianjuta-document
22  * @title: IAnjutaDocument
23  * @short_description: Interface for all kind of editable resources that
24  * will be managed by IAnjutaDocumentManager
25  * @see_also:
26  * @stability: Unstable
27  * @include: libanjuta/interfaces/ianjuta-document.h
28  *
29  */
30 
31 #include "ianjuta-document.h"
32 #include "libanjuta-iface-marshallers.h"
33 
34 GQuark
ianjuta_document_error_quark(void)35 ianjuta_document_error_quark (void)
36 {
37 	static GQuark quark = 0;
38 
39 	if (quark == 0) {
40 		quark = g_quark_from_static_string ("ianjuta-document-quark");
41 	}
42 
43 	return quark;
44 }
45 
46 /**
47  * ianjuta_document_begin_undo_action:
48  * @obj: Self
49  * @err: Error propagation and reporting
50  *
51  * Begins the mark of undoable action. Calls to this are stacked and
52  * each must be ended with ianjuta_document_end_action().
53  */
54 void
ianjuta_document_begin_undo_action(IAnjutaDocument * obj,GError ** err)55 ianjuta_document_begin_undo_action (IAnjutaDocument *obj, GError **err)
56 {
57 	g_return_if_fail (IANJUTA_IS_DOCUMENT(obj));
58 	IANJUTA_DOCUMENT_GET_IFACE (obj)->begin_undo_action (obj, err);
59 }
60 
61 /* Default implementation */
62 static void
ianjuta_document_begin_undo_action_default(IAnjutaDocument * obj,GError ** err)63 ianjuta_document_begin_undo_action_default (IAnjutaDocument *obj, GError **err)
64 {
65 	g_return_if_reached ();
66 }
67 
68 /**
69  * ianjuta_document_can_redo:
70  * @obj: Self
71  * @err: Error propagation and reporting
72  *
73  * Can the editor redo the last operation?
74  *
75  * Returns: TRUE if editor can redo, else FALSE
76  */
77 gboolean
ianjuta_document_can_redo(IAnjutaDocument * obj,GError ** err)78 ianjuta_document_can_redo (IAnjutaDocument *obj, GError **err)
79 {
80 	g_return_val_if_fail (IANJUTA_IS_DOCUMENT(obj), FALSE);
81 	return IANJUTA_DOCUMENT_GET_IFACE (obj)->can_redo (obj, err);
82 }
83 
84 /* Default implementation */
85 static gboolean
ianjuta_document_can_redo_default(IAnjutaDocument * obj,GError ** err)86 ianjuta_document_can_redo_default (IAnjutaDocument *obj, GError **err)
87 {
88 	g_return_val_if_reached (FALSE);
89 }
90 
91 /**
92  * ianjuta_document_can_undo:
93  * @obj: Self
94  * @err: Error propagation and reporting
95  *
96  * Can the editor undo the last operation?
97  *
98  * Returns: TRUE if editor can undo, else FALSE
99  */
100 gboolean
ianjuta_document_can_undo(IAnjutaDocument * obj,GError ** err)101 ianjuta_document_can_undo (IAnjutaDocument *obj, GError **err)
102 {
103 	g_return_val_if_fail (IANJUTA_IS_DOCUMENT(obj), FALSE);
104 	return IANJUTA_DOCUMENT_GET_IFACE (obj)->can_undo (obj, err);
105 }
106 
107 /* Default implementation */
108 static gboolean
ianjuta_document_can_undo_default(IAnjutaDocument * obj,GError ** err)109 ianjuta_document_can_undo_default (IAnjutaDocument *obj, GError **err)
110 {
111 	g_return_val_if_reached (FALSE);
112 }
113 
114 /**
115  * ianjuta_document_clear:
116  * @obj: Self
117  * @err: Error propagation and reporting
118  *
119  * Clear selection
120  */
121 void
ianjuta_document_clear(IAnjutaDocument * obj,GError ** err)122 ianjuta_document_clear (IAnjutaDocument *obj, GError **err)
123 {
124 	g_return_if_fail (IANJUTA_IS_DOCUMENT(obj));
125 	IANJUTA_DOCUMENT_GET_IFACE (obj)->clear (obj, err);
126 }
127 
128 /* Default implementation */
129 static void
ianjuta_document_clear_default(IAnjutaDocument * obj,GError ** err)130 ianjuta_document_clear_default (IAnjutaDocument *obj, GError **err)
131 {
132 	g_return_if_reached ();
133 }
134 
135 /**
136  * ianjuta_document_copy:
137  * @obj: Self
138  * @err: Error propagation and reporting
139  *
140  * Copy selection to clipboard.
141  */
142 void
ianjuta_document_copy(IAnjutaDocument * obj,GError ** err)143 ianjuta_document_copy (IAnjutaDocument *obj, GError **err)
144 {
145 	g_return_if_fail (IANJUTA_IS_DOCUMENT(obj));
146 	IANJUTA_DOCUMENT_GET_IFACE (obj)->copy (obj, err);
147 }
148 
149 /* Default implementation */
150 static void
ianjuta_document_copy_default(IAnjutaDocument * obj,GError ** err)151 ianjuta_document_copy_default (IAnjutaDocument *obj, GError **err)
152 {
153 	g_return_if_reached ();
154 }
155 
156 /**
157  * ianjuta_document_cut:
158  * @obj: Self
159  * @err: Error propagation and reporting
160  *
161  * Cut selection to clipboard.
162  */
163 void
ianjuta_document_cut(IAnjutaDocument * obj,GError ** err)164 ianjuta_document_cut (IAnjutaDocument *obj, GError **err)
165 {
166 	g_return_if_fail (IANJUTA_IS_DOCUMENT(obj));
167 	IANJUTA_DOCUMENT_GET_IFACE (obj)->cut (obj, err);
168 }
169 
170 /* Default implementation */
171 static void
ianjuta_document_cut_default(IAnjutaDocument * obj,GError ** err)172 ianjuta_document_cut_default (IAnjutaDocument *obj, GError **err)
173 {
174 	g_return_if_reached ();
175 }
176 
177 /**
178  * ianjuta_document_end_undo_action:
179  * @obj: Self
180  * @err: Error propagation and reporting
181  *
182  * Ends the mark of undoable action.
183  */
184 void
ianjuta_document_end_undo_action(IAnjutaDocument * obj,GError ** err)185 ianjuta_document_end_undo_action (IAnjutaDocument *obj, GError **err)
186 {
187 	g_return_if_fail (IANJUTA_IS_DOCUMENT(obj));
188 	IANJUTA_DOCUMENT_GET_IFACE (obj)->end_undo_action (obj, err);
189 }
190 
191 /* Default implementation */
192 static void
ianjuta_document_end_undo_action_default(IAnjutaDocument * obj,GError ** err)193 ianjuta_document_end_undo_action_default (IAnjutaDocument *obj, GError **err)
194 {
195 	g_return_if_reached ();
196 }
197 
198 /**
199  * ianjuta_document_get_filename:
200  * @obj: Self
201  * @err: Error propagation and reporting
202  *
203  * Allows obtaining of the filename the editor was loaded from.
204  *
205  * Return value: The name of the file. Not to be freed by caller.
206  */
207 const gchar*
ianjuta_document_get_filename(IAnjutaDocument * obj,GError ** err)208 ianjuta_document_get_filename (IAnjutaDocument *obj, GError **err)
209 {
210 	g_return_val_if_fail (IANJUTA_IS_DOCUMENT(obj), NULL);
211 	return IANJUTA_DOCUMENT_GET_IFACE (obj)->get_filename (obj, err);
212 }
213 
214 /* Default implementation */
215 static const gchar*
ianjuta_document_get_filename_default(IAnjutaDocument * obj,GError ** err)216 ianjuta_document_get_filename_default (IAnjutaDocument *obj, GError **err)
217 {
218 	g_return_val_if_reached (NULL);
219 }
220 
221 /**
222  * ianjuta_document_grab_focus:
223  * @obj: Self
224  * @err: Error propagation and reporting
225  *
226  * Grabs the focus.
227  */
228 void
ianjuta_document_grab_focus(IAnjutaDocument * obj,GError ** err)229 ianjuta_document_grab_focus (IAnjutaDocument *obj, GError **err)
230 {
231 	g_return_if_fail (IANJUTA_IS_DOCUMENT(obj));
232 	IANJUTA_DOCUMENT_GET_IFACE (obj)->grab_focus (obj, err);
233 }
234 
235 /* Default implementation */
236 static void
ianjuta_document_grab_focus_default(IAnjutaDocument * obj,GError ** err)237 ianjuta_document_grab_focus_default (IAnjutaDocument *obj, GError **err)
238 {
239 	g_return_if_reached ();
240 }
241 
242 /**
243  * ianjuta_document_paste:
244  * @obj: Self
245  * @err: Error propagation and reporting
246  *
247  * Paste clipboard at current position.
248  */
249 void
ianjuta_document_paste(IAnjutaDocument * obj,GError ** err)250 ianjuta_document_paste (IAnjutaDocument *obj, GError **err)
251 {
252 	g_return_if_fail (IANJUTA_IS_DOCUMENT(obj));
253 	IANJUTA_DOCUMENT_GET_IFACE (obj)->paste (obj, err);
254 }
255 
256 /* Default implementation */
257 static void
ianjuta_document_paste_default(IAnjutaDocument * obj,GError ** err)258 ianjuta_document_paste_default (IAnjutaDocument *obj, GError **err)
259 {
260 	g_return_if_reached ();
261 }
262 
263 /**
264  * ianjuta_document_redo:
265  * @obj: Self
266  * @err: Error propagation and reporting
267  *
268  * Redo last undo operation
269  */
270 void
ianjuta_document_redo(IAnjutaDocument * obj,GError ** err)271 ianjuta_document_redo (IAnjutaDocument *obj, GError **err)
272 {
273 	g_return_if_fail (IANJUTA_IS_DOCUMENT(obj));
274 	IANJUTA_DOCUMENT_GET_IFACE (obj)->redo (obj, err);
275 }
276 
277 /* Default implementation */
278 static void
ianjuta_document_redo_default(IAnjutaDocument * obj,GError ** err)279 ianjuta_document_redo_default (IAnjutaDocument *obj, GError **err)
280 {
281 	g_return_if_reached ();
282 }
283 
284 /**
285  * ianjuta_document_undo:
286  * @obj: Self
287  * @err: Error propagation and reporting
288  *
289  * Undo last operation
290  */
291 void
ianjuta_document_undo(IAnjutaDocument * obj,GError ** err)292 ianjuta_document_undo (IAnjutaDocument *obj, GError **err)
293 {
294 	g_return_if_fail (IANJUTA_IS_DOCUMENT(obj));
295 	IANJUTA_DOCUMENT_GET_IFACE (obj)->undo (obj, err);
296 }
297 
298 /* Default implementation */
299 static void
ianjuta_document_undo_default(IAnjutaDocument * obj,GError ** err)300 ianjuta_document_undo_default (IAnjutaDocument *obj, GError **err)
301 {
302 	g_return_if_reached ();
303 }
304 
305 static void
ianjuta_document_base_init(IAnjutaDocumentIface * klass)306 ianjuta_document_base_init (IAnjutaDocumentIface* klass)
307 {
308 	static gboolean initialized = FALSE;
309 
310 	klass->begin_undo_action = ianjuta_document_begin_undo_action_default;
311 	klass->can_redo = ianjuta_document_can_redo_default;
312 	klass->can_undo = ianjuta_document_can_undo_default;
313 	klass->clear = ianjuta_document_clear_default;
314 	klass->copy = ianjuta_document_copy_default;
315 	klass->cut = ianjuta_document_cut_default;
316 	klass->end_undo_action = ianjuta_document_end_undo_action_default;
317 	klass->get_filename = ianjuta_document_get_filename_default;
318 	klass->grab_focus = ianjuta_document_grab_focus_default;
319 	klass->paste = ianjuta_document_paste_default;
320 	klass->redo = ianjuta_document_redo_default;
321 	klass->undo = ianjuta_document_undo_default;
322 
323 	if (!initialized) {
324 
325 		/**
326 		 * IAnjutaDocument::update-ui:
327 		 * @obj: Self
328 		 *
329 		 * This signal is emitted when the document assumes the UI must be updated
330 		 * because some internal state of the document has changed. For example, if
331 		 * current line position is changed, it needs to be reflected to the UI.
332 		 */
333 		g_signal_new ("update-ui",
334 			IANJUTA_TYPE_DOCUMENT,
335 			G_SIGNAL_RUN_LAST,
336 			G_STRUCT_OFFSET (IAnjutaDocumentIface, update_ui),
337 			NULL, NULL,
338 			libanjuta_iface_cclosure_marshal_VOID__VOID,
339 			G_TYPE_NONE,
340 			0,
341 			NULL);
342 
343 
344 		initialized = TRUE;
345 	}
346 }
347 
348 GType
ianjuta_document_get_type(void)349 ianjuta_document_get_type (void)
350 {
351 	static GType type = 0;
352 	if (!type) {
353 		static const GTypeInfo info = {
354 			sizeof (IAnjutaDocumentIface),
355 			(GBaseInitFunc) ianjuta_document_base_init,
356 			NULL,
357 			NULL,
358 			NULL,
359 			NULL,
360 			0,
361 			0,
362 			NULL
363 		};
364 		type = g_type_register_static (G_TYPE_INTERFACE, "IAnjutaDocument", &info, 0);
365 		g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
366 	}
367 	return type;
368 }
369