1 /* keyboard-service.c generated by valac 0.32.0.49-00a57, the Vala compiler
2 * generated from keyboard-service.vala, do not modify */
3
4
5 #include <glib.h>
6 #include <glib-object.h>
7 #include <gio/gio.h>
8 #include <stdlib.h>
9 #include <string.h>
10 #include <stdio.h>
11
12
13 #define CARIBOU_TYPE_KEYBOARD_SERVICE (caribou_keyboard_service_get_type ())
14 #define CARIBOU_KEYBOARD_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CARIBOU_TYPE_KEYBOARD_SERVICE, CaribouKeyboardService))
15 #define CARIBOU_KEYBOARD_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CARIBOU_TYPE_KEYBOARD_SERVICE, CaribouKeyboardServiceClass))
16 #define CARIBOU_IS_KEYBOARD_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CARIBOU_TYPE_KEYBOARD_SERVICE))
17 #define CARIBOU_IS_KEYBOARD_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CARIBOU_TYPE_KEYBOARD_SERVICE))
18 #define CARIBOU_KEYBOARD_SERVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CARIBOU_TYPE_KEYBOARD_SERVICE, CaribouKeyboardServiceClass))
19
20 typedef struct _CaribouKeyboardService CaribouKeyboardService;
21 typedef struct _CaribouKeyboardServiceClass CaribouKeyboardServiceClass;
22 typedef struct _CaribouKeyboardServicePrivate CaribouKeyboardServicePrivate;
23 #define _g_free0(var) (var = (g_free (var), NULL))
24 #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
25
26 struct _CaribouKeyboardService {
27 GObject parent_instance;
28 CaribouKeyboardServicePrivate * priv;
29 };
30
31 struct _CaribouKeyboardServiceClass {
32 GObjectClass parent_class;
33 void (*set_cursor_location) (CaribouKeyboardService* self, gint x, gint y, gint w, gint h);
34 void (*set_entry_location) (CaribouKeyboardService* self, gint x, gint y, gint w, gint h);
35 void (*show) (CaribouKeyboardService* self, guint32 timestamp);
36 void (*hide) (CaribouKeyboardService* self, guint32 timestamp);
37 void (*name_lost) (CaribouKeyboardService* self, const gchar* name);
38 };
39
40
41 static gpointer caribou_keyboard_service_parent_class = NULL;
42
43 GType caribou_keyboard_service_get_type (void) G_GNUC_CONST;
44 guint caribou_keyboard_service_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
45 enum {
46 CARIBOU_KEYBOARD_SERVICE_DUMMY_PROPERTY
47 };
48 void caribou_keyboard_service_set_cursor_location (CaribouKeyboardService* self, gint x, gint y, gint w, gint h);
49 static void caribou_keyboard_service_real_set_cursor_location (CaribouKeyboardService* self, gint x, gint y, gint w, gint h);
50 void caribou_keyboard_service_set_entry_location (CaribouKeyboardService* self, gint x, gint y, gint w, gint h);
51 static void caribou_keyboard_service_real_set_entry_location (CaribouKeyboardService* self, gint x, gint y, gint w, gint h);
52 void caribou_keyboard_service_show (CaribouKeyboardService* self, guint32 timestamp);
53 static void caribou_keyboard_service_real_show (CaribouKeyboardService* self, guint32 timestamp);
54 void caribou_keyboard_service_hide (CaribouKeyboardService* self, guint32 timestamp);
55 static void caribou_keyboard_service_real_hide (CaribouKeyboardService* self, guint32 timestamp);
56 void caribou_keyboard_service_register_keyboard (CaribouKeyboardService* self, const gchar* name);
57 static void caribou_keyboard_service_on_bus_acquired (CaribouKeyboardService* self, GDBusConnection* conn);
58 static void _caribou_keyboard_service_on_bus_acquired_gbus_acquired_callback (GDBusConnection* connection, const gchar* name, gpointer self);
59 static void caribou_keyboard_service_on_impl_name_acquired (CaribouKeyboardService* self, GDBusConnection* conn, const gchar* name);
60 static void _caribou_keyboard_service_on_impl_name_acquired_gbus_name_acquired_callback (GDBusConnection* connection, const gchar* name, gpointer self);
61 static void caribou_keyboard_service_on_impl_name_lost (CaribouKeyboardService* self, GDBusConnection* conn, const gchar* name);
62 static void _caribou_keyboard_service_on_impl_name_lost_gbus_name_lost_callback (GDBusConnection* connection, const gchar* name, gpointer self);
63 static void caribou_keyboard_service_on_name_lost (CaribouKeyboardService* self, GDBusConnection* conn, const gchar* name);
64 void caribou_keyboard_service_name_lost (CaribouKeyboardService* self, const gchar* name);
65 static void caribou_keyboard_service_real_name_lost (CaribouKeyboardService* self, const gchar* name);
66 static void caribou_keyboard_service_on_generic_name_acquired (CaribouKeyboardService* self, GDBusConnection* conn, const gchar* name);
67 static void _caribou_keyboard_service_on_generic_name_acquired_gbus_name_acquired_callback (GDBusConnection* connection, const gchar* name, gpointer self);
68 static void _caribou_keyboard_service_on_name_lost_gbus_name_lost_callback (GDBusConnection* connection, const gchar* name, gpointer self);
69 CaribouKeyboardService* caribou_keyboard_service_construct (GType object_type);
70 static void _dbus_caribou_keyboard_service_set_cursor_location (CaribouKeyboardService* self, GVariant* _parameters_, GDBusMethodInvocation* invocation);
71 static void _dbus_caribou_keyboard_service_set_entry_location (CaribouKeyboardService* self, GVariant* _parameters_, GDBusMethodInvocation* invocation);
72 static void _dbus_caribou_keyboard_service_show (CaribouKeyboardService* self, GVariant* _parameters_, GDBusMethodInvocation* invocation);
73 static void _dbus_caribou_keyboard_service_hide (CaribouKeyboardService* self, GVariant* _parameters_, GDBusMethodInvocation* invocation);
74 static void caribou_keyboard_service_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data);
75 static GVariant* caribou_keyboard_service_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data);
76 static gboolean caribou_keyboard_service_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data);
77 static void _caribou_keyboard_service_unregister_object (gpointer user_data);
78
79 static const GDBusArgInfo _caribou_keyboard_service_dbus_arg_info_set_cursor_location_x = {-1, "x", "i"};
80 static const GDBusArgInfo _caribou_keyboard_service_dbus_arg_info_set_cursor_location_y = {-1, "y", "i"};
81 static const GDBusArgInfo _caribou_keyboard_service_dbus_arg_info_set_cursor_location_w = {-1, "w", "i"};
82 static const GDBusArgInfo _caribou_keyboard_service_dbus_arg_info_set_cursor_location_h = {-1, "h", "i"};
83 static const GDBusArgInfo * const _caribou_keyboard_service_dbus_arg_info_set_cursor_location_in[] = {&_caribou_keyboard_service_dbus_arg_info_set_cursor_location_x, &_caribou_keyboard_service_dbus_arg_info_set_cursor_location_y, &_caribou_keyboard_service_dbus_arg_info_set_cursor_location_w, &_caribou_keyboard_service_dbus_arg_info_set_cursor_location_h, NULL};
84 static const GDBusArgInfo * const _caribou_keyboard_service_dbus_arg_info_set_cursor_location_out[] = {NULL};
85 static const GDBusMethodInfo _caribou_keyboard_service_dbus_method_info_set_cursor_location = {-1, "SetCursorLocation", (GDBusArgInfo **) (&_caribou_keyboard_service_dbus_arg_info_set_cursor_location_in), (GDBusArgInfo **) (&_caribou_keyboard_service_dbus_arg_info_set_cursor_location_out)};
86 static const GDBusArgInfo _caribou_keyboard_service_dbus_arg_info_set_entry_location_x = {-1, "x", "i"};
87 static const GDBusArgInfo _caribou_keyboard_service_dbus_arg_info_set_entry_location_y = {-1, "y", "i"};
88 static const GDBusArgInfo _caribou_keyboard_service_dbus_arg_info_set_entry_location_w = {-1, "w", "i"};
89 static const GDBusArgInfo _caribou_keyboard_service_dbus_arg_info_set_entry_location_h = {-1, "h", "i"};
90 static const GDBusArgInfo * const _caribou_keyboard_service_dbus_arg_info_set_entry_location_in[] = {&_caribou_keyboard_service_dbus_arg_info_set_entry_location_x, &_caribou_keyboard_service_dbus_arg_info_set_entry_location_y, &_caribou_keyboard_service_dbus_arg_info_set_entry_location_w, &_caribou_keyboard_service_dbus_arg_info_set_entry_location_h, NULL};
91 static const GDBusArgInfo * const _caribou_keyboard_service_dbus_arg_info_set_entry_location_out[] = {NULL};
92 static const GDBusMethodInfo _caribou_keyboard_service_dbus_method_info_set_entry_location = {-1, "SetEntryLocation", (GDBusArgInfo **) (&_caribou_keyboard_service_dbus_arg_info_set_entry_location_in), (GDBusArgInfo **) (&_caribou_keyboard_service_dbus_arg_info_set_entry_location_out)};
93 static const GDBusArgInfo _caribou_keyboard_service_dbus_arg_info_show_timestamp = {-1, "timestamp", "u"};
94 static const GDBusArgInfo * const _caribou_keyboard_service_dbus_arg_info_show_in[] = {&_caribou_keyboard_service_dbus_arg_info_show_timestamp, NULL};
95 static const GDBusArgInfo * const _caribou_keyboard_service_dbus_arg_info_show_out[] = {NULL};
96 static const GDBusMethodInfo _caribou_keyboard_service_dbus_method_info_show = {-1, "Show", (GDBusArgInfo **) (&_caribou_keyboard_service_dbus_arg_info_show_in), (GDBusArgInfo **) (&_caribou_keyboard_service_dbus_arg_info_show_out)};
97 static const GDBusArgInfo _caribou_keyboard_service_dbus_arg_info_hide_timestamp = {-1, "timestamp", "u"};
98 static const GDBusArgInfo * const _caribou_keyboard_service_dbus_arg_info_hide_in[] = {&_caribou_keyboard_service_dbus_arg_info_hide_timestamp, NULL};
99 static const GDBusArgInfo * const _caribou_keyboard_service_dbus_arg_info_hide_out[] = {NULL};
100 static const GDBusMethodInfo _caribou_keyboard_service_dbus_method_info_hide = {-1, "Hide", (GDBusArgInfo **) (&_caribou_keyboard_service_dbus_arg_info_hide_in), (GDBusArgInfo **) (&_caribou_keyboard_service_dbus_arg_info_hide_out)};
101 static const GDBusMethodInfo * const _caribou_keyboard_service_dbus_method_info[] = {&_caribou_keyboard_service_dbus_method_info_set_cursor_location, &_caribou_keyboard_service_dbus_method_info_set_entry_location, &_caribou_keyboard_service_dbus_method_info_show, &_caribou_keyboard_service_dbus_method_info_hide, NULL};
102 static const GDBusSignalInfo * const _caribou_keyboard_service_dbus_signal_info[] = {NULL};
103 static const GDBusPropertyInfo * const _caribou_keyboard_service_dbus_property_info[] = {NULL};
104 static const GDBusInterfaceInfo _caribou_keyboard_service_dbus_interface_info = {-1, "org.gnome.Caribou.Keyboard", (GDBusMethodInfo **) (&_caribou_keyboard_service_dbus_method_info), (GDBusSignalInfo **) (&_caribou_keyboard_service_dbus_signal_info), (GDBusPropertyInfo **) (&_caribou_keyboard_service_dbus_property_info)};
105 static const GDBusInterfaceVTable _caribou_keyboard_service_dbus_interface_vtable = {caribou_keyboard_service_dbus_interface_method_call, caribou_keyboard_service_dbus_interface_get_property, caribou_keyboard_service_dbus_interface_set_property};
106
caribou_keyboard_service_real_set_cursor_location(CaribouKeyboardService * self,gint x,gint y,gint w,gint h)107 static void caribou_keyboard_service_real_set_cursor_location (CaribouKeyboardService* self, gint x, gint y, gint w, gint h) {
108 g_critical ("Type `%s' does not implement abstract method `caribou_keyboard_service_set_cursor_location'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
109 return;
110 }
111
112
caribou_keyboard_service_set_cursor_location(CaribouKeyboardService * self,gint x,gint y,gint w,gint h)113 void caribou_keyboard_service_set_cursor_location (CaribouKeyboardService* self, gint x, gint y, gint w, gint h) {
114 g_return_if_fail (self != NULL);
115 CARIBOU_KEYBOARD_SERVICE_GET_CLASS (self)->set_cursor_location (self, x, y, w, h);
116 }
117
118
caribou_keyboard_service_real_set_entry_location(CaribouKeyboardService * self,gint x,gint y,gint w,gint h)119 static void caribou_keyboard_service_real_set_entry_location (CaribouKeyboardService* self, gint x, gint y, gint w, gint h) {
120 g_critical ("Type `%s' does not implement abstract method `caribou_keyboard_service_set_entry_location'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
121 return;
122 }
123
124
caribou_keyboard_service_set_entry_location(CaribouKeyboardService * self,gint x,gint y,gint w,gint h)125 void caribou_keyboard_service_set_entry_location (CaribouKeyboardService* self, gint x, gint y, gint w, gint h) {
126 g_return_if_fail (self != NULL);
127 CARIBOU_KEYBOARD_SERVICE_GET_CLASS (self)->set_entry_location (self, x, y, w, h);
128 }
129
130
caribou_keyboard_service_real_show(CaribouKeyboardService * self,guint32 timestamp)131 static void caribou_keyboard_service_real_show (CaribouKeyboardService* self, guint32 timestamp) {
132 g_critical ("Type `%s' does not implement abstract method `caribou_keyboard_service_show'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
133 return;
134 }
135
136
caribou_keyboard_service_show(CaribouKeyboardService * self,guint32 timestamp)137 void caribou_keyboard_service_show (CaribouKeyboardService* self, guint32 timestamp) {
138 g_return_if_fail (self != NULL);
139 CARIBOU_KEYBOARD_SERVICE_GET_CLASS (self)->show (self, timestamp);
140 }
141
142
caribou_keyboard_service_real_hide(CaribouKeyboardService * self,guint32 timestamp)143 static void caribou_keyboard_service_real_hide (CaribouKeyboardService* self, guint32 timestamp) {
144 g_critical ("Type `%s' does not implement abstract method `caribou_keyboard_service_hide'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
145 return;
146 }
147
148
caribou_keyboard_service_hide(CaribouKeyboardService * self,guint32 timestamp)149 void caribou_keyboard_service_hide (CaribouKeyboardService* self, guint32 timestamp) {
150 g_return_if_fail (self != NULL);
151 CARIBOU_KEYBOARD_SERVICE_GET_CLASS (self)->hide (self, timestamp);
152 }
153
154
string_to_string(const gchar * self)155 static const gchar* string_to_string (const gchar* self) {
156 const gchar* result = NULL;
157 g_return_val_if_fail (self != NULL, NULL);
158 result = self;
159 return result;
160 }
161
162
_caribou_keyboard_service_on_bus_acquired_gbus_acquired_callback(GDBusConnection * connection,const gchar * name,gpointer self)163 static void _caribou_keyboard_service_on_bus_acquired_gbus_acquired_callback (GDBusConnection* connection, const gchar* name, gpointer self) {
164 caribou_keyboard_service_on_bus_acquired ((CaribouKeyboardService*) self, connection);
165 }
166
167
_caribou_keyboard_service_on_impl_name_acquired_gbus_name_acquired_callback(GDBusConnection * connection,const gchar * name,gpointer self)168 static void _caribou_keyboard_service_on_impl_name_acquired_gbus_name_acquired_callback (GDBusConnection* connection, const gchar* name, gpointer self) {
169 caribou_keyboard_service_on_impl_name_acquired ((CaribouKeyboardService*) self, connection, name);
170 }
171
172
_caribou_keyboard_service_on_impl_name_lost_gbus_name_lost_callback(GDBusConnection * connection,const gchar * name,gpointer self)173 static void _caribou_keyboard_service_on_impl_name_lost_gbus_name_lost_callback (GDBusConnection* connection, const gchar* name, gpointer self) {
174 caribou_keyboard_service_on_impl_name_lost ((CaribouKeyboardService*) self, connection, name);
175 }
176
177
caribou_keyboard_service_register_keyboard(CaribouKeyboardService * self,const gchar * name)178 void caribou_keyboard_service_register_keyboard (CaribouKeyboardService* self, const gchar* name) {
179 gchar* dbus_name = NULL;
180 const gchar* _tmp0_ = NULL;
181 const gchar* _tmp1_ = NULL;
182 gchar* _tmp2_ = NULL;
183 g_return_if_fail (self != NULL);
184 g_return_if_fail (name != NULL);
185 _tmp0_ = name;
186 _tmp1_ = string_to_string (_tmp0_);
187 _tmp2_ = g_strconcat ("org.gnome.Caribou.", _tmp1_, NULL);
188 dbus_name = _tmp2_;
189 g_bus_own_name_with_closures (G_BUS_TYPE_SESSION, dbus_name, G_BUS_NAME_OWNER_FLAGS_NONE, (GClosure*) ((_caribou_keyboard_service_on_bus_acquired_gbus_acquired_callback == NULL) ? NULL : g_cclosure_new ((GCallback) _caribou_keyboard_service_on_bus_acquired_gbus_acquired_callback, g_object_ref (self), g_object_unref)), (GClosure*) ((_caribou_keyboard_service_on_impl_name_acquired_gbus_name_acquired_callback == NULL) ? NULL : g_cclosure_new ((GCallback) _caribou_keyboard_service_on_impl_name_acquired_gbus_name_acquired_callback, g_object_ref (self), g_object_unref)), (GClosure*) ((_caribou_keyboard_service_on_impl_name_lost_gbus_name_lost_callback == NULL) ? NULL : g_cclosure_new ((GCallback) _caribou_keyboard_service_on_impl_name_lost_gbus_name_lost_callback, g_object_ref (self), g_object_unref)));
190 _g_free0 (dbus_name);
191 }
192
193
caribou_keyboard_service_on_bus_acquired(CaribouKeyboardService * self,GDBusConnection * conn)194 static void caribou_keyboard_service_on_bus_acquired (CaribouKeyboardService* self, GDBusConnection* conn) {
195 g_return_if_fail (self != NULL);
196 g_return_if_fail (conn != NULL);
197 }
198
199
caribou_keyboard_service_on_impl_name_lost(CaribouKeyboardService * self,GDBusConnection * conn,const gchar * name)200 static void caribou_keyboard_service_on_impl_name_lost (CaribouKeyboardService* self, GDBusConnection* conn, const gchar* name) {
201 FILE* _tmp0_ = NULL;
202 const gchar* _tmp1_ = NULL;
203 g_return_if_fail (self != NULL);
204 g_return_if_fail (conn != NULL);
205 g_return_if_fail (name != NULL);
206 _tmp0_ = stderr;
207 _tmp1_ = name;
208 fprintf (_tmp0_, "Could not acquire %s\n", _tmp1_);
209 }
210
211
caribou_keyboard_service_on_name_lost(CaribouKeyboardService * self,GDBusConnection * conn,const gchar * name)212 static void caribou_keyboard_service_on_name_lost (CaribouKeyboardService* self, GDBusConnection* conn, const gchar* name) {
213 FILE* _tmp0_ = NULL;
214 const gchar* _tmp1_ = NULL;
215 const gchar* _tmp2_ = NULL;
216 g_return_if_fail (self != NULL);
217 g_return_if_fail (conn != NULL);
218 g_return_if_fail (name != NULL);
219 _tmp0_ = stderr;
220 _tmp1_ = name;
221 fprintf (_tmp0_, "Could not acquire %s\n", _tmp1_);
222 _tmp2_ = name;
223 caribou_keyboard_service_name_lost (self, _tmp2_);
224 }
225
226
caribou_keyboard_service_real_name_lost(CaribouKeyboardService * self,const gchar * name)227 static void caribou_keyboard_service_real_name_lost (CaribouKeyboardService* self, const gchar* name) {
228 FILE* _tmp0_ = NULL;
229 g_return_if_fail (name != NULL);
230 _tmp0_ = stderr;
231 fprintf (_tmp0_, "default\n");
232 }
233
234
caribou_keyboard_service_name_lost(CaribouKeyboardService * self,const gchar * name)235 void caribou_keyboard_service_name_lost (CaribouKeyboardService* self, const gchar* name) {
236 g_return_if_fail (self != NULL);
237 CARIBOU_KEYBOARD_SERVICE_GET_CLASS (self)->name_lost (self, name);
238 }
239
240
_caribou_keyboard_service_on_generic_name_acquired_gbus_name_acquired_callback(GDBusConnection * connection,const gchar * name,gpointer self)241 static void _caribou_keyboard_service_on_generic_name_acquired_gbus_name_acquired_callback (GDBusConnection* connection, const gchar* name, gpointer self) {
242 caribou_keyboard_service_on_generic_name_acquired ((CaribouKeyboardService*) self, connection, name);
243 }
244
245
_caribou_keyboard_service_on_name_lost_gbus_name_lost_callback(GDBusConnection * connection,const gchar * name,gpointer self)246 static void _caribou_keyboard_service_on_name_lost_gbus_name_lost_callback (GDBusConnection* connection, const gchar* name, gpointer self) {
247 caribou_keyboard_service_on_name_lost ((CaribouKeyboardService*) self, connection, name);
248 }
249
250
caribou_keyboard_service_on_impl_name_acquired(CaribouKeyboardService * self,GDBusConnection * conn,const gchar * name)251 static void caribou_keyboard_service_on_impl_name_acquired (CaribouKeyboardService* self, GDBusConnection* conn, const gchar* name) {
252 g_return_if_fail (self != NULL);
253 g_return_if_fail (conn != NULL);
254 g_return_if_fail (name != NULL);
255 g_bus_own_name_with_closures (G_BUS_TYPE_SESSION, "org.gnome.Caribou.Keyboard", G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT, (GClosure*) ((_caribou_keyboard_service_on_bus_acquired_gbus_acquired_callback == NULL) ? NULL : g_cclosure_new ((GCallback) _caribou_keyboard_service_on_bus_acquired_gbus_acquired_callback, g_object_ref (self), g_object_unref)), (GClosure*) ((_caribou_keyboard_service_on_generic_name_acquired_gbus_name_acquired_callback == NULL) ? NULL : g_cclosure_new ((GCallback) _caribou_keyboard_service_on_generic_name_acquired_gbus_name_acquired_callback, g_object_ref (self), g_object_unref)), (GClosure*) ((_caribou_keyboard_service_on_name_lost_gbus_name_lost_callback == NULL) ? NULL : g_cclosure_new ((GCallback) _caribou_keyboard_service_on_name_lost_gbus_name_lost_callback, g_object_ref (self), g_object_unref)));
256 }
257
258
caribou_keyboard_service_on_generic_name_acquired(CaribouKeyboardService * self,GDBusConnection * conn,const gchar * name)259 static void caribou_keyboard_service_on_generic_name_acquired (CaribouKeyboardService* self, GDBusConnection* conn, const gchar* name) {
260 GError * _inner_error_ = NULL;
261 g_return_if_fail (self != NULL);
262 g_return_if_fail (conn != NULL);
263 g_return_if_fail (name != NULL);
264 {
265 gchar* path = NULL;
266 gchar* _tmp0_ = NULL;
267 GDBusConnection* _tmp1_ = NULL;
268 _tmp0_ = g_strdup ("/org/gnome/Caribou/Keyboard");
269 path = _tmp0_;
270 _tmp1_ = conn;
271 caribou_keyboard_service_register_object (self, _tmp1_, path, &_inner_error_);
272 if (G_UNLIKELY (_inner_error_ != NULL)) {
273 _g_free0 (path);
274 if (_inner_error_->domain == G_IO_ERROR) {
275 goto __catch0_g_io_error;
276 }
277 _g_free0 (path);
278 g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
279 g_clear_error (&_inner_error_);
280 return;
281 }
282 _g_free0 (path);
283 }
284 goto __finally0;
285 __catch0_g_io_error:
286 {
287 GError* e = NULL;
288 FILE* _tmp2_ = NULL;
289 GError* _tmp3_ = NULL;
290 const gchar* _tmp4_ = NULL;
291 e = _inner_error_;
292 _inner_error_ = NULL;
293 _tmp2_ = stderr;
294 _tmp3_ = e;
295 _tmp4_ = _tmp3_->message;
296 fprintf (_tmp2_, "Could not register service: %s\n", _tmp4_);
297 _g_error_free0 (e);
298 }
299 __finally0:
300 if (G_UNLIKELY (_inner_error_ != NULL)) {
301 g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
302 g_clear_error (&_inner_error_);
303 return;
304 }
305 }
306
307
caribou_keyboard_service_construct(GType object_type)308 CaribouKeyboardService* caribou_keyboard_service_construct (GType object_type) {
309 CaribouKeyboardService * self = NULL;
310 self = (CaribouKeyboardService*) g_object_new (object_type, NULL);
311 return self;
312 }
313
314
caribou_keyboard_service_class_init(CaribouKeyboardServiceClass * klass)315 static void caribou_keyboard_service_class_init (CaribouKeyboardServiceClass * klass) {
316 caribou_keyboard_service_parent_class = g_type_class_peek_parent (klass);
317 ((CaribouKeyboardServiceClass *) klass)->set_cursor_location = caribou_keyboard_service_real_set_cursor_location;
318 ((CaribouKeyboardServiceClass *) klass)->set_entry_location = caribou_keyboard_service_real_set_entry_location;
319 ((CaribouKeyboardServiceClass *) klass)->show = caribou_keyboard_service_real_show;
320 ((CaribouKeyboardServiceClass *) klass)->hide = caribou_keyboard_service_real_hide;
321 ((CaribouKeyboardServiceClass *) klass)->name_lost = caribou_keyboard_service_real_name_lost;
322 }
323
324
caribou_keyboard_service_instance_init(CaribouKeyboardService * self)325 static void caribou_keyboard_service_instance_init (CaribouKeyboardService * self) {
326 }
327
328
329 /**
330 * Base abstract class of the Caribou D-Bus service.
331 */
caribou_keyboard_service_get_type(void)332 GType caribou_keyboard_service_get_type (void) {
333 static volatile gsize caribou_keyboard_service_type_id__volatile = 0;
334 if (g_once_init_enter (&caribou_keyboard_service_type_id__volatile)) {
335 static const GTypeInfo g_define_type_info = { sizeof (CaribouKeyboardServiceClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) caribou_keyboard_service_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (CaribouKeyboardService), 0, (GInstanceInitFunc) caribou_keyboard_service_instance_init, NULL };
336 GType caribou_keyboard_service_type_id;
337 caribou_keyboard_service_type_id = g_type_register_static (G_TYPE_OBJECT, "CaribouKeyboardService", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
338 g_type_set_qdata (caribou_keyboard_service_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) caribou_keyboard_service_register_object);
339 g_once_init_leave (&caribou_keyboard_service_type_id__volatile, caribou_keyboard_service_type_id);
340 }
341 return caribou_keyboard_service_type_id__volatile;
342 }
343
344
_dbus_caribou_keyboard_service_set_cursor_location(CaribouKeyboardService * self,GVariant * _parameters_,GDBusMethodInvocation * invocation)345 static void _dbus_caribou_keyboard_service_set_cursor_location (CaribouKeyboardService* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) {
346 GError* error = NULL;
347 GVariantIter _arguments_iter;
348 gint x = 0;
349 GVariant* _tmp0_;
350 gint y = 0;
351 GVariant* _tmp1_;
352 gint w = 0;
353 GVariant* _tmp2_;
354 gint h = 0;
355 GVariant* _tmp3_;
356 GDBusMessage* _reply_message;
357 GVariant* _reply;
358 GVariantBuilder _reply_builder;
359 g_variant_iter_init (&_arguments_iter, _parameters_);
360 _tmp0_ = g_variant_iter_next_value (&_arguments_iter);
361 x = g_variant_get_int32 (_tmp0_);
362 g_variant_unref (_tmp0_);
363 _tmp1_ = g_variant_iter_next_value (&_arguments_iter);
364 y = g_variant_get_int32 (_tmp1_);
365 g_variant_unref (_tmp1_);
366 _tmp2_ = g_variant_iter_next_value (&_arguments_iter);
367 w = g_variant_get_int32 (_tmp2_);
368 g_variant_unref (_tmp2_);
369 _tmp3_ = g_variant_iter_next_value (&_arguments_iter);
370 h = g_variant_get_int32 (_tmp3_);
371 g_variant_unref (_tmp3_);
372 caribou_keyboard_service_set_cursor_location (self, x, y, w, h);
373 _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
374 g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
375 _reply = g_variant_builder_end (&_reply_builder);
376 g_dbus_message_set_body (_reply_message, _reply);
377 g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
378 g_object_unref (invocation);
379 g_object_unref (_reply_message);
380 }
381
382
_dbus_caribou_keyboard_service_set_entry_location(CaribouKeyboardService * self,GVariant * _parameters_,GDBusMethodInvocation * invocation)383 static void _dbus_caribou_keyboard_service_set_entry_location (CaribouKeyboardService* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) {
384 GError* error = NULL;
385 GVariantIter _arguments_iter;
386 gint x = 0;
387 GVariant* _tmp4_;
388 gint y = 0;
389 GVariant* _tmp5_;
390 gint w = 0;
391 GVariant* _tmp6_;
392 gint h = 0;
393 GVariant* _tmp7_;
394 GDBusMessage* _reply_message;
395 GVariant* _reply;
396 GVariantBuilder _reply_builder;
397 g_variant_iter_init (&_arguments_iter, _parameters_);
398 _tmp4_ = g_variant_iter_next_value (&_arguments_iter);
399 x = g_variant_get_int32 (_tmp4_);
400 g_variant_unref (_tmp4_);
401 _tmp5_ = g_variant_iter_next_value (&_arguments_iter);
402 y = g_variant_get_int32 (_tmp5_);
403 g_variant_unref (_tmp5_);
404 _tmp6_ = g_variant_iter_next_value (&_arguments_iter);
405 w = g_variant_get_int32 (_tmp6_);
406 g_variant_unref (_tmp6_);
407 _tmp7_ = g_variant_iter_next_value (&_arguments_iter);
408 h = g_variant_get_int32 (_tmp7_);
409 g_variant_unref (_tmp7_);
410 caribou_keyboard_service_set_entry_location (self, x, y, w, h);
411 _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
412 g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
413 _reply = g_variant_builder_end (&_reply_builder);
414 g_dbus_message_set_body (_reply_message, _reply);
415 g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
416 g_object_unref (invocation);
417 g_object_unref (_reply_message);
418 }
419
420
_dbus_caribou_keyboard_service_show(CaribouKeyboardService * self,GVariant * _parameters_,GDBusMethodInvocation * invocation)421 static void _dbus_caribou_keyboard_service_show (CaribouKeyboardService* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) {
422 GError* error = NULL;
423 GVariantIter _arguments_iter;
424 guint32 timestamp = 0U;
425 GVariant* _tmp8_;
426 GDBusMessage* _reply_message;
427 GVariant* _reply;
428 GVariantBuilder _reply_builder;
429 g_variant_iter_init (&_arguments_iter, _parameters_);
430 _tmp8_ = g_variant_iter_next_value (&_arguments_iter);
431 timestamp = g_variant_get_uint32 (_tmp8_);
432 g_variant_unref (_tmp8_);
433 caribou_keyboard_service_show (self, timestamp);
434 _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
435 g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
436 _reply = g_variant_builder_end (&_reply_builder);
437 g_dbus_message_set_body (_reply_message, _reply);
438 g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
439 g_object_unref (invocation);
440 g_object_unref (_reply_message);
441 }
442
443
_dbus_caribou_keyboard_service_hide(CaribouKeyboardService * self,GVariant * _parameters_,GDBusMethodInvocation * invocation)444 static void _dbus_caribou_keyboard_service_hide (CaribouKeyboardService* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) {
445 GError* error = NULL;
446 GVariantIter _arguments_iter;
447 guint32 timestamp = 0U;
448 GVariant* _tmp9_;
449 GDBusMessage* _reply_message;
450 GVariant* _reply;
451 GVariantBuilder _reply_builder;
452 g_variant_iter_init (&_arguments_iter, _parameters_);
453 _tmp9_ = g_variant_iter_next_value (&_arguments_iter);
454 timestamp = g_variant_get_uint32 (_tmp9_);
455 g_variant_unref (_tmp9_);
456 caribou_keyboard_service_hide (self, timestamp);
457 _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
458 g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
459 _reply = g_variant_builder_end (&_reply_builder);
460 g_dbus_message_set_body (_reply_message, _reply);
461 g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
462 g_object_unref (invocation);
463 g_object_unref (_reply_message);
464 }
465
466
caribou_keyboard_service_dbus_interface_method_call(GDBusConnection * connection,const gchar * sender,const gchar * object_path,const gchar * interface_name,const gchar * method_name,GVariant * parameters,GDBusMethodInvocation * invocation,gpointer user_data)467 static void caribou_keyboard_service_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data) {
468 gpointer* data;
469 gpointer object;
470 data = user_data;
471 object = data[0];
472 if (strcmp (method_name, "SetCursorLocation") == 0) {
473 _dbus_caribou_keyboard_service_set_cursor_location (object, parameters, invocation);
474 } else if (strcmp (method_name, "SetEntryLocation") == 0) {
475 _dbus_caribou_keyboard_service_set_entry_location (object, parameters, invocation);
476 } else if (strcmp (method_name, "Show") == 0) {
477 _dbus_caribou_keyboard_service_show (object, parameters, invocation);
478 } else if (strcmp (method_name, "Hide") == 0) {
479 _dbus_caribou_keyboard_service_hide (object, parameters, invocation);
480 } else {
481 g_object_unref (invocation);
482 }
483 }
484
485
caribou_keyboard_service_dbus_interface_get_property(GDBusConnection * connection,const gchar * sender,const gchar * object_path,const gchar * interface_name,const gchar * property_name,GError ** error,gpointer user_data)486 static GVariant* caribou_keyboard_service_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data) {
487 gpointer* data;
488 gpointer object;
489 data = user_data;
490 object = data[0];
491 return NULL;
492 }
493
494
caribou_keyboard_service_dbus_interface_set_property(GDBusConnection * connection,const gchar * sender,const gchar * object_path,const gchar * interface_name,const gchar * property_name,GVariant * value,GError ** error,gpointer user_data)495 static gboolean caribou_keyboard_service_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data) {
496 gpointer* data;
497 gpointer object;
498 data = user_data;
499 object = data[0];
500 return FALSE;
501 }
502
503
caribou_keyboard_service_register_object(gpointer object,GDBusConnection * connection,const gchar * path,GError ** error)504 guint caribou_keyboard_service_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) {
505 guint result;
506 gpointer *data;
507 data = g_new (gpointer, 3);
508 data[0] = g_object_ref (object);
509 data[1] = g_object_ref (connection);
510 data[2] = g_strdup (path);
511 result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_caribou_keyboard_service_dbus_interface_info), &_caribou_keyboard_service_dbus_interface_vtable, data, _caribou_keyboard_service_unregister_object, error);
512 if (!result) {
513 return 0;
514 }
515 return result;
516 }
517
518
_caribou_keyboard_service_unregister_object(gpointer user_data)519 static void _caribou_keyboard_service_unregister_object (gpointer user_data) {
520 gpointer* data;
521 data = user_data;
522 g_object_unref (data[0]);
523 g_object_unref (data[1]);
524 g_free (data[2]);
525 g_free (data);
526 }
527
528
529
530