1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * This is where the implementation of the DBus based application API lives.
4  * All the methods in here are designed to be called remotly via DBus.
5  * document-interface.cpp has all of the actual manipulation methods.
6  * This interface is just for creating new document interfaces.
7  *
8  * Documentation for these methods is in application-interface.xml
9  * which is the "gold standard" as to how the interface should work.
10  *
11  * Authors:
12  *   Soren Berg <Glimmer07@gmail.com>
13  *
14  * Copyright (C) 2009 Soren Berg
15  *
16  * Released under GNU GPL v2+, read the file 'COPYING' for more information.
17  */
18 
19 #ifndef INKSCAPE_EXTENSION_APPLICATION_INTERFACE_H_
20 #define INKSCAPE_EXTENSION_APPLICATION_INTERFACE_H_
21 
22 #include <glib.h>
23 #include <dbus/dbus-glib.h>
24 #include <dbus/dbus-glib-bindings.h>
25 #include <dbus/dbus-glib-lowlevel.h>
26 
27 #define DBUS_APPLICATION_INTERFACE_PATH  "/org/inkscape/application"
28 
29 #define TYPE_APPLICATION_INTERFACE            (application_interface_get_type ())
30 #define APPLICATION_INTERFACE(object)         (G_TYPE_CHECK_INSTANCE_CAST ((object), TYPE_APPLICATION_INTERFACE, ApplicationInterface))
31 #define APPLICATION_INTERFACE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_APPLICATION_INTERFACE, ApplicationInterfaceClass))
32 #define IS_APPLICATION_INTERFACE(object)      (G_TYPE_CHECK_INSTANCE_TYPE ((object), TYPE_APPLICATION_INTERFACE))
33 #define IS_APPLICATION_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_APPLICATION_INTERFACE))
34 #define APPLICATION_INTERFACE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_APPLICATION_INTERFACE, ApplicationInterfaceClass))
35 
36 G_BEGIN_DECLS
37 
38 typedef struct _ApplicationInterface ApplicationInterface;
39 typedef struct _ApplicationInterfaceClass ApplicationInterfaceClass;
40 
41 struct _ApplicationInterface {
42         GObject parent;
43 };
44 
45 struct _ApplicationInterfaceClass {
46         GObjectClass parent;
47 };
48 
49 
50 enum InkscapeError
51 {
52   INKSCAPE_ERROR_SELECTION,
53   INKSCAPE_ERROR_OBJECT,
54   INKSCAPE_ERROR_VERB,
55   INKSCAPE_ERROR_OTHER
56 };
57 
58 
59 
60 #define INKSCAPE_ERROR (inkscape_error_quark ())
61 #define INKSCAPE_TYPE_ERROR (inkscape_error_get_type ())
62 
63 GQuark inkscape_error_quark (void);
64 GType inkscape_error_get_type (void);
65 
66 /****************************************************************************
67      DESKTOP FUNCTIONS
68 ****************************************************************************/
69 
70 gchar*
71 application_interface_desktop_new (ApplicationInterface *app_interface,
72                                    GError **error);
73 
74 gchar**
75 application_interface_get_desktop_list (ApplicationInterface *app_interface);
76 
77 gchar*
78 application_interface_get_active_desktop (ApplicationInterface *app_interface,
79                                           GError **error);
80 
81 gboolean
82 application_interface_set_active_desktop (ApplicationInterface *app_interface,
83                                           gchar* document_name,
84                                           GError **error);
85 
86 gboolean
87 application_interface_desktop_close_all (ApplicationInterface *app_interface,
88                                          GError **error);
89 
90 gboolean
91 application_interface_exit (ApplicationInterface *app_interface, GError **error);
92 
93 /****************************************************************************
94      DOCUMENT FUNCTIONS
95 ****************************************************************************/
96 
97 gchar*
98 application_interface_document_new (ApplicationInterface *app_interface,
99                                     GError **error);
100 
101 gchar*
102 application_interface_get_active_document(ApplicationInterface *app_interface,
103                                           GError **error);
104 
105 gchar**
106 application_interface_get_document_list (ApplicationInterface *app_interface);
107 
108 gboolean
109 application_interface_document_close_all (ApplicationInterface *app_interface,
110                                           GError **error);
111 
112 
113 /****************************************************************************
114      SETUP
115 ****************************************************************************/
116 
117 ApplicationInterface *application_interface_new (void);
118 GType application_interface_get_type (void);
119 
120 
121 G_END_DECLS
122 
123 #endif // INKSCAPE_EXTENSION_APPLICATION_INTERFACE_H_
124