Lines 1-2157
Link Here
|
1 |
/* main.c generated by valac 0.34.4, the Vala compiler |
|
|
2 |
* generated from main.vala, do not modify */ |
3 |
|
4 |
/* vim:set et sts=4 sw=4: |
5 |
* |
6 |
* ibus - The Input Bus |
7 |
* |
8 |
* Copyright(c) 2013 Peng Huang <shawn.p.huang@gmail.com> |
9 |
* Copyright(c) 2015-2017 Takao Fujiwara <takao.fujiwara1@gmail.com> |
10 |
* |
11 |
* This library is free software; you can redistribute it and/or |
12 |
* modify it under the terms of the GNU Lesser General Public |
13 |
* License as published by the Free Software Foundation; either |
14 |
* version 2.1 of the License, or (at your option) any later version. |
15 |
* |
16 |
* This library is distributed in the hope that it will be useful, |
17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
19 |
* Lesser General Public License for more details. |
20 |
* |
21 |
* You should have received a copy of the GNU Lesser General Public |
22 |
* License along with this library; if not, write to the Free Software |
23 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 |
24 |
* USA |
25 |
*/ |
26 |
|
27 |
#include <glib.h> |
28 |
#include <glib-object.h> |
29 |
#include <stdlib.h> |
30 |
#include <string.h> |
31 |
#include <ibus.h> |
32 |
#include <config.h> |
33 |
#include <stdio.h> |
34 |
#include <glib/gi18n-lib.h> |
35 |
#include <gio/gio.h> |
36 |
#include <ibusemojidialog.h> |
37 |
#include <gdk/gdk.h> |
38 |
#include <gtk/gtk.h> |
39 |
#include <locale.h> |
40 |
#include <gobject/gvaluecollector.h> |
41 |
|
42 |
|
43 |
#define TYPE_ENGINE_LIST (engine_list_get_type ()) |
44 |
#define ENGINE_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ENGINE_LIST, EngineList)) |
45 |
#define ENGINE_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ENGINE_LIST, EngineListClass)) |
46 |
#define IS_ENGINE_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ENGINE_LIST)) |
47 |
#define IS_ENGINE_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ENGINE_LIST)) |
48 |
#define ENGINE_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ENGINE_LIST, EngineListClass)) |
49 |
|
50 |
typedef struct _EngineList EngineList; |
51 |
typedef struct _EngineListClass EngineListClass; |
52 |
typedef struct _EngineListPrivate EngineListPrivate; |
53 |
typedef struct _ParamSpecEngineList ParamSpecEngineList; |
54 |
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) |
55 |
#define _g_option_context_free0(var) ((var == NULL) ? NULL : (var = (g_option_context_free (var), NULL))) |
56 |
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) |
57 |
#define _g_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL))) |
58 |
#define _engine_list_unref0(var) ((var == NULL) ? NULL : (var = (engine_list_unref (var), NULL))) |
59 |
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL))) |
60 |
#define _g_free0(var) (var = (g_free (var), NULL)) |
61 |
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL))) |
62 |
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL))) |
63 |
#define __vala_GdkEvent_free0(var) ((var == NULL) ? NULL : (var = (_vala_GdkEvent_free (var), NULL))) |
64 |
typedef struct _Block1Data Block1Data; |
65 |
typedef struct _Block2Data Block2Data; |
66 |
#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL))) |
67 |
|
68 |
#define TYPE_COMMAND_ENTRY (command_entry_get_type ()) |
69 |
typedef struct _CommandEntry CommandEntry; |
70 |
|
71 |
struct _EngineList { |
72 |
GTypeInstance parent_instance; |
73 |
volatile int ref_count; |
74 |
EngineListPrivate * priv; |
75 |
IBusEngineDesc** data; |
76 |
gint data_length1; |
77 |
gint _data_size_; |
78 |
}; |
79 |
|
80 |
struct _EngineListClass { |
81 |
GTypeClass parent_class; |
82 |
void (*finalize) (EngineList *self); |
83 |
}; |
84 |
|
85 |
struct _ParamSpecEngineList { |
86 |
GParamSpec parent_instance; |
87 |
}; |
88 |
|
89 |
struct _Block1Data { |
90 |
int _ref_count_; |
91 |
IBusEmojier* emojier; |
92 |
}; |
93 |
|
94 |
struct _Block2Data { |
95 |
int _ref_count_; |
96 |
Block1Data * _data1_; |
97 |
GMainLoop* loop; |
98 |
}; |
99 |
|
100 |
typedef gint (*EntryFunc) (gchar** argv, int argv_length1, void* user_data); |
101 |
struct _CommandEntry { |
102 |
const gchar* name; |
103 |
const gchar* description; |
104 |
EntryFunc entry; |
105 |
gpointer entry_target; |
106 |
}; |
107 |
|
108 |
|
109 |
extern gboolean name_only; |
110 |
gboolean name_only = FALSE; |
111 |
extern gboolean is_system; |
112 |
gboolean is_system = FALSE; |
113 |
extern gchar* cache_file; |
114 |
gchar* cache_file = NULL; |
115 |
static gpointer engine_list_parent_class = NULL; |
116 |
extern gchar* program_name; |
117 |
gchar* program_name = NULL; |
118 |
|
119 |
gpointer engine_list_ref (gpointer instance); |
120 |
void engine_list_unref (gpointer instance); |
121 |
GParamSpec* param_spec_engine_list (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); |
122 |
void value_set_engine_list (GValue* value, gpointer v_object); |
123 |
void value_take_engine_list (GValue* value, gpointer v_object); |
124 |
gpointer value_get_engine_list (const GValue* value); |
125 |
GType engine_list_get_type (void) G_GNUC_CONST; |
126 |
enum { |
127 |
ENGINE_LIST_DUMMY_PROPERTY |
128 |
}; |
129 |
EngineList* engine_list_new (void); |
130 |
EngineList* engine_list_construct (GType object_type); |
131 |
static void engine_list_finalize (EngineList* obj); |
132 |
IBusBus* get_bus (void); |
133 |
gint list_engine (gchar** argv, int argv_length1); |
134 |
static void _g_free0_ (gpointer var); |
135 |
static void _engine_list_unref0_ (gpointer var); |
136 |
static void _vala_array_add1 (IBusEngineDesc*** array, int* length, int* size, IBusEngineDesc* value); |
137 |
gint exec_setxkbmap (IBusEngineDesc* engine); |
138 |
static void _vala_array_add2 (gchar*** array, int* length, int* size, gchar* value); |
139 |
static void _vala_array_add3 (gchar*** array, int* length, int* size, gchar* value); |
140 |
static void _vala_array_add4 (gchar*** array, int* length, int* size, gchar* value); |
141 |
static void _vala_array_add5 (gchar*** array, int* length, int* size, gchar* value); |
142 |
static void _vala_array_add6 (gchar*** array, int* length, int* size, gchar* value); |
143 |
static void _vala_array_add7 (gchar*** array, int* length, int* size, gchar* value); |
144 |
static void _vala_array_add8 (gchar*** array, int* length, int* size, gchar* value); |
145 |
gint get_set_engine (gchar** argv, int argv_length1); |
146 |
gint message_watch (gchar** argv, int argv_length1); |
147 |
gint restart_daemon (gchar** argv, int argv_length1); |
148 |
gint exit_daemon (gchar** argv, int argv_length1); |
149 |
gint print_version (gchar** argv, int argv_length1); |
150 |
gint read_cache (gchar** argv, int argv_length1); |
151 |
gint write_cache (gchar** argv, int argv_length1); |
152 |
gint print_address (gchar** argv, int argv_length1); |
153 |
gint read_config (gchar** argv, int argv_length1); |
154 |
gint reset_config (gchar** argv, int argv_length1); |
155 |
void run_dialog (IBusEmojier* emojier); |
156 |
static void _vala_GdkEvent_free (GdkEvent* self); |
157 |
gint emoji_dialog (gchar** argv, int argv_length1); |
158 |
static Block1Data* block1_data_ref (Block1Data* _data1_); |
159 |
static void block1_data_unref (void * _userdata_); |
160 |
static Block2Data* block2_data_ref (Block2Data* _data2_); |
161 |
static void block2_data_unref (void * _userdata_); |
162 |
static void ___lambda4_ (Block2Data* _data2_); |
163 |
static void ____lambda4__ibus_emojier_loaded_emoji_dict (IBusEmojier* _sender, gpointer self); |
164 |
gint print_help (gchar** argv, int argv_length1); |
165 |
void print_usage (FILE* stream); |
166 |
GType command_entry_get_type (void) G_GNUC_CONST; |
167 |
CommandEntry* command_entry_dup (const CommandEntry* self); |
168 |
void command_entry_free (CommandEntry* self); |
169 |
static gint _get_set_engine_entry_func (gchar** argv, int argv_length1, gpointer self); |
170 |
static gint _exit_daemon_entry_func (gchar** argv, int argv_length1, gpointer self); |
171 |
static gint _list_engine_entry_func (gchar** argv, int argv_length1, gpointer self); |
172 |
static gint _message_watch_entry_func (gchar** argv, int argv_length1, gpointer self); |
173 |
static gint _restart_daemon_entry_func (gchar** argv, int argv_length1, gpointer self); |
174 |
static gint _print_version_entry_func (gchar** argv, int argv_length1, gpointer self); |
175 |
static gint _read_cache_entry_func (gchar** argv, int argv_length1, gpointer self); |
176 |
static gint _write_cache_entry_func (gchar** argv, int argv_length1, gpointer self); |
177 |
static gint _print_address_entry_func (gchar** argv, int argv_length1, gpointer self); |
178 |
static gint _read_config_entry_func (gchar** argv, int argv_length1, gpointer self); |
179 |
static gint _reset_config_entry_func (gchar** argv, int argv_length1, gpointer self); |
180 |
static gint _emoji_dialog_entry_func (gchar** argv, int argv_length1, gpointer self); |
181 |
static gint _print_help_entry_func (gchar** argv, int argv_length1, gpointer self); |
182 |
gint _vala_main (gchar** argv, int argv_length1); |
183 |
static gchar** _vala_array_dup1 (gchar** self, int length); |
184 |
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); |
185 |
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); |
186 |
static gint _vala_array_length (gpointer array); |
187 |
|
188 |
const gchar* IBUS_SCHEMAS[3] = {"org.freedesktop.ibus.general", "org.freedesktop.ibus.general.hotkey", "org.freedesktop.ibus.panel"}; |
189 |
const CommandEntry commands[13] = {{"engine", "Set or get engine", _get_set_engine_entry_func}, {"exit", "Exit ibus-daemon", _exit_daemon_entry_func}, {"list-engine", "Show available engines", _list_engine_entry_func}, {"watch", "(Not implemented)", _message_watch_entry_func}, {"restart", "Restart ibus-daemon", _restart_daemon_entry_func}, {"version", "Show version", _print_version_entry_func}, {"read-cache", "Show the content of registry cache", _read_cache_entry_func}, {"write-cache", "Create registry cache", _write_cache_entry_func}, {"address", "Print the D-Bus address of ibus-daemon", _print_address_entry_func}, {"read-config", "Show the configuration values", _read_config_entry_func}, {"reset-config", "Reset the configuration values", _reset_config_entry_func}, {"emoji", "Save emoji on dialog to clipboard ", _emoji_dialog_entry_func}, {"help", "Show this information", _print_help_entry_func}}; |
190 |
|
191 |
EngineList* engine_list_construct (GType object_type) { |
192 |
EngineList* self = NULL; |
193 |
self = (EngineList*) g_type_create_instance (object_type); |
194 |
return self; |
195 |
} |
196 |
|
197 |
|
198 |
EngineList* engine_list_new (void) { |
199 |
return engine_list_construct (TYPE_ENGINE_LIST); |
200 |
} |
201 |
|
202 |
|
203 |
static void value_engine_list_init (GValue* value) { |
204 |
value->data[0].v_pointer = NULL; |
205 |
} |
206 |
|
207 |
|
208 |
static void value_engine_list_free_value (GValue* value) { |
209 |
if (value->data[0].v_pointer) { |
210 |
engine_list_unref (value->data[0].v_pointer); |
211 |
} |
212 |
} |
213 |
|
214 |
|
215 |
static void value_engine_list_copy_value (const GValue* src_value, GValue* dest_value) { |
216 |
if (src_value->data[0].v_pointer) { |
217 |
dest_value->data[0].v_pointer = engine_list_ref (src_value->data[0].v_pointer); |
218 |
} else { |
219 |
dest_value->data[0].v_pointer = NULL; |
220 |
} |
221 |
} |
222 |
|
223 |
|
224 |
static gpointer value_engine_list_peek_pointer (const GValue* value) { |
225 |
return value->data[0].v_pointer; |
226 |
} |
227 |
|
228 |
|
229 |
static gchar* value_engine_list_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { |
230 |
if (collect_values[0].v_pointer) { |
231 |
EngineList* object; |
232 |
object = collect_values[0].v_pointer; |
233 |
if (object->parent_instance.g_class == NULL) { |
234 |
return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); |
235 |
} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { |
236 |
return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); |
237 |
} |
238 |
value->data[0].v_pointer = engine_list_ref (object); |
239 |
} else { |
240 |
value->data[0].v_pointer = NULL; |
241 |
} |
242 |
return NULL; |
243 |
} |
244 |
|
245 |
|
246 |
static gchar* value_engine_list_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { |
247 |
EngineList** object_p; |
248 |
object_p = collect_values[0].v_pointer; |
249 |
if (!object_p) { |
250 |
return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); |
251 |
} |
252 |
if (!value->data[0].v_pointer) { |
253 |
*object_p = NULL; |
254 |
} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) { |
255 |
*object_p = value->data[0].v_pointer; |
256 |
} else { |
257 |
*object_p = engine_list_ref (value->data[0].v_pointer); |
258 |
} |
259 |
return NULL; |
260 |
} |
261 |
|
262 |
|
263 |
GParamSpec* param_spec_engine_list (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) { |
264 |
ParamSpecEngineList* spec; |
265 |
g_return_val_if_fail (g_type_is_a (object_type, TYPE_ENGINE_LIST), NULL); |
266 |
spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); |
267 |
G_PARAM_SPEC (spec)->value_type = object_type; |
268 |
return G_PARAM_SPEC (spec); |
269 |
} |
270 |
|
271 |
|
272 |
gpointer value_get_engine_list (const GValue* value) { |
273 |
g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_ENGINE_LIST), NULL); |
274 |
return value->data[0].v_pointer; |
275 |
} |
276 |
|
277 |
|
278 |
void value_set_engine_list (GValue* value, gpointer v_object) { |
279 |
EngineList* old; |
280 |
g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_ENGINE_LIST)); |
281 |
old = value->data[0].v_pointer; |
282 |
if (v_object) { |
283 |
g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_ENGINE_LIST)); |
284 |
g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); |
285 |
value->data[0].v_pointer = v_object; |
286 |
engine_list_ref (value->data[0].v_pointer); |
287 |
} else { |
288 |
value->data[0].v_pointer = NULL; |
289 |
} |
290 |
if (old) { |
291 |
engine_list_unref (old); |
292 |
} |
293 |
} |
294 |
|
295 |
|
296 |
void value_take_engine_list (GValue* value, gpointer v_object) { |
297 |
EngineList* old; |
298 |
g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_ENGINE_LIST)); |
299 |
old = value->data[0].v_pointer; |
300 |
if (v_object) { |
301 |
g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_ENGINE_LIST)); |
302 |
g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); |
303 |
value->data[0].v_pointer = v_object; |
304 |
} else { |
305 |
value->data[0].v_pointer = NULL; |
306 |
} |
307 |
if (old) { |
308 |
engine_list_unref (old); |
309 |
} |
310 |
} |
311 |
|
312 |
|
313 |
static void engine_list_class_init (EngineListClass * klass) { |
314 |
engine_list_parent_class = g_type_class_peek_parent (klass); |
315 |
((EngineListClass *) klass)->finalize = engine_list_finalize; |
316 |
} |
317 |
|
318 |
|
319 |
static void engine_list_instance_init (EngineList * self) { |
320 |
IBusEngineDesc** _tmp0_ = NULL; |
321 |
_tmp0_ = g_new0 (IBusEngineDesc*, 0 + 1); |
322 |
self->data = _tmp0_; |
323 |
self->data_length1 = 0; |
324 |
self->_data_size_ = self->data_length1; |
325 |
self->ref_count = 1; |
326 |
} |
327 |
|
328 |
|
329 |
static void engine_list_finalize (EngineList* obj) { |
330 |
EngineList * self; |
331 |
self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_ENGINE_LIST, EngineList); |
332 |
g_signal_handlers_destroy (self); |
333 |
self->data = (_vala_array_free (self->data, self->data_length1, (GDestroyNotify) g_object_unref), NULL); |
334 |
} |
335 |
|
336 |
|
337 |
GType engine_list_get_type (void) { |
338 |
static volatile gsize engine_list_type_id__volatile = 0; |
339 |
if (g_once_init_enter (&engine_list_type_id__volatile)) { |
340 |
static const GTypeValueTable g_define_type_value_table = { value_engine_list_init, value_engine_list_free_value, value_engine_list_copy_value, value_engine_list_peek_pointer, "p", value_engine_list_collect_value, "p", value_engine_list_lcopy_value }; |
341 |
static const GTypeInfo g_define_type_info = { sizeof (EngineListClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) engine_list_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EngineList), 0, (GInstanceInitFunc) engine_list_instance_init, &g_define_type_value_table }; |
342 |
static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }; |
343 |
GType engine_list_type_id; |
344 |
engine_list_type_id = g_type_register_fundamental (g_type_fundamental_next (), "EngineList", &g_define_type_info, &g_define_type_fundamental_info, 0); |
345 |
g_once_init_leave (&engine_list_type_id__volatile, engine_list_type_id); |
346 |
} |
347 |
return engine_list_type_id__volatile; |
348 |
} |
349 |
|
350 |
|
351 |
gpointer engine_list_ref (gpointer instance) { |
352 |
EngineList* self; |
353 |
self = instance; |
354 |
g_atomic_int_inc (&self->ref_count); |
355 |
return instance; |
356 |
} |
357 |
|
358 |
|
359 |
void engine_list_unref (gpointer instance) { |
360 |
EngineList* self; |
361 |
self = instance; |
362 |
if (g_atomic_int_dec_and_test (&self->ref_count)) { |
363 |
ENGINE_LIST_GET_CLASS (self)->finalize (self); |
364 |
g_type_free_instance ((GTypeInstance *) self); |
365 |
} |
366 |
} |
367 |
|
368 |
|
369 |
IBusBus* get_bus (void) { |
370 |
IBusBus* result = NULL; |
371 |
IBusBus* bus = NULL; |
372 |
IBusBus* _tmp0_ = NULL; |
373 |
IBusBus* _tmp1_ = NULL; |
374 |
gboolean _tmp2_ = FALSE; |
375 |
_tmp0_ = ibus_bus_new (); |
376 |
g_object_ref_sink (_tmp0_); |
377 |
bus = _tmp0_; |
378 |
_tmp1_ = bus; |
379 |
_tmp2_ = ibus_bus_is_connected (_tmp1_); |
380 |
if (!_tmp2_) { |
381 |
result = NULL; |
382 |
_g_object_unref0 (bus); |
383 |
return result; |
384 |
} |
385 |
result = bus; |
386 |
return result; |
387 |
} |
388 |
|
389 |
|
390 |
static void _g_free0_ (gpointer var) { |
391 |
var = (g_free (var), NULL); |
392 |
} |
393 |
|
394 |
|
395 |
static void _engine_list_unref0_ (gpointer var) { |
396 |
(var == NULL) ? NULL : (var = (engine_list_unref (var), NULL)); |
397 |
} |
398 |
|
399 |
|
400 |
static gpointer _engine_list_ref0 (gpointer self) { |
401 |
return self ? engine_list_ref (self) : NULL; |
402 |
} |
403 |
|
404 |
|
405 |
static gpointer _g_object_ref0 (gpointer self) { |
406 |
return self ? g_object_ref (self) : NULL; |
407 |
} |
408 |
|
409 |
|
410 |
static void _vala_array_add1 (IBusEngineDesc*** array, int* length, int* size, IBusEngineDesc* value) { |
411 |
if ((*length) == (*size)) { |
412 |
*size = (*size) ? (2 * (*size)) : 4; |
413 |
*array = g_renew (IBusEngineDesc*, *array, (*size) + 1); |
414 |
} |
415 |
(*array)[(*length)++] = value; |
416 |
(*array)[*length] = NULL; |
417 |
} |
418 |
|
419 |
|
420 |
gint list_engine (gchar** argv, int argv_length1) { |
421 |
gint result = 0; |
422 |
static const GOptionEntry options[] = {{"name-only", (gchar) 0, 0, G_OPTION_ARG_NONE, &name_only, "List engine name only", NULL}, {NULL}}; |
423 |
GOptionContext* option = NULL; |
424 |
GOptionContext* _tmp0_ = NULL; |
425 |
GOptionContext* _tmp1_ = NULL; |
426 |
IBusBus* bus = NULL; |
427 |
IBusBus* _tmp6_ = NULL; |
428 |
IBusBus* _tmp7_ = NULL; |
429 |
GList* engines = NULL; |
430 |
IBusBus* _tmp10_ = NULL; |
431 |
GList* _tmp11_ = NULL; |
432 |
gboolean _tmp12_ = FALSE; |
433 |
GHashTable* map = NULL; |
434 |
GHashFunc _tmp16_ = NULL; |
435 |
GEqualFunc _tmp17_ = NULL; |
436 |
GHashTable* _tmp18_ = NULL; |
437 |
GList* _tmp19_ = NULL; |
438 |
GHashTable* _tmp38_ = NULL; |
439 |
GList* _tmp39_ = NULL; |
440 |
GError * _inner_error_ = NULL; |
441 |
_tmp0_ = g_option_context_new (NULL); |
442 |
option = _tmp0_; |
443 |
_tmp1_ = option; |
444 |
g_option_context_add_main_entries (_tmp1_, options, GETTEXT_PACKAGE); |
445 |
{ |
446 |
GOptionContext* _tmp2_ = NULL; |
447 |
_tmp2_ = option; |
448 |
g_option_context_parse (_tmp2_, &argv_length1, &argv, &_inner_error_); |
449 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
450 |
if (_inner_error_->domain == G_OPTION_ERROR) { |
451 |
goto __catch0_g_option_error; |
452 |
} |
453 |
_g_option_context_free0 (option); |
454 |
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); |
455 |
g_clear_error (&_inner_error_); |
456 |
return 0; |
457 |
} |
458 |
} |
459 |
goto __finally0; |
460 |
__catch0_g_option_error: |
461 |
{ |
462 |
GError* e = NULL; |
463 |
FILE* _tmp3_ = NULL; |
464 |
GError* _tmp4_ = NULL; |
465 |
const gchar* _tmp5_ = NULL; |
466 |
e = _inner_error_; |
467 |
_inner_error_ = NULL; |
468 |
_tmp3_ = stderr; |
469 |
_tmp4_ = e; |
470 |
_tmp5_ = _tmp4_->message; |
471 |
fprintf (_tmp3_, "%s\n", _tmp5_); |
472 |
result = EXIT_FAILURE; |
473 |
_g_error_free0 (e); |
474 |
_g_option_context_free0 (option); |
475 |
return result; |
476 |
} |
477 |
__finally0: |
478 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
479 |
_g_option_context_free0 (option); |
480 |
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); |
481 |
g_clear_error (&_inner_error_); |
482 |
return 0; |
483 |
} |
484 |
_tmp6_ = get_bus (); |
485 |
bus = _tmp6_; |
486 |
_tmp7_ = bus; |
487 |
if (_tmp7_ == NULL) { |
488 |
FILE* _tmp8_ = NULL; |
489 |
const gchar* _tmp9_ = NULL; |
490 |
_tmp8_ = stderr; |
491 |
_tmp9_ = _ ("Can't connect to IBus.\n"); |
492 |
fprintf (_tmp8_, "%s", _tmp9_); |
493 |
result = EXIT_FAILURE; |
494 |
_g_object_unref0 (bus); |
495 |
_g_option_context_free0 (option); |
496 |
return result; |
497 |
} |
498 |
_tmp10_ = bus; |
499 |
_tmp11_ = ibus_bus_list_engines (_tmp10_); |
500 |
engines = _tmp11_; |
501 |
_tmp12_ = name_only; |
502 |
if (_tmp12_) { |
503 |
GList* _tmp13_ = NULL; |
504 |
_tmp13_ = engines; |
505 |
{ |
506 |
GList* engine_collection = NULL; |
507 |
GList* engine_it = NULL; |
508 |
engine_collection = _tmp13_; |
509 |
for (engine_it = engine_collection; engine_it != NULL; engine_it = engine_it->next) { |
510 |
IBusEngineDesc* engine = NULL; |
511 |
engine = (IBusEngineDesc*) engine_it->data; |
512 |
{ |
513 |
IBusEngineDesc* _tmp14_ = NULL; |
514 |
const gchar* _tmp15_ = NULL; |
515 |
_tmp14_ = engine; |
516 |
_tmp15_ = ibus_engine_desc_get_name (_tmp14_); |
517 |
g_print ("%s\n", _tmp15_); |
518 |
} |
519 |
} |
520 |
} |
521 |
result = EXIT_SUCCESS; |
522 |
_g_list_free0 (engines); |
523 |
_g_object_unref0 (bus); |
524 |
_g_option_context_free0 (option); |
525 |
return result; |
526 |
} |
527 |
_tmp16_ = g_str_hash; |
528 |
_tmp17_ = g_str_equal; |
529 |
_tmp18_ = g_hash_table_new_full (_tmp16_, _tmp17_, _g_free0_, _engine_list_unref0_); |
530 |
map = _tmp18_; |
531 |
_tmp19_ = engines; |
532 |
{ |
533 |
GList* engine_collection = NULL; |
534 |
GList* engine_it = NULL; |
535 |
engine_collection = _tmp19_; |
536 |
for (engine_it = engine_collection; engine_it != NULL; engine_it = engine_it->next) { |
537 |
IBusEngineDesc* engine = NULL; |
538 |
engine = (IBusEngineDesc*) engine_it->data; |
539 |
{ |
540 |
EngineList* list = NULL; |
541 |
GHashTable* _tmp20_ = NULL; |
542 |
IBusEngineDesc* _tmp21_ = NULL; |
543 |
const gchar* _tmp22_ = NULL; |
544 |
gconstpointer _tmp23_ = NULL; |
545 |
EngineList* _tmp24_ = NULL; |
546 |
EngineList* _tmp25_ = NULL; |
547 |
EngineList* _tmp33_ = NULL; |
548 |
EngineList* _tmp34_ = NULL; |
549 |
IBusEngineDesc** _tmp35_ = NULL; |
550 |
gint _tmp35__length1 = 0; |
551 |
IBusEngineDesc* _tmp36_ = NULL; |
552 |
IBusEngineDesc* _tmp37_ = NULL; |
553 |
_tmp20_ = map; |
554 |
_tmp21_ = engine; |
555 |
_tmp22_ = ibus_engine_desc_get_language (_tmp21_); |
556 |
_tmp23_ = g_hash_table_lookup (_tmp20_, _tmp22_); |
557 |
_tmp24_ = _engine_list_ref0 ((EngineList*) _tmp23_); |
558 |
list = _tmp24_; |
559 |
_tmp25_ = list; |
560 |
if (_tmp25_ == NULL) { |
561 |
EngineList* _tmp26_ = NULL; |
562 |
GHashTable* _tmp27_ = NULL; |
563 |
IBusEngineDesc* _tmp28_ = NULL; |
564 |
const gchar* _tmp29_ = NULL; |
565 |
gchar* _tmp30_ = NULL; |
566 |
EngineList* _tmp31_ = NULL; |
567 |
EngineList* _tmp32_ = NULL; |
568 |
_tmp26_ = engine_list_new (); |
569 |
_engine_list_unref0 (list); |
570 |
list = _tmp26_; |
571 |
_tmp27_ = map; |
572 |
_tmp28_ = engine; |
573 |
_tmp29_ = ibus_engine_desc_get_language (_tmp28_); |
574 |
_tmp30_ = g_strdup (_tmp29_); |
575 |
_tmp31_ = list; |
576 |
_tmp32_ = _engine_list_ref0 (_tmp31_); |
577 |
g_hash_table_insert (_tmp27_, _tmp30_, _tmp32_); |
578 |
} |
579 |
_tmp33_ = list; |
580 |
_tmp34_ = list; |
581 |
_tmp35_ = _tmp34_->data; |
582 |
_tmp35__length1 = _tmp34_->data_length1; |
583 |
_tmp36_ = engine; |
584 |
_tmp37_ = _g_object_ref0 (_tmp36_); |
585 |
_vala_array_add1 (&_tmp33_->data, &_tmp33_->data_length1, &_tmp33_->_data_size_, _tmp37_); |
586 |
_engine_list_unref0 (list); |
587 |
} |
588 |
} |
589 |
} |
590 |
_tmp38_ = map; |
591 |
_tmp39_ = g_hash_table_get_keys (_tmp38_); |
592 |
{ |
593 |
GList* language_collection = NULL; |
594 |
GList* language_it = NULL; |
595 |
language_collection = _tmp39_; |
596 |
for (language_it = language_collection; language_it != NULL; language_it = language_it->next) { |
597 |
const gchar* language = NULL; |
598 |
language = (const gchar*) language_it->data; |
599 |
{ |
600 |
EngineList* list = NULL; |
601 |
GHashTable* _tmp40_ = NULL; |
602 |
const gchar* _tmp41_ = NULL; |
603 |
gconstpointer _tmp42_ = NULL; |
604 |
EngineList* _tmp43_ = NULL; |
605 |
const gchar* _tmp44_ = NULL; |
606 |
const gchar* _tmp45_ = NULL; |
607 |
const gchar* _tmp46_ = NULL; |
608 |
EngineList* _tmp47_ = NULL; |
609 |
IBusEngineDesc** _tmp48_ = NULL; |
610 |
gint _tmp48__length1 = 0; |
611 |
_tmp40_ = map; |
612 |
_tmp41_ = language; |
613 |
_tmp42_ = g_hash_table_lookup (_tmp40_, _tmp41_); |
614 |
_tmp43_ = _engine_list_ref0 ((EngineList*) _tmp42_); |
615 |
list = _tmp43_; |
616 |
_tmp44_ = _ ("language: %s\n"); |
617 |
_tmp45_ = language; |
618 |
_tmp46_ = ibus_get_language_name (_tmp45_); |
619 |
g_print (_tmp44_, _tmp46_); |
620 |
_tmp47_ = list; |
621 |
_tmp48_ = _tmp47_->data; |
622 |
_tmp48__length1 = _tmp47_->data_length1; |
623 |
{ |
624 |
IBusEngineDesc** engine_collection = NULL; |
625 |
gint engine_collection_length1 = 0; |
626 |
gint _engine_collection_size_ = 0; |
627 |
gint engine_it = 0; |
628 |
engine_collection = _tmp48_; |
629 |
engine_collection_length1 = _tmp48__length1; |
630 |
for (engine_it = 0; engine_it < _tmp48__length1; engine_it = engine_it + 1) { |
631 |
IBusEngineDesc* _tmp49_ = NULL; |
632 |
IBusEngineDesc* engine = NULL; |
633 |
_tmp49_ = _g_object_ref0 (engine_collection[engine_it]); |
634 |
engine = _tmp49_; |
635 |
{ |
636 |
IBusEngineDesc* _tmp50_ = NULL; |
637 |
const gchar* _tmp51_ = NULL; |
638 |
IBusEngineDesc* _tmp52_ = NULL; |
639 |
const gchar* _tmp53_ = NULL; |
640 |
_tmp50_ = engine; |
641 |
_tmp51_ = ibus_engine_desc_get_name (_tmp50_); |
642 |
_tmp52_ = engine; |
643 |
_tmp53_ = ibus_engine_desc_get_longname (_tmp52_); |
644 |
g_print (" %s - %s\n", _tmp51_, _tmp53_); |
645 |
_g_object_unref0 (engine); |
646 |
} |
647 |
} |
648 |
} |
649 |
_engine_list_unref0 (list); |
650 |
} |
651 |
} |
652 |
_g_list_free0 (language_collection); |
653 |
} |
654 |
result = EXIT_SUCCESS; |
655 |
_g_hash_table_unref0 (map); |
656 |
_g_list_free0 (engines); |
657 |
_g_object_unref0 (bus); |
658 |
_g_option_context_free0 (option); |
659 |
return result; |
660 |
} |
661 |
|
662 |
|
663 |
static void _vala_array_add2 (gchar*** array, int* length, int* size, gchar* value) { |
664 |
if ((*length) == (*size)) { |
665 |
*size = (*size) ? (2 * (*size)) : 4; |
666 |
*array = g_renew (gchar*, *array, (*size) + 1); |
667 |
} |
668 |
(*array)[(*length)++] = value; |
669 |
(*array)[*length] = NULL; |
670 |
} |
671 |
|
672 |
|
673 |
static void _vala_array_add3 (gchar*** array, int* length, int* size, gchar* value) { |
674 |
if ((*length) == (*size)) { |
675 |
*size = (*size) ? (2 * (*size)) : 4; |
676 |
*array = g_renew (gchar*, *array, (*size) + 1); |
677 |
} |
678 |
(*array)[(*length)++] = value; |
679 |
(*array)[*length] = NULL; |
680 |
} |
681 |
|
682 |
|
683 |
static void _vala_array_add4 (gchar*** array, int* length, int* size, gchar* value) { |
684 |
if ((*length) == (*size)) { |
685 |
*size = (*size) ? (2 * (*size)) : 4; |
686 |
*array = g_renew (gchar*, *array, (*size) + 1); |
687 |
} |
688 |
(*array)[(*length)++] = value; |
689 |
(*array)[*length] = NULL; |
690 |
} |
691 |
|
692 |
|
693 |
static void _vala_array_add5 (gchar*** array, int* length, int* size, gchar* value) { |
694 |
if ((*length) == (*size)) { |
695 |
*size = (*size) ? (2 * (*size)) : 4; |
696 |
*array = g_renew (gchar*, *array, (*size) + 1); |
697 |
} |
698 |
(*array)[(*length)++] = value; |
699 |
(*array)[*length] = NULL; |
700 |
} |
701 |
|
702 |
|
703 |
static void _vala_array_add6 (gchar*** array, int* length, int* size, gchar* value) { |
704 |
if ((*length) == (*size)) { |
705 |
*size = (*size) ? (2 * (*size)) : 4; |
706 |
*array = g_renew (gchar*, *array, (*size) + 1); |
707 |
} |
708 |
(*array)[(*length)++] = value; |
709 |
(*array)[*length] = NULL; |
710 |
} |
711 |
|
712 |
|
713 |
static void _vala_array_add7 (gchar*** array, int* length, int* size, gchar* value) { |
714 |
if ((*length) == (*size)) { |
715 |
*size = (*size) ? (2 * (*size)) : 4; |
716 |
*array = g_renew (gchar*, *array, (*size) + 1); |
717 |
} |
718 |
(*array)[(*length)++] = value; |
719 |
(*array)[*length] = NULL; |
720 |
} |
721 |
|
722 |
|
723 |
static void _vala_array_add8 (gchar*** array, int* length, int* size, gchar* value) { |
724 |
if ((*length) == (*size)) { |
725 |
*size = (*size) ? (2 * (*size)) : 4; |
726 |
*array = g_renew (gchar*, *array, (*size) + 1); |
727 |
} |
728 |
(*array)[(*length)++] = value; |
729 |
(*array)[*length] = NULL; |
730 |
} |
731 |
|
732 |
|
733 |
gint exec_setxkbmap (IBusEngineDesc* engine) { |
734 |
gint result = 0; |
735 |
gchar* layout = NULL; |
736 |
IBusEngineDesc* _tmp0_ = NULL; |
737 |
const gchar* _tmp1_ = NULL; |
738 |
gchar* _tmp2_ = NULL; |
739 |
gchar* variant = NULL; |
740 |
IBusEngineDesc* _tmp3_ = NULL; |
741 |
const gchar* _tmp4_ = NULL; |
742 |
gchar* _tmp5_ = NULL; |
743 |
gchar* option = NULL; |
744 |
IBusEngineDesc* _tmp6_ = NULL; |
745 |
const gchar* _tmp7_ = NULL; |
746 |
gchar* _tmp8_ = NULL; |
747 |
gchar* standard_error = NULL; |
748 |
gint exit_status = 0; |
749 |
gchar** args = NULL; |
750 |
gchar* _tmp9_ = NULL; |
751 |
gchar** _tmp10_ = NULL; |
752 |
gint args_length1 = 0; |
753 |
gint _args_size_ = 0; |
754 |
gboolean _tmp11_ = FALSE; |
755 |
gboolean _tmp12_ = FALSE; |
756 |
const gchar* _tmp13_ = NULL; |
757 |
gboolean _tmp21_ = FALSE; |
758 |
gboolean _tmp22_ = FALSE; |
759 |
const gchar* _tmp23_ = NULL; |
760 |
gboolean _tmp31_ = FALSE; |
761 |
gboolean _tmp32_ = FALSE; |
762 |
const gchar* _tmp33_ = NULL; |
763 |
gchar** _tmp43_ = NULL; |
764 |
gint _tmp43__length1 = 0; |
765 |
gint _tmp53_ = 0; |
766 |
GError * _inner_error_ = NULL; |
767 |
g_return_val_if_fail (engine != NULL, 0); |
768 |
_tmp0_ = engine; |
769 |
_tmp1_ = ibus_engine_desc_get_layout (_tmp0_); |
770 |
_tmp2_ = g_strdup (_tmp1_); |
771 |
layout = _tmp2_; |
772 |
_tmp3_ = engine; |
773 |
_tmp4_ = ibus_engine_desc_get_layout_variant (_tmp3_); |
774 |
_tmp5_ = g_strdup (_tmp4_); |
775 |
variant = _tmp5_; |
776 |
_tmp6_ = engine; |
777 |
_tmp7_ = ibus_engine_desc_get_layout_option (_tmp6_); |
778 |
_tmp8_ = g_strdup (_tmp7_); |
779 |
option = _tmp8_; |
780 |
standard_error = NULL; |
781 |
exit_status = 0; |
782 |
_tmp9_ = g_strdup ("setxkbmap"); |
783 |
_tmp10_ = g_new0 (gchar*, 1 + 1); |
784 |
_tmp10_[0] = _tmp9_; |
785 |
args = _tmp10_; |
786 |
args_length1 = 1; |
787 |
_args_size_ = args_length1; |
788 |
_tmp13_ = layout; |
789 |
if (_tmp13_ != NULL) { |
790 |
const gchar* _tmp14_ = NULL; |
791 |
_tmp14_ = layout; |
792 |
_tmp12_ = g_strcmp0 (_tmp14_, "") != 0; |
793 |
} else { |
794 |
_tmp12_ = FALSE; |
795 |
} |
796 |
if (_tmp12_) { |
797 |
const gchar* _tmp15_ = NULL; |
798 |
_tmp15_ = layout; |
799 |
_tmp11_ = g_strcmp0 (_tmp15_, "default") != 0; |
800 |
} else { |
801 |
_tmp11_ = FALSE; |
802 |
} |
803 |
if (_tmp11_) { |
804 |
gchar** _tmp16_ = NULL; |
805 |
gint _tmp16__length1 = 0; |
806 |
gchar* _tmp17_ = NULL; |
807 |
gchar** _tmp18_ = NULL; |
808 |
gint _tmp18__length1 = 0; |
809 |
const gchar* _tmp19_ = NULL; |
810 |
gchar* _tmp20_ = NULL; |
811 |
_tmp16_ = args; |
812 |
_tmp16__length1 = args_length1; |
813 |
_tmp17_ = g_strdup ("-layout"); |
814 |
_vala_array_add2 (&args, &args_length1, &_args_size_, _tmp17_); |
815 |
_tmp18_ = args; |
816 |
_tmp18__length1 = args_length1; |
817 |
_tmp19_ = layout; |
818 |
_tmp20_ = g_strdup (_tmp19_); |
819 |
_vala_array_add3 (&args, &args_length1, &_args_size_, _tmp20_); |
820 |
} |
821 |
_tmp23_ = variant; |
822 |
if (_tmp23_ != NULL) { |
823 |
const gchar* _tmp24_ = NULL; |
824 |
_tmp24_ = variant; |
825 |
_tmp22_ = g_strcmp0 (_tmp24_, "") != 0; |
826 |
} else { |
827 |
_tmp22_ = FALSE; |
828 |
} |
829 |
if (_tmp22_) { |
830 |
const gchar* _tmp25_ = NULL; |
831 |
_tmp25_ = variant; |
832 |
_tmp21_ = g_strcmp0 (_tmp25_, "default") != 0; |
833 |
} else { |
834 |
_tmp21_ = FALSE; |
835 |
} |
836 |
if (_tmp21_) { |
837 |
gchar** _tmp26_ = NULL; |
838 |
gint _tmp26__length1 = 0; |
839 |
gchar* _tmp27_ = NULL; |
840 |
gchar** _tmp28_ = NULL; |
841 |
gint _tmp28__length1 = 0; |
842 |
const gchar* _tmp29_ = NULL; |
843 |
gchar* _tmp30_ = NULL; |
844 |
_tmp26_ = args; |
845 |
_tmp26__length1 = args_length1; |
846 |
_tmp27_ = g_strdup ("-variant"); |
847 |
_vala_array_add4 (&args, &args_length1, &_args_size_, _tmp27_); |
848 |
_tmp28_ = args; |
849 |
_tmp28__length1 = args_length1; |
850 |
_tmp29_ = variant; |
851 |
_tmp30_ = g_strdup (_tmp29_); |
852 |
_vala_array_add5 (&args, &args_length1, &_args_size_, _tmp30_); |
853 |
} |
854 |
_tmp33_ = option; |
855 |
if (_tmp33_ != NULL) { |
856 |
const gchar* _tmp34_ = NULL; |
857 |
_tmp34_ = option; |
858 |
_tmp32_ = g_strcmp0 (_tmp34_, "") != 0; |
859 |
} else { |
860 |
_tmp32_ = FALSE; |
861 |
} |
862 |
if (_tmp32_) { |
863 |
const gchar* _tmp35_ = NULL; |
864 |
_tmp35_ = option; |
865 |
_tmp31_ = g_strcmp0 (_tmp35_, "default") != 0; |
866 |
} else { |
867 |
_tmp31_ = FALSE; |
868 |
} |
869 |
if (_tmp31_) { |
870 |
gchar** _tmp36_ = NULL; |
871 |
gint _tmp36__length1 = 0; |
872 |
gchar* _tmp37_ = NULL; |
873 |
gchar** _tmp38_ = NULL; |
874 |
gint _tmp38__length1 = 0; |
875 |
gchar* _tmp39_ = NULL; |
876 |
gchar** _tmp40_ = NULL; |
877 |
gint _tmp40__length1 = 0; |
878 |
const gchar* _tmp41_ = NULL; |
879 |
gchar* _tmp42_ = NULL; |
880 |
_tmp36_ = args; |
881 |
_tmp36__length1 = args_length1; |
882 |
_tmp37_ = g_strdup ("-option"); |
883 |
_vala_array_add6 (&args, &args_length1, &_args_size_, _tmp37_); |
884 |
_tmp38_ = args; |
885 |
_tmp38__length1 = args_length1; |
886 |
_tmp39_ = g_strdup ("-option"); |
887 |
_vala_array_add7 (&args, &args_length1, &_args_size_, _tmp39_); |
888 |
_tmp40_ = args; |
889 |
_tmp40__length1 = args_length1; |
890 |
_tmp41_ = option; |
891 |
_tmp42_ = g_strdup (_tmp41_); |
892 |
_vala_array_add8 (&args, &args_length1, &_args_size_, _tmp42_); |
893 |
} |
894 |
_tmp43_ = args; |
895 |
_tmp43__length1 = args_length1; |
896 |
if (_tmp43__length1 == 1) { |
897 |
result = EXIT_FAILURE; |
898 |
args = (_vala_array_free (args, args_length1, (GDestroyNotify) g_free), NULL); |
899 |
_g_free0 (standard_error); |
900 |
_g_free0 (option); |
901 |
_g_free0 (variant); |
902 |
_g_free0 (layout); |
903 |
return result; |
904 |
} |
905 |
{ |
906 |
gboolean _tmp44_ = FALSE; |
907 |
gchar** _tmp45_ = NULL; |
908 |
gint _tmp45__length1 = 0; |
909 |
gchar* _tmp46_ = NULL; |
910 |
gint _tmp47_ = 0; |
911 |
gboolean _tmp48_ = FALSE; |
912 |
_tmp45_ = args; |
913 |
_tmp45__length1 = args_length1; |
914 |
_tmp48_ = g_spawn_sync (NULL, _tmp45_, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &_tmp46_, &_tmp47_, &_inner_error_); |
915 |
_g_free0 (standard_error); |
916 |
standard_error = _tmp46_; |
917 |
exit_status = _tmp47_; |
918 |
_tmp44_ = _tmp48_; |
919 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
920 |
if (_inner_error_->domain == G_SPAWN_ERROR) { |
921 |
goto __catch1_g_spawn_error; |
922 |
} |
923 |
args = (_vala_array_free (args, args_length1, (GDestroyNotify) g_free), NULL); |
924 |
_g_free0 (standard_error); |
925 |
_g_free0 (option); |
926 |
_g_free0 (variant); |
927 |
_g_free0 (layout); |
928 |
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); |
929 |
g_clear_error (&_inner_error_); |
930 |
return 0; |
931 |
} |
932 |
if (!_tmp44_) { |
933 |
IBusEngineDesc* _tmp49_ = NULL; |
934 |
const gchar* _tmp50_ = NULL; |
935 |
_tmp49_ = engine; |
936 |
_tmp50_ = ibus_engine_desc_get_layout (_tmp49_); |
937 |
g_warning ("main.vala:133: Switch xkb layout to %s failed.", _tmp50_); |
938 |
result = EXIT_FAILURE; |
939 |
args = (_vala_array_free (args, args_length1, (GDestroyNotify) g_free), NULL); |
940 |
_g_free0 (standard_error); |
941 |
_g_free0 (option); |
942 |
_g_free0 (variant); |
943 |
_g_free0 (layout); |
944 |
return result; |
945 |
} |
946 |
} |
947 |
goto __finally1; |
948 |
__catch1_g_spawn_error: |
949 |
{ |
950 |
GError* e = NULL; |
951 |
GError* _tmp51_ = NULL; |
952 |
const gchar* _tmp52_ = NULL; |
953 |
e = _inner_error_; |
954 |
_inner_error_ = NULL; |
955 |
_tmp51_ = e; |
956 |
_tmp52_ = _tmp51_->message; |
957 |
g_warning ("main.vala:138: Execute setxkbmap failed: %s", _tmp52_); |
958 |
result = EXIT_FAILURE; |
959 |
_g_error_free0 (e); |
960 |
args = (_vala_array_free (args, args_length1, (GDestroyNotify) g_free), NULL); |
961 |
_g_free0 (standard_error); |
962 |
_g_free0 (option); |
963 |
_g_free0 (variant); |
964 |
_g_free0 (layout); |
965 |
return result; |
966 |
} |
967 |
__finally1: |
968 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
969 |
args = (_vala_array_free (args, args_length1, (GDestroyNotify) g_free), NULL); |
970 |
_g_free0 (standard_error); |
971 |
_g_free0 (option); |
972 |
_g_free0 (variant); |
973 |
_g_free0 (layout); |
974 |
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); |
975 |
g_clear_error (&_inner_error_); |
976 |
return 0; |
977 |
} |
978 |
_tmp53_ = exit_status; |
979 |
if (_tmp53_ != 0) { |
980 |
const gchar* _tmp54_ = NULL; |
981 |
const gchar* _tmp55_ = NULL; |
982 |
_tmp55_ = standard_error; |
983 |
_tmp54_ = _tmp55_; |
984 |
if (_tmp54_ == NULL) { |
985 |
_tmp54_ = "(null)"; |
986 |
} |
987 |
g_warning ("main.vala:143: Execute setxkbmap failed: %s", _tmp54_); |
988 |
result = EXIT_FAILURE; |
989 |
args = (_vala_array_free (args, args_length1, (GDestroyNotify) g_free), NULL); |
990 |
_g_free0 (standard_error); |
991 |
_g_free0 (option); |
992 |
_g_free0 (variant); |
993 |
_g_free0 (layout); |
994 |
return result; |
995 |
} |
996 |
result = EXIT_SUCCESS; |
997 |
args = (_vala_array_free (args, args_length1, (GDestroyNotify) g_free), NULL); |
998 |
_g_free0 (standard_error); |
999 |
_g_free0 (option); |
1000 |
_g_free0 (variant); |
1001 |
_g_free0 (layout); |
1002 |
return result; |
1003 |
} |
1004 |
|
1005 |
|
1006 |
gint get_set_engine (gchar** argv, int argv_length1) { |
1007 |
gint result = 0; |
1008 |
IBusBus* bus = NULL; |
1009 |
IBusBus* _tmp0_ = NULL; |
1010 |
gchar* engine = NULL; |
1011 |
gchar** _tmp1_ = NULL; |
1012 |
gint _tmp1__length1 = 0; |
1013 |
const gchar* _tmp5_ = NULL; |
1014 |
IBusBus* _tmp13_ = NULL; |
1015 |
const gchar* _tmp14_ = NULL; |
1016 |
gboolean _tmp15_ = FALSE; |
1017 |
IBusEngineDesc* desc = NULL; |
1018 |
IBusBus* _tmp18_ = NULL; |
1019 |
IBusEngineDesc* _tmp19_ = NULL; |
1020 |
IBusEngineDesc* _tmp20_ = NULL; |
1021 |
IBusEngineDesc* _tmp23_ = NULL; |
1022 |
gint _tmp24_ = 0; |
1023 |
_tmp0_ = get_bus (); |
1024 |
bus = _tmp0_; |
1025 |
engine = NULL; |
1026 |
_tmp1_ = argv; |
1027 |
_tmp1__length1 = argv_length1; |
1028 |
if (_tmp1__length1 > 1) { |
1029 |
gchar** _tmp2_ = NULL; |
1030 |
gint _tmp2__length1 = 0; |
1031 |
const gchar* _tmp3_ = NULL; |
1032 |
gchar* _tmp4_ = NULL; |
1033 |
_tmp2_ = argv; |
1034 |
_tmp2__length1 = argv_length1; |
1035 |
_tmp3_ = _tmp2_[1]; |
1036 |
_tmp4_ = g_strdup (_tmp3_); |
1037 |
_g_free0 (engine); |
1038 |
engine = _tmp4_; |
1039 |
} |
1040 |
_tmp5_ = engine; |
1041 |
if (_tmp5_ == NULL) { |
1042 |
IBusEngineDesc* desc = NULL; |
1043 |
IBusBus* _tmp6_ = NULL; |
1044 |
IBusEngineDesc* _tmp7_ = NULL; |
1045 |
IBusEngineDesc* _tmp8_ = NULL; |
1046 |
IBusEngineDesc* _tmp11_ = NULL; |
1047 |
const gchar* _tmp12_ = NULL; |
1048 |
_tmp6_ = bus; |
1049 |
_tmp7_ = ibus_bus_get_global_engine (_tmp6_); |
1050 |
desc = _tmp7_; |
1051 |
_tmp8_ = desc; |
1052 |
if (_tmp8_ == NULL) { |
1053 |
FILE* _tmp9_ = NULL; |
1054 |
const gchar* _tmp10_ = NULL; |
1055 |
_tmp9_ = stderr; |
1056 |
_tmp10_ = _ ("No engine is set.\n"); |
1057 |
fprintf (_tmp9_, "%s", _tmp10_); |
1058 |
result = EXIT_FAILURE; |
1059 |
_g_object_unref0 (desc); |
1060 |
_g_free0 (engine); |
1061 |
_g_object_unref0 (bus); |
1062 |
return result; |
1063 |
} |
1064 |
_tmp11_ = desc; |
1065 |
_tmp12_ = ibus_engine_desc_get_name (_tmp11_); |
1066 |
g_print ("%s\n", _tmp12_); |
1067 |
result = EXIT_SUCCESS; |
1068 |
_g_object_unref0 (desc); |
1069 |
_g_free0 (engine); |
1070 |
_g_object_unref0 (bus); |
1071 |
return result; |
1072 |
} |
1073 |
_tmp13_ = bus; |
1074 |
_tmp14_ = engine; |
1075 |
_tmp15_ = ibus_bus_set_global_engine (_tmp13_, _tmp14_); |
1076 |
if (!_tmp15_) { |
1077 |
FILE* _tmp16_ = NULL; |
1078 |
const gchar* _tmp17_ = NULL; |
1079 |
_tmp16_ = stderr; |
1080 |
_tmp17_ = _ ("Set global engine failed.\n"); |
1081 |
fprintf (_tmp16_, "%s", _tmp17_); |
1082 |
result = EXIT_FAILURE; |
1083 |
_g_free0 (engine); |
1084 |
_g_object_unref0 (bus); |
1085 |
return result; |
1086 |
} |
1087 |
_tmp18_ = bus; |
1088 |
_tmp19_ = ibus_bus_get_global_engine (_tmp18_); |
1089 |
desc = _tmp19_; |
1090 |
_tmp20_ = desc; |
1091 |
if (_tmp20_ == NULL) { |
1092 |
FILE* _tmp21_ = NULL; |
1093 |
const gchar* _tmp22_ = NULL; |
1094 |
_tmp21_ = stderr; |
1095 |
_tmp22_ = _ ("Get global engine failed.\n"); |
1096 |
fprintf (_tmp21_, "%s", _tmp22_); |
1097 |
result = EXIT_FAILURE; |
1098 |
_g_object_unref0 (desc); |
1099 |
_g_free0 (engine); |
1100 |
_g_object_unref0 (bus); |
1101 |
return result; |
1102 |
} |
1103 |
_tmp23_ = desc; |
1104 |
_tmp24_ = exec_setxkbmap (_tmp23_); |
1105 |
result = _tmp24_; |
1106 |
_g_object_unref0 (desc); |
1107 |
_g_free0 (engine); |
1108 |
_g_object_unref0 (bus); |
1109 |
return result; |
1110 |
} |
1111 |
|
1112 |
|
1113 |
gint message_watch (gchar** argv, int argv_length1) { |
1114 |
gint result = 0; |
1115 |
result = EXIT_SUCCESS; |
1116 |
return result; |
1117 |
} |
1118 |
|
1119 |
|
1120 |
gint restart_daemon (gchar** argv, int argv_length1) { |
1121 |
gint result = 0; |
1122 |
IBusBus* bus = NULL; |
1123 |
IBusBus* _tmp0_ = NULL; |
1124 |
IBusBus* _tmp1_ = NULL; |
1125 |
IBusBus* _tmp4_ = NULL; |
1126 |
_tmp0_ = get_bus (); |
1127 |
bus = _tmp0_; |
1128 |
_tmp1_ = bus; |
1129 |
if (_tmp1_ == NULL) { |
1130 |
FILE* _tmp2_ = NULL; |
1131 |
const gchar* _tmp3_ = NULL; |
1132 |
_tmp2_ = stderr; |
1133 |
_tmp3_ = _ ("Can't connect to IBus.\n"); |
1134 |
fprintf (_tmp2_, "%s", _tmp3_); |
1135 |
result = EXIT_FAILURE; |
1136 |
_g_object_unref0 (bus); |
1137 |
return result; |
1138 |
} |
1139 |
_tmp4_ = bus; |
1140 |
ibus_bus_exit (_tmp4_, TRUE); |
1141 |
result = EXIT_SUCCESS; |
1142 |
_g_object_unref0 (bus); |
1143 |
return result; |
1144 |
} |
1145 |
|
1146 |
|
1147 |
gint exit_daemon (gchar** argv, int argv_length1) { |
1148 |
gint result = 0; |
1149 |
IBusBus* bus = NULL; |
1150 |
IBusBus* _tmp0_ = NULL; |
1151 |
IBusBus* _tmp1_ = NULL; |
1152 |
IBusBus* _tmp4_ = NULL; |
1153 |
_tmp0_ = get_bus (); |
1154 |
bus = _tmp0_; |
1155 |
_tmp1_ = bus; |
1156 |
if (_tmp1_ == NULL) { |
1157 |
FILE* _tmp2_ = NULL; |
1158 |
const gchar* _tmp3_ = NULL; |
1159 |
_tmp2_ = stderr; |
1160 |
_tmp3_ = _ ("Can't connect to IBus.\n"); |
1161 |
fprintf (_tmp2_, "%s", _tmp3_); |
1162 |
result = EXIT_FAILURE; |
1163 |
_g_object_unref0 (bus); |
1164 |
return result; |
1165 |
} |
1166 |
_tmp4_ = bus; |
1167 |
ibus_bus_exit (_tmp4_, FALSE); |
1168 |
result = EXIT_SUCCESS; |
1169 |
_g_object_unref0 (bus); |
1170 |
return result; |
1171 |
} |
1172 |
|
1173 |
|
1174 |
gint print_version (gchar** argv, int argv_length1) { |
1175 |
gint result = 0; |
1176 |
g_print ("IBus %s\n", PACKAGE_VERSION); |
1177 |
result = EXIT_SUCCESS; |
1178 |
return result; |
1179 |
} |
1180 |
|
1181 |
|
1182 |
gint read_cache (gchar** argv, int argv_length1) { |
1183 |
gint result = 0; |
1184 |
static const GOptionEntry options[] = {{"system", (gchar) 0, 0, G_OPTION_ARG_NONE, &is_system, "Read the system registry cache.", NULL}, {"file", (gchar) 0, 0, G_OPTION_ARG_STRING, &cache_file, "Read the registry cache FILE.", "FILE"}, {NULL}}; |
1185 |
GOptionContext* option = NULL; |
1186 |
GOptionContext* _tmp0_ = NULL; |
1187 |
GOptionContext* _tmp1_ = NULL; |
1188 |
IBusRegistry* registry = NULL; |
1189 |
IBusRegistry* _tmp6_ = NULL; |
1190 |
const gchar* _tmp7_ = NULL; |
1191 |
GString* output = NULL; |
1192 |
GString* _tmp18_ = NULL; |
1193 |
IBusRegistry* _tmp19_ = NULL; |
1194 |
GString* _tmp20_ = NULL; |
1195 |
GString* _tmp21_ = NULL; |
1196 |
const gchar* _tmp22_ = NULL; |
1197 |
GError * _inner_error_ = NULL; |
1198 |
_tmp0_ = g_option_context_new (NULL); |
1199 |
option = _tmp0_; |
1200 |
_tmp1_ = option; |
1201 |
g_option_context_add_main_entries (_tmp1_, options, GETTEXT_PACKAGE); |
1202 |
{ |
1203 |
GOptionContext* _tmp2_ = NULL; |
1204 |
_tmp2_ = option; |
1205 |
g_option_context_parse (_tmp2_, &argv_length1, &argv, &_inner_error_); |
1206 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
1207 |
if (_inner_error_->domain == G_OPTION_ERROR) { |
1208 |
goto __catch2_g_option_error; |
1209 |
} |
1210 |
_g_option_context_free0 (option); |
1211 |
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); |
1212 |
g_clear_error (&_inner_error_); |
1213 |
return 0; |
1214 |
} |
1215 |
} |
1216 |
goto __finally2; |
1217 |
__catch2_g_option_error: |
1218 |
{ |
1219 |
GError* e = NULL; |
1220 |
FILE* _tmp3_ = NULL; |
1221 |
GError* _tmp4_ = NULL; |
1222 |
const gchar* _tmp5_ = NULL; |
1223 |
e = _inner_error_; |
1224 |
_inner_error_ = NULL; |
1225 |
_tmp3_ = stderr; |
1226 |
_tmp4_ = e; |
1227 |
_tmp5_ = _tmp4_->message; |
1228 |
fprintf (_tmp3_, "%s\n", _tmp5_); |
1229 |
result = EXIT_FAILURE; |
1230 |
_g_error_free0 (e); |
1231 |
_g_option_context_free0 (option); |
1232 |
return result; |
1233 |
} |
1234 |
__finally2: |
1235 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
1236 |
_g_option_context_free0 (option); |
1237 |
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); |
1238 |
g_clear_error (&_inner_error_); |
1239 |
return 0; |
1240 |
} |
1241 |
_tmp6_ = ibus_registry_new (); |
1242 |
g_object_ref_sink (_tmp6_); |
1243 |
registry = _tmp6_; |
1244 |
_tmp7_ = cache_file; |
1245 |
if (_tmp7_ != NULL) { |
1246 |
IBusRegistry* _tmp8_ = NULL; |
1247 |
const gchar* _tmp9_ = NULL; |
1248 |
gboolean _tmp10_ = FALSE; |
1249 |
_tmp8_ = registry; |
1250 |
_tmp9_ = cache_file; |
1251 |
_tmp10_ = ibus_registry_load_cache_file (_tmp8_, _tmp9_); |
1252 |
if (!_tmp10_) { |
1253 |
FILE* _tmp11_ = NULL; |
1254 |
const gchar* _tmp12_ = NULL; |
1255 |
_tmp11_ = stderr; |
1256 |
_tmp12_ = _ ("The registry cache is invalid.\n"); |
1257 |
fprintf (_tmp11_, "%s", _tmp12_); |
1258 |
result = EXIT_FAILURE; |
1259 |
_g_object_unref0 (registry); |
1260 |
_g_option_context_free0 (option); |
1261 |
return result; |
1262 |
} |
1263 |
} else { |
1264 |
IBusRegistry* _tmp13_ = NULL; |
1265 |
gboolean _tmp14_ = FALSE; |
1266 |
gboolean _tmp15_ = FALSE; |
1267 |
_tmp13_ = registry; |
1268 |
_tmp14_ = is_system; |
1269 |
_tmp15_ = ibus_registry_load_cache (_tmp13_, !_tmp14_); |
1270 |
if (!_tmp15_) { |
1271 |
FILE* _tmp16_ = NULL; |
1272 |
const gchar* _tmp17_ = NULL; |
1273 |
_tmp16_ = stderr; |
1274 |
_tmp17_ = _ ("The registry cache is invalid.\n"); |
1275 |
fprintf (_tmp16_, "%s", _tmp17_); |
1276 |
result = EXIT_FAILURE; |
1277 |
_g_object_unref0 (registry); |
1278 |
_g_option_context_free0 (option); |
1279 |
return result; |
1280 |
} |
1281 |
} |
1282 |
_tmp18_ = g_string_new (""); |
1283 |
output = _tmp18_; |
1284 |
_tmp19_ = registry; |
1285 |
_tmp20_ = output; |
1286 |
ibus_registry_output (_tmp19_, _tmp20_, 1); |
1287 |
_tmp21_ = output; |
1288 |
_tmp22_ = _tmp21_->str; |
1289 |
g_print ("%s\n", _tmp22_); |
1290 |
result = EXIT_SUCCESS; |
1291 |
_g_string_free0 (output); |
1292 |
_g_object_unref0 (registry); |
1293 |
_g_option_context_free0 (option); |
1294 |
return result; |
1295 |
} |
1296 |
|
1297 |
|
1298 |
gint write_cache (gchar** argv, int argv_length1) { |
1299 |
gint result = 0; |
1300 |
static const GOptionEntry options[] = {{"system", (gchar) 0, 0, G_OPTION_ARG_NONE, &is_system, "Write the system registry cache.", NULL}, {"file", (gchar) 0, 0, G_OPTION_ARG_STRING, &cache_file, "Write the registry cache FILE.", "FILE"}, {NULL}}; |
1301 |
GOptionContext* option = NULL; |
1302 |
GOptionContext* _tmp0_ = NULL; |
1303 |
GOptionContext* _tmp1_ = NULL; |
1304 |
IBusRegistry* registry = NULL; |
1305 |
IBusRegistry* _tmp6_ = NULL; |
1306 |
IBusRegistry* _tmp7_ = NULL; |
1307 |
const gchar* _tmp8_ = NULL; |
1308 |
gint _tmp13_ = 0; |
1309 |
IBusRegistry* _tmp14_ = NULL; |
1310 |
gboolean _tmp15_ = FALSE; |
1311 |
gboolean _tmp16_ = FALSE; |
1312 |
GError * _inner_error_ = NULL; |
1313 |
_tmp0_ = g_option_context_new (NULL); |
1314 |
option = _tmp0_; |
1315 |
_tmp1_ = option; |
1316 |
g_option_context_add_main_entries (_tmp1_, options, GETTEXT_PACKAGE); |
1317 |
{ |
1318 |
GOptionContext* _tmp2_ = NULL; |
1319 |
_tmp2_ = option; |
1320 |
g_option_context_parse (_tmp2_, &argv_length1, &argv, &_inner_error_); |
1321 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
1322 |
if (_inner_error_->domain == G_OPTION_ERROR) { |
1323 |
goto __catch3_g_option_error; |
1324 |
} |
1325 |
_g_option_context_free0 (option); |
1326 |
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); |
1327 |
g_clear_error (&_inner_error_); |
1328 |
return 0; |
1329 |
} |
1330 |
} |
1331 |
goto __finally3; |
1332 |
__catch3_g_option_error: |
1333 |
{ |
1334 |
GError* e = NULL; |
1335 |
FILE* _tmp3_ = NULL; |
1336 |
GError* _tmp4_ = NULL; |
1337 |
const gchar* _tmp5_ = NULL; |
1338 |
e = _inner_error_; |
1339 |
_inner_error_ = NULL; |
1340 |
_tmp3_ = stderr; |
1341 |
_tmp4_ = e; |
1342 |
_tmp5_ = _tmp4_->message; |
1343 |
fprintf (_tmp3_, "%s\n", _tmp5_); |
1344 |
result = EXIT_FAILURE; |
1345 |
_g_error_free0 (e); |
1346 |
_g_option_context_free0 (option); |
1347 |
return result; |
1348 |
} |
1349 |
__finally3: |
1350 |
if (G_UNLIKELY (_inner_error_ != NULL)) { |
1351 |
_g_option_context_free0 (option); |
1352 |
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); |
1353 |
g_clear_error (&_inner_error_); |
1354 |
return 0; |
1355 |
} |
1356 |
_tmp6_ = ibus_registry_new (); |
1357 |
g_object_ref_sink (_tmp6_); |
1358 |
registry = _tmp6_; |
1359 |
_tmp7_ = registry; |
1360 |
ibus_registry_load (_tmp7_); |
1361 |
_tmp8_ = cache_file; |
1362 |
if (_tmp8_ != NULL) { |
1363 |
gint _tmp9_ = 0; |
1364 |
IBusRegistry* _tmp10_ = NULL; |
1365 |
const gchar* _tmp11_ = NULL; |
1366 |
gboolean _tmp12_ = FALSE; |
1367 |
_tmp10_ = registry; |
1368 |
_tmp11_ = cache_file; |
1369 |
_tmp12_ = ibus_registry_save_cache_file (_tmp10_, _tmp11_); |
1370 |
if (_tmp12_) { |
1371 |
_tmp9_ = EXIT_SUCCESS; |
1372 |
} else { |
1373 |
_tmp9_ = EXIT_FAILURE; |
1374 |
} |
1375 |
result = _tmp9_; |
1376 |
_g_object_unref0 (registry); |
1377 |
_g_option_context_free0 (option); |
1378 |
return result; |
1379 |
} |
1380 |
_tmp14_ = registry; |
1381 |
_tmp15_ = is_system; |
1382 |
_tmp16_ = ibus_registry_save_cache (_tmp14_, !_tmp15_); |
1383 |
if (_tmp16_) { |
1384 |
_tmp13_ = EXIT_SUCCESS; |
1385 |
} else { |
1386 |
_tmp13_ = EXIT_FAILURE; |
1387 |
} |
1388 |
result = _tmp13_; |
1389 |
_g_object_unref0 (registry); |
1390 |
_g_option_context_free0 (option); |
1391 |
return result; |
1392 |
} |
1393 |
|
1394 |
|
1395 |
gint print_address (gchar** argv, int argv_length1) { |
1396 |
gint result = 0; |
1397 |
gchar* address = NULL; |
1398 |
const gchar* _tmp0_ = NULL; |
1399 |
gchar* _tmp1_ = NULL; |
1400 |
const gchar* _tmp2_ = NULL; |
1401 |
const gchar* _tmp3_ = NULL; |
1402 |
_tmp0_ = ibus_get_address (); |
1403 |
_tmp1_ = g_strdup (_tmp0_); |
1404 |
address = _tmp1_; |
1405 |
_tmp3_ = address; |
1406 |
if (_tmp3_ != NULL) { |
1407 |
const gchar* _tmp4_ = NULL; |
1408 |
_tmp4_ = address; |
1409 |
_tmp2_ = _tmp4_; |
1410 |
} else { |
1411 |
_tmp2_ = "(null)"; |
1412 |
} |
1413 |
g_print ("%s\n", _tmp2_); |
1414 |
result = EXIT_SUCCESS; |
1415 |
_g_free0 (address); |
1416 |
return result; |
1417 |
} |
1418 |
|
1419 |
|
1420 |
gint read_config (gchar** argv, int argv_length1) { |
1421 |
gint result = 0; |
1422 |
GString* output = NULL; |
1423 |
GString* _tmp0_ = NULL; |
1424 |
GString* _tmp18_ = NULL; |
1425 |
const gchar* _tmp19_ = NULL; |
1426 |
_tmp0_ = g_string_new (""); |
1427 |
output = _tmp0_; |
1428 |
{ |
1429 |
const gchar** schema_collection = NULL; |
1430 |
gint schema_collection_length1 = 0; |
1431 |
gint _schema_collection_size_ = 0; |
1432 |
gint schema_it = 0; |
1433 |
schema_collection = IBUS_SCHEMAS; |
1434 |
schema_collection_length1 = G_N_ELEMENTS (IBUS_SCHEMAS); |
1435 |
for (schema_it = 0; schema_it < G_N_ELEMENTS (IBUS_SCHEMAS); schema_it = schema_it + 1) { |
1436 |
gchar* _tmp1_ = NULL; |
1437 |
gchar* schema = NULL; |
1438 |
_tmp1_ = g_strdup (schema_collection[schema_it]); |
1439 |
schema = _tmp1_; |
1440 |
{ |
1441 |
GSettings* settings = NULL; |
1442 |
const gchar* _tmp2_ = NULL; |
1443 |
GSettings* _tmp3_ = NULL; |
1444 |
GString* _tmp4_ = NULL; |
1445 |
const gchar* _tmp5_ = NULL; |
1446 |
GSettings* _tmp6_ = NULL; |
1447 |
gchar** _tmp7_ = NULL; |
1448 |
gchar** _tmp8_ = NULL; |
1449 |
_tmp2_ = schema; |
1450 |
_tmp3_ = g_settings_new (_tmp2_); |
1451 |
settings = _tmp3_; |
1452 |
_tmp4_ = output; |
1453 |
_tmp5_ = schema; |
1454 |
g_string_append_printf (_tmp4_, "SCHEMA: %s\n", _tmp5_); |
1455 |
_tmp6_ = settings; |
1456 |
_tmp8_ = _tmp7_ = g_settings_list_keys (_tmp6_); |
1457 |
{ |
1458 |
gchar** key_collection = NULL; |
1459 |
gint key_collection_length1 = 0; |
1460 |
gint _key_collection_size_ = 0; |
1461 |
gint key_it = 0; |
1462 |
key_collection = _tmp8_; |
1463 |
key_collection_length1 = _vala_array_length (_tmp7_); |
1464 |
for (key_it = 0; key_it < _vala_array_length (_tmp7_); key_it = key_it + 1) { |
1465 |
gchar* _tmp9_ = NULL; |
1466 |
gchar* key = NULL; |
1467 |
_tmp9_ = g_strdup (key_collection[key_it]); |
1468 |
key = _tmp9_; |
1469 |
{ |
1470 |
GVariant* variant = NULL; |
1471 |
GSettings* _tmp10_ = NULL; |
1472 |
const gchar* _tmp11_ = NULL; |
1473 |
GVariant* _tmp12_ = NULL; |
1474 |
GString* _tmp13_ = NULL; |
1475 |
const gchar* _tmp14_ = NULL; |
1476 |
GVariant* _tmp15_ = NULL; |
1477 |
gchar* _tmp16_ = NULL; |
1478 |
gchar* _tmp17_ = NULL; |
1479 |
_tmp10_ = settings; |
1480 |
_tmp11_ = key; |
1481 |
_tmp12_ = g_settings_get_value (_tmp10_, _tmp11_); |
1482 |
variant = _tmp12_; |
1483 |
_tmp13_ = output; |
1484 |
_tmp14_ = key; |
1485 |
_tmp15_ = variant; |
1486 |
_tmp16_ = g_variant_print (_tmp15_, TRUE); |
1487 |
_tmp17_ = _tmp16_; |
1488 |
g_string_append_printf (_tmp13_, " %s: %s\n", _tmp14_, _tmp17_); |
1489 |
_g_free0 (_tmp17_); |
1490 |
_g_variant_unref0 (variant); |
1491 |
_g_free0 (key); |
1492 |
} |
1493 |
} |
1494 |
key_collection = (_vala_array_free (key_collection, key_collection_length1, (GDestroyNotify) g_free), NULL); |
1495 |
} |
1496 |
_g_object_unref0 (settings); |
1497 |
_g_free0 (schema); |
1498 |
} |
1499 |
} |
1500 |
} |
1501 |
_tmp18_ = output; |
1502 |
_tmp19_ = _tmp18_->str; |
1503 |
g_print ("%s", _tmp19_); |
1504 |
result = EXIT_SUCCESS; |
1505 |
_g_string_free0 (output); |
1506 |
return result; |
1507 |
} |
1508 |
|
1509 |
|
1510 |
gint reset_config (gchar** argv, int argv_length1) { |
1511 |
gint result = 0; |
1512 |
const gchar* _tmp0_ = NULL; |
1513 |
const gchar* _tmp12_ = NULL; |
1514 |
_tmp0_ = _ ("Resetting…"); |
1515 |
g_print ("%s\n", _tmp0_); |
1516 |
{ |
1517 |
const gchar** schema_collection = NULL; |
1518 |
gint schema_collection_length1 = 0; |
1519 |
gint _schema_collection_size_ = 0; |
1520 |
gint schema_it = 0; |
1521 |
schema_collection = IBUS_SCHEMAS; |
1522 |
schema_collection_length1 = G_N_ELEMENTS (IBUS_SCHEMAS); |
1523 |
for (schema_it = 0; schema_it < G_N_ELEMENTS (IBUS_SCHEMAS); schema_it = schema_it + 1) { |
1524 |
gchar* _tmp1_ = NULL; |
1525 |
gchar* schema = NULL; |
1526 |
_tmp1_ = g_strdup (schema_collection[schema_it]); |
1527 |
schema = _tmp1_; |
1528 |
{ |
1529 |
GSettings* settings = NULL; |
1530 |
const gchar* _tmp2_ = NULL; |
1531 |
GSettings* _tmp3_ = NULL; |
1532 |
const gchar* _tmp4_ = NULL; |
1533 |
GSettings* _tmp5_ = NULL; |
1534 |
gchar** _tmp6_ = NULL; |
1535 |
gchar** _tmp7_ = NULL; |
1536 |
_tmp2_ = schema; |
1537 |
_tmp3_ = g_settings_new (_tmp2_); |
1538 |
settings = _tmp3_; |
1539 |
_tmp4_ = schema; |
1540 |
g_print ("SCHEMA: %s\n", _tmp4_); |
1541 |
_tmp5_ = settings; |
1542 |
_tmp7_ = _tmp6_ = g_settings_list_keys (_tmp5_); |
1543 |
{ |
1544 |
gchar** key_collection = NULL; |
1545 |
gint key_collection_length1 = 0; |
1546 |
gint _key_collection_size_ = 0; |
1547 |
gint key_it = 0; |
1548 |
key_collection = _tmp7_; |
1549 |
key_collection_length1 = _vala_array_length (_tmp6_); |
1550 |
for (key_it = 0; key_it < _vala_array_length (_tmp6_); key_it = key_it + 1) { |
1551 |
gchar* _tmp8_ = NULL; |
1552 |
gchar* key = NULL; |
1553 |
_tmp8_ = g_strdup (key_collection[key_it]); |
1554 |
key = _tmp8_; |
1555 |
{ |
1556 |
const gchar* _tmp9_ = NULL; |
1557 |
GSettings* _tmp10_ = NULL; |
1558 |
const gchar* _tmp11_ = NULL; |
1559 |
_tmp9_ = key; |
1560 |
g_print (" %s\n", _tmp9_); |
1561 |
_tmp10_ = settings; |
1562 |
_tmp11_ = key; |
1563 |
g_settings_reset (_tmp10_, _tmp11_); |
1564 |
_g_free0 (key); |
1565 |
} |
1566 |
} |
1567 |
key_collection = (_vala_array_free (key_collection, key_collection_length1, (GDestroyNotify) g_free), NULL); |
1568 |
} |
1569 |
_g_object_unref0 (settings); |
1570 |
_g_free0 (schema); |
1571 |
} |
1572 |
} |
1573 |
} |
1574 |
g_settings_sync (); |
1575 |
_tmp12_ = _ ("Done"); |
1576 |
g_print ("%s\n", _tmp12_); |
1577 |
result = EXIT_SUCCESS; |
1578 |
return result; |
1579 |
} |
1580 |
|
1581 |
|
1582 |
static void _vala_GdkEvent_free (GdkEvent* self) { |
1583 |
g_boxed_free (gdk_event_get_type (), self); |
1584 |
} |
1585 |
|
1586 |
|
1587 |
void run_dialog (IBusEmojier* emojier) { |
1588 |
GdkEvent* event = NULL; |
1589 |
GdkEvent* _tmp0_ = NULL; |
1590 |
GdkDisplay* display = NULL; |
1591 |
GdkDisplay* _tmp1_ = NULL; |
1592 |
GdkDisplay* _tmp2_ = NULL; |
1593 |
GdkDeviceManager* device_manager = NULL; |
1594 |
GdkDisplay* _tmp3_ = NULL; |
1595 |
GdkDeviceManager* _tmp4_ = NULL; |
1596 |
GdkDeviceManager* _tmp5_ = NULL; |
1597 |
GdkDevice* device = NULL; |
1598 |
GdkDeviceManager* _tmp6_ = NULL; |
1599 |
GList* _tmp7_ = NULL; |
1600 |
GList* _tmp8_ = NULL; |
1601 |
gconstpointer _tmp9_ = NULL; |
1602 |
GdkDevice* _tmp10_ = NULL; |
1603 |
GdkDevice* _tmp11_ = NULL; |
1604 |
GdkEvent* _tmp12_ = NULL; |
1605 |
GdkDevice* _tmp13_ = NULL; |
1606 |
gchar* emoji = NULL; |
1607 |
IBusEmojier* _tmp14_ = NULL; |
1608 |
GdkEvent* _tmp15_ = NULL; |
1609 |
gchar* _tmp16_ = NULL; |
1610 |
const gchar* _tmp17_ = NULL; |
1611 |
GtkClipboard* clipboard = NULL; |
1612 |
GtkClipboard* _tmp20_ = NULL; |
1613 |
GtkClipboard* _tmp21_ = NULL; |
1614 |
GtkClipboard* _tmp22_ = NULL; |
1615 |
const gchar* _tmp23_ = NULL; |
1616 |
GtkClipboard* _tmp24_ = NULL; |
1617 |
IBusEmojier* _tmp25_ = NULL; |
1618 |
const gchar* _tmp26_ = NULL; |
1619 |
g_return_if_fail (emojier != NULL); |
1620 |
_tmp0_ = gdk_event_new (GDK_KEY_PRESS); |
1621 |
event = _tmp0_; |
1622 |
_tmp1_ = gdk_display_get_default (); |
1623 |
_tmp2_ = _g_object_ref0 (_tmp1_); |
1624 |
display = _tmp2_; |
1625 |
_tmp3_ = display; |
1626 |
_tmp4_ = gdk_display_get_device_manager (_tmp3_); |
1627 |
_tmp5_ = _g_object_ref0 (_tmp4_); |
1628 |
device_manager = _tmp5_; |
1629 |
_tmp6_ = device_manager; |
1630 |
_tmp7_ = gdk_device_manager_list_devices (_tmp6_, GDK_DEVICE_TYPE_MASTER); |
1631 |
_tmp8_ = _tmp7_; |
1632 |
_tmp9_ = _tmp8_->data; |
1633 |
_tmp10_ = _g_object_ref0 ((GdkDevice*) _tmp9_); |
1634 |
_tmp11_ = _tmp10_; |
1635 |
_g_list_free0 (_tmp8_); |
1636 |
device = _tmp11_; |
1637 |
_tmp12_ = event; |
1638 |
_tmp13_ = device; |
1639 |
gdk_event_set_device (_tmp12_, _tmp13_); |
1640 |
_tmp14_ = emojier; |
1641 |
_tmp15_ = event; |
1642 |
_tmp16_ = ibus_emojier_run (_tmp14_, _tmp15_, ""); |
1643 |
emoji = _tmp16_; |
1644 |
_tmp17_ = emoji; |
1645 |
if (_tmp17_ == NULL) { |
1646 |
IBusEmojier* _tmp18_ = NULL; |
1647 |
const gchar* _tmp19_ = NULL; |
1648 |
_tmp18_ = emojier; |
1649 |
ibus_emojier_reset (_tmp18_); |
1650 |
_tmp19_ = _ ("Canceled to choose an emoji."); |
1651 |
g_print ("%s\n", _tmp19_); |
1652 |
_g_free0 (emoji); |
1653 |
_g_object_unref0 (device); |
1654 |
_g_object_unref0 (device_manager); |
1655 |
_g_object_unref0 (display); |
1656 |
__vala_GdkEvent_free0 (event); |
1657 |
return; |
1658 |
} |
1659 |
_tmp20_ = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD); |
1660 |
_tmp21_ = _g_object_ref0 (_tmp20_); |
1661 |
clipboard = _tmp21_; |
1662 |
_tmp22_ = clipboard; |
1663 |
_tmp23_ = emoji; |
1664 |
gtk_clipboard_set_text (_tmp22_, _tmp23_, -1); |
1665 |
_tmp24_ = clipboard; |
1666 |
gtk_clipboard_store (_tmp24_); |
1667 |
_tmp25_ = emojier; |
1668 |
ibus_emojier_reset (_tmp25_); |
1669 |
_tmp26_ = _ ("Copied an emoji to your clipboard."); |
1670 |
g_print ("%s\n", _tmp26_); |
1671 |
_g_object_unref0 (clipboard); |
1672 |
_g_free0 (emoji); |
1673 |
_g_object_unref0 (device); |
1674 |
_g_object_unref0 (device_manager); |
1675 |
_g_object_unref0 (display); |
1676 |
__vala_GdkEvent_free0 (event); |
1677 |
} |
1678 |
|
1679 |
|
1680 |
static Block1Data* block1_data_ref (Block1Data* _data1_) { |
1681 |
g_atomic_int_inc (&_data1_->_ref_count_); |
1682 |
return _data1_; |
1683 |
} |
1684 |
|
1685 |
|
1686 |
static void block1_data_unref (void * _userdata_) { |
1687 |
Block1Data* _data1_; |
1688 |
_data1_ = (Block1Data*) _userdata_; |
1689 |
if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) { |
1690 |
_g_object_unref0 (_data1_->emojier); |
1691 |
g_slice_free (Block1Data, _data1_); |
1692 |
} |
1693 |
} |
1694 |
|
1695 |
|
1696 |
static Block2Data* block2_data_ref (Block2Data* _data2_) { |
1697 |
g_atomic_int_inc (&_data2_->_ref_count_); |
1698 |
return _data2_; |
1699 |
} |
1700 |
|
1701 |
|
1702 |
static void block2_data_unref (void * _userdata_) { |
1703 |
Block2Data* _data2_; |
1704 |
_data2_ = (Block2Data*) _userdata_; |
1705 |
if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) { |
1706 |
_g_main_loop_unref0 (_data2_->loop); |
1707 |
block1_data_unref (_data2_->_data1_); |
1708 |
_data2_->_data1_ = NULL; |
1709 |
g_slice_free (Block2Data, _data2_); |
1710 |
} |
1711 |
} |
1712 |
|
1713 |
|
1714 |
static void ___lambda4_ (Block2Data* _data2_) { |
1715 |
Block1Data* _data1_; |
1716 |
IBusEmojier* _tmp0_ = NULL; |
1717 |
GMainLoop* _tmp1_ = NULL; |
1718 |
_data1_ = _data2_->_data1_; |
1719 |
_tmp0_ = _data1_->emojier; |
1720 |
run_dialog (_tmp0_); |
1721 |
_tmp1_ = _data2_->loop; |
1722 |
g_main_loop_quit (_tmp1_); |
1723 |
} |
1724 |
|
1725 |
|
1726 |
static void ____lambda4__ibus_emojier_loaded_emoji_dict (IBusEmojier* _sender, gpointer self) { |
1727 |
___lambda4_ (self); |
1728 |
} |
1729 |
|
1730 |
|
1731 |
gint emoji_dialog (gchar** argv, int argv_length1) { |
1732 |
gint result = 0; |
1733 |
Block1Data* _data1_; |
1734 |
GSettings* settings_panel = NULL; |
1735 |
GSettings* _tmp0_ = NULL; |
1736 |
gchar* emoji_font = NULL; |
1737 |
GSettings* _tmp1_ = NULL; |
1738 |
gchar* _tmp2_ = NULL; |
1739 |
IBusEmojier* _tmp3_ = NULL; |
1740 |
IBusEmojier* _tmp4_ = NULL; |
1741 |
const gchar* _tmp5_ = NULL; |
1742 |
IBusEmojier* _tmp6_ = NULL; |
1743 |
gboolean _tmp7_ = FALSE; |
1744 |
_data1_ = g_slice_new0 (Block1Data); |
1745 |
_data1_->_ref_count_ = 1; |
1746 |
gtk_init (&argv_length1, &argv); |
1747 |
_tmp0_ = g_settings_new ("org.freedesktop.ibus.panel"); |
1748 |
settings_panel = _tmp0_; |
1749 |
_tmp1_ = settings_panel; |
1750 |
_tmp2_ = g_settings_get_string (_tmp1_, "emoji-font"); |
1751 |
emoji_font = _tmp2_; |
1752 |
_tmp3_ = ibus_emojier_new (); |
1753 |
g_object_ref_sink (_tmp3_); |
1754 |
_data1_->emojier = _tmp3_; |
1755 |
_tmp4_ = _data1_->emojier; |
1756 |
_tmp5_ = emoji_font; |
1757 |
ibus_emojier_set_emoji_font (_tmp4_, _tmp5_); |
1758 |
_tmp6_ = _data1_->emojier; |
1759 |
_tmp7_ = ibus_emojier_has_loaded_emoji_dict (_tmp6_); |
1760 |
if (_tmp7_) { |
1761 |
IBusEmojier* _tmp8_ = NULL; |
1762 |
_tmp8_ = _data1_->emojier; |
1763 |
run_dialog (_tmp8_); |
1764 |
} else { |
1765 |
Block2Data* _data2_; |
1766 |
GMainLoop* _tmp9_ = NULL; |
1767 |
IBusEmojier* _tmp10_ = NULL; |
1768 |
GMainLoop* _tmp11_ = NULL; |
1769 |
_data2_ = g_slice_new0 (Block2Data); |
1770 |
_data2_->_ref_count_ = 1; |
1771 |
_data2_->_data1_ = block1_data_ref (_data1_); |
1772 |
_tmp9_ = g_main_loop_new (NULL, FALSE); |
1773 |
_data2_->loop = _tmp9_; |
1774 |
_tmp10_ = _data1_->emojier; |
1775 |
g_signal_connect_data (_tmp10_, "loaded-emoji-dict", (GCallback) ____lambda4__ibus_emojier_loaded_emoji_dict, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0); |
1776 |
_tmp11_ = _data2_->loop; |
1777 |
g_main_loop_run (_tmp11_); |
1778 |
block2_data_unref (_data2_); |
1779 |
_data2_ = NULL; |
1780 |
} |
1781 |
result = EXIT_SUCCESS; |
1782 |
_g_free0 (emoji_font); |
1783 |
_g_object_unref0 (settings_panel); |
1784 |
block1_data_unref (_data1_); |
1785 |
_data1_ = NULL; |
1786 |
return result; |
1787 |
} |
1788 |
|
1789 |
|
1790 |
gint print_help (gchar** argv, int argv_length1) { |
1791 |
gint result = 0; |
1792 |
FILE* _tmp0_ = NULL; |
1793 |
_tmp0_ = stdout; |
1794 |
print_usage (_tmp0_); |
1795 |
result = EXIT_SUCCESS; |
1796 |
return result; |
1797 |
} |
1798 |
|
1799 |
|
1800 |
CommandEntry* command_entry_dup (const CommandEntry* self) { |
1801 |
CommandEntry* dup; |
1802 |
dup = g_new0 (CommandEntry, 1); |
1803 |
memcpy (dup, self, sizeof (CommandEntry)); |
1804 |
return dup; |
1805 |
} |
1806 |
|
1807 |
|
1808 |
void command_entry_free (CommandEntry* self) { |
1809 |
g_free (self); |
1810 |
} |
1811 |
|
1812 |
|
1813 |
GType command_entry_get_type (void) { |
1814 |
static volatile gsize command_entry_type_id__volatile = 0; |
1815 |
if (g_once_init_enter (&command_entry_type_id__volatile)) { |
1816 |
GType command_entry_type_id; |
1817 |
command_entry_type_id = g_boxed_type_register_static ("CommandEntry", (GBoxedCopyFunc) command_entry_dup, (GBoxedFreeFunc) command_entry_free); |
1818 |
g_once_init_leave (&command_entry_type_id__volatile, command_entry_type_id); |
1819 |
} |
1820 |
return command_entry_type_id__volatile; |
1821 |
} |
1822 |
|
1823 |
|
1824 |
static gint _get_set_engine_entry_func (gchar** argv, int argv_length1, gpointer self) { |
1825 |
gint result; |
1826 |
result = get_set_engine (argv, argv_length1); |
1827 |
return result; |
1828 |
} |
1829 |
|
1830 |
|
1831 |
static gint _exit_daemon_entry_func (gchar** argv, int argv_length1, gpointer self) { |
1832 |
gint result; |
1833 |
result = exit_daemon (argv, argv_length1); |
1834 |
return result; |
1835 |
} |
1836 |
|
1837 |
|
1838 |
static gint _list_engine_entry_func (gchar** argv, int argv_length1, gpointer self) { |
1839 |
gint result; |
1840 |
result = list_engine (argv, argv_length1); |
1841 |
return result; |
1842 |
} |
1843 |
|
1844 |
|
1845 |
static gint _message_watch_entry_func (gchar** argv, int argv_length1, gpointer self) { |
1846 |
gint result; |
1847 |
result = message_watch (argv, argv_length1); |
1848 |
return result; |
1849 |
} |
1850 |
|
1851 |
|
1852 |
static gint _restart_daemon_entry_func (gchar** argv, int argv_length1, gpointer self) { |
1853 |
gint result; |
1854 |
result = restart_daemon (argv, argv_length1); |
1855 |
return result; |
1856 |
} |
1857 |
|
1858 |
|
1859 |
static gint _print_version_entry_func (gchar** argv, int argv_length1, gpointer self) { |
1860 |
gint result; |
1861 |
result = print_version (argv, argv_length1); |
1862 |
return result; |
1863 |
} |
1864 |
|
1865 |
|
1866 |
static gint _read_cache_entry_func (gchar** argv, int argv_length1, gpointer self) { |
1867 |
gint result; |
1868 |
result = read_cache (argv, argv_length1); |
1869 |
return result; |
1870 |
} |
1871 |
|
1872 |
|
1873 |
static gint _write_cache_entry_func (gchar** argv, int argv_length1, gpointer self) { |
1874 |
gint result; |
1875 |
result = write_cache (argv, argv_length1); |
1876 |
return result; |
1877 |
} |
1878 |
|
1879 |
|
1880 |
static gint _print_address_entry_func (gchar** argv, int argv_length1, gpointer self) { |
1881 |
gint result; |
1882 |
result = print_address (argv, argv_length1); |
1883 |
return result; |
1884 |
} |
1885 |
|
1886 |
|
1887 |
static gint _read_config_entry_func (gchar** argv, int argv_length1, gpointer self) { |
1888 |
gint result; |
1889 |
result = read_config (argv, argv_length1); |
1890 |
return result; |
1891 |
} |
1892 |
|
1893 |
|
1894 |
static gint _reset_config_entry_func (gchar** argv, int argv_length1, gpointer self) { |
1895 |
gint result; |
1896 |
result = reset_config (argv, argv_length1); |
1897 |
return result; |
1898 |
} |
1899 |
|
1900 |
|
1901 |
static gint _emoji_dialog_entry_func (gchar** argv, int argv_length1, gpointer self) { |
1902 |
gint result; |
1903 |
result = emoji_dialog (argv, argv_length1); |
1904 |
return result; |
1905 |
} |
1906 |
|
1907 |
|
1908 |
static gint _print_help_entry_func (gchar** argv, int argv_length1, gpointer self) { |
1909 |
gint result; |
1910 |
result = print_help (argv, argv_length1); |
1911 |
return result; |
1912 |
} |
1913 |
|
1914 |
|
1915 |
void print_usage (FILE* stream) { |
1916 |
FILE* _tmp0_ = NULL; |
1917 |
const gchar* _tmp1_ = NULL; |
1918 |
const gchar* _tmp2_ = NULL; |
1919 |
FILE* _tmp3_ = NULL; |
1920 |
const gchar* _tmp4_ = NULL; |
1921 |
g_return_if_fail (stream != NULL); |
1922 |
_tmp0_ = stream; |
1923 |
_tmp1_ = _ ("Usage: %s COMMAND [OPTION...]\n\n"); |
1924 |
_tmp2_ = program_name; |
1925 |
fprintf (_tmp0_, _tmp1_, _tmp2_); |
1926 |
_tmp3_ = stream; |
1927 |
_tmp4_ = _ ("Commands:\n"); |
1928 |
fprintf (_tmp3_, "%s", _tmp4_); |
1929 |
{ |
1930 |
gint i = 0; |
1931 |
i = 0; |
1932 |
{ |
1933 |
gboolean _tmp5_ = FALSE; |
1934 |
_tmp5_ = TRUE; |
1935 |
while (TRUE) { |
1936 |
gint _tmp7_ = 0; |
1937 |
FILE* _tmp8_ = NULL; |
1938 |
gint _tmp9_ = 0; |
1939 |
CommandEntry _tmp10_ = {0}; |
1940 |
const gchar* _tmp11_ = NULL; |
1941 |
gint _tmp12_ = 0; |
1942 |
CommandEntry _tmp13_ = {0}; |
1943 |
const gchar* _tmp14_ = NULL; |
1944 |
const gchar* _tmp15_ = NULL; |
1945 |
if (!_tmp5_) { |
1946 |
gint _tmp6_ = 0; |
1947 |
_tmp6_ = i; |
1948 |
i = _tmp6_ + 1; |
1949 |
} |
1950 |
_tmp5_ = FALSE; |
1951 |
_tmp7_ = i; |
1952 |
if (!(_tmp7_ < G_N_ELEMENTS (commands))) { |
1953 |
break; |
1954 |
} |
1955 |
_tmp8_ = stream; |
1956 |
_tmp9_ = i; |
1957 |
_tmp10_ = commands[_tmp9_]; |
1958 |
_tmp11_ = _tmp10_.name; |
1959 |
_tmp12_ = i; |
1960 |
_tmp13_ = commands[_tmp12_]; |
1961 |
_tmp14_ = _tmp13_.description; |
1962 |
_tmp15_ = g_dgettext (NULL, _tmp14_); |
1963 |
fprintf (_tmp8_, " %-12s %s\n", _tmp11_, _tmp15_); |
1964 |
} |
1965 |
} |
1966 |
} |
1967 |
} |
1968 |
|
1969 |
|
1970 |
static gchar** _vala_array_dup1 (gchar** self, int length) { |
1971 |
gchar** result; |
1972 |
int i; |
1973 |
result = g_new0 (gchar*, length + 1); |
1974 |
for (i = 0; i < length; i++) { |
1975 |
gchar* _tmp0_ = NULL; |
1976 |
_tmp0_ = g_strdup (self[i]); |
1977 |
result[i] = _tmp0_; |
1978 |
} |
1979 |
return result; |
1980 |
} |
1981 |
|
1982 |
|
1983 |
gint _vala_main (gchar** argv, int argv_length1) { |
1984 |
gint result = 0; |
1985 |
gchar** _tmp0_ = NULL; |
1986 |
gint _tmp0__length1 = 0; |
1987 |
const gchar* _tmp1_ = NULL; |
1988 |
gchar* _tmp2_ = NULL; |
1989 |
gchar** _tmp3_ = NULL; |
1990 |
gint _tmp3__length1 = 0; |
1991 |
gchar** new_argv = NULL; |
1992 |
gchar** _tmp5_ = NULL; |
1993 |
gint _tmp5__length1 = 0; |
1994 |
gchar** _tmp6_ = NULL; |
1995 |
gint _tmp6__length1 = 0; |
1996 |
gchar** _tmp7_ = NULL; |
1997 |
gint _tmp7__length1 = 0; |
1998 |
gint new_argv_length1 = 0; |
1999 |
gint _new_argv_size_ = 0; |
2000 |
gchar** _tmp8_ = NULL; |
2001 |
gint _tmp8__length1 = 0; |
2002 |
const gchar* _tmp9_ = NULL; |
2003 |
gchar** _tmp10_ = NULL; |
2004 |
gint _tmp10__length1 = 0; |
2005 |
const gchar* _tmp11_ = NULL; |
2006 |
gchar* _tmp12_ = NULL; |
2007 |
gchar* _tmp13_ = NULL; |
2008 |
FILE* _tmp27_ = NULL; |
2009 |
const gchar* _tmp28_ = NULL; |
2010 |
gchar** _tmp29_ = NULL; |
2011 |
gint _tmp29__length1 = 0; |
2012 |
const gchar* _tmp30_ = NULL; |
2013 |
FILE* _tmp31_ = NULL; |
2014 |
setlocale (LC_ALL, ""); |
2015 |
bindtextdomain (GETTEXT_PACKAGE, GLIB_LOCALE_DIR); |
2016 |
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); |
2017 |
textdomain (GETTEXT_PACKAGE); |
2018 |
ibus_init (); |
2019 |
_tmp0_ = argv; |
2020 |
_tmp0__length1 = argv_length1; |
2021 |
_tmp1_ = _tmp0_[0]; |
2022 |
_tmp2_ = g_path_get_basename (_tmp1_); |
2023 |
_g_free0 (program_name); |
2024 |
program_name = _tmp2_; |
2025 |
_tmp3_ = argv; |
2026 |
_tmp3__length1 = argv_length1; |
2027 |
if (_tmp3__length1 < 2) { |
2028 |
FILE* _tmp4_ = NULL; |
2029 |
_tmp4_ = stderr; |
2030 |
print_usage (_tmp4_); |
2031 |
result = EXIT_FAILURE; |
2032 |
return result; |
2033 |
} |
2034 |
_tmp5_ = argv; |
2035 |
_tmp5__length1 = argv_length1; |
2036 |
_tmp6_ = argv; |
2037 |
_tmp6__length1 = argv_length1; |
2038 |
_tmp7_ = ((_tmp5_ + 1) != NULL) ? _vala_array_dup1 (_tmp5_ + 1, _tmp6__length1 - 1) : ((gpointer) (_tmp5_ + 1)); |
2039 |
_tmp7__length1 = _tmp6__length1 - 1; |
2040 |
new_argv = _tmp7_; |
2041 |
new_argv_length1 = _tmp7__length1; |
2042 |
_new_argv_size_ = new_argv_length1; |
2043 |
_tmp8_ = new_argv; |
2044 |
_tmp8__length1 = new_argv_length1; |
2045 |
_tmp9_ = program_name; |
2046 |
_tmp10_ = new_argv; |
2047 |
_tmp10__length1 = new_argv_length1; |
2048 |
_tmp11_ = _tmp10_[0]; |
2049 |
_tmp12_ = g_strdup_printf ("%s %s", _tmp9_, _tmp11_); |
2050 |
_g_free0 (_tmp8_[0]); |
2051 |
_tmp8_[0] = _tmp12_; |
2052 |
_tmp13_ = _tmp8_[0]; |
2053 |
{ |
2054 |
gint i = 0; |
2055 |
i = 0; |
2056 |
{ |
2057 |
gboolean _tmp14_ = FALSE; |
2058 |
_tmp14_ = TRUE; |
2059 |
while (TRUE) { |
2060 |
gint _tmp16_ = 0; |
2061 |
gint _tmp17_ = 0; |
2062 |
CommandEntry _tmp18_ = {0}; |
2063 |
const gchar* _tmp19_ = NULL; |
2064 |
gchar** _tmp20_ = NULL; |
2065 |
gint _tmp20__length1 = 0; |
2066 |
const gchar* _tmp21_ = NULL; |
2067 |
if (!_tmp14_) { |
2068 |
gint _tmp15_ = 0; |
2069 |
_tmp15_ = i; |
2070 |
i = _tmp15_ + 1; |
2071 |
} |
2072 |
_tmp14_ = FALSE; |
2073 |
_tmp16_ = i; |
2074 |
if (!(_tmp16_ < G_N_ELEMENTS (commands))) { |
2075 |
break; |
2076 |
} |
2077 |
_tmp17_ = i; |
2078 |
_tmp18_ = commands[_tmp17_]; |
2079 |
_tmp19_ = _tmp18_.name; |
2080 |
_tmp20_ = argv; |
2081 |
_tmp20__length1 = argv_length1; |
2082 |
_tmp21_ = _tmp20_[1]; |
2083 |
if (g_strcmp0 (_tmp19_, _tmp21_) == 0) { |
2084 |
gint _tmp22_ = 0; |
2085 |
CommandEntry _tmp23_ = {0}; |
2086 |
EntryFunc _tmp24_ = NULL; |
2087 |
void* _tmp24__target = NULL; |
2088 |
gchar** _tmp25_ = NULL; |
2089 |
gint _tmp25__length1 = 0; |
2090 |
gint _tmp26_ = 0; |
2091 |
_tmp22_ = i; |
2092 |
_tmp23_ = commands[_tmp22_]; |
2093 |
_tmp24_ = _tmp23_.entry; |
2094 |
_tmp24__target = _tmp23_.entry_target; |
2095 |
_tmp25_ = new_argv; |
2096 |
_tmp25__length1 = new_argv_length1; |
2097 |
_tmp26_ = _tmp24_ (_tmp25_, _tmp25__length1, _tmp24__target); |
2098 |
result = _tmp26_; |
2099 |
new_argv = (_vala_array_free (new_argv, new_argv_length1, (GDestroyNotify) g_free), NULL); |
2100 |
return result; |
2101 |
} |
2102 |
} |
2103 |
} |
2104 |
} |
2105 |
_tmp27_ = stderr; |
2106 |
_tmp28_ = _ ("%s is unknown command!\n"); |
2107 |
_tmp29_ = argv; |
2108 |
_tmp29__length1 = argv_length1; |
2109 |
_tmp30_ = _tmp29_[1]; |
2110 |
fprintf (_tmp27_, _tmp28_, _tmp30_); |
2111 |
_tmp31_ = stderr; |
2112 |
print_usage (_tmp31_); |
2113 |
result = EXIT_FAILURE; |
2114 |
new_argv = (_vala_array_free (new_argv, new_argv_length1, (GDestroyNotify) g_free), NULL); |
2115 |
return result; |
2116 |
} |
2117 |
|
2118 |
|
2119 |
int main (int argc, char ** argv) { |
2120 |
#if !GLIB_CHECK_VERSION (2,35,0) |
2121 |
g_type_init (); |
2122 |
#endif |
2123 |
return _vala_main (argv, argc); |
2124 |
} |
2125 |
|
2126 |
|
2127 |
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { |
2128 |
if ((array != NULL) && (destroy_func != NULL)) { |
2129 |
int i; |
2130 |
for (i = 0; i < array_length; i = i + 1) { |
2131 |
if (((gpointer*) array)[i] != NULL) { |
2132 |
destroy_func (((gpointer*) array)[i]); |
2133 |
} |
2134 |
} |
2135 |
} |
2136 |
} |
2137 |
|
2138 |
|
2139 |
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { |
2140 |
_vala_array_destroy (array, array_length, destroy_func); |
2141 |
g_free (array); |
2142 |
} |
2143 |
|
2144 |
|
2145 |
static gint _vala_array_length (gpointer array) { |
2146 |
int length; |
2147 |
length = 0; |
2148 |
if (array) { |
2149 |
while (((gpointer*) array)[length]) { |
2150 |
length++; |
2151 |
} |
2152 |
} |
2153 |
return length; |
2154 |
} |
2155 |
|
2156 |
|
2157 |
|