| 1 |
/* main.c generated by valac 0.56.19, 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 <[email protected]> |
| 9 |
* Copyright(c) 2015-2025 Takao Fujiwara <[email protected]> |
| 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 <stdlib.h> |
| 28 |
#include <string.h> |
| 29 |
#include <glib.h> |
| 30 |
#include <glib-object.h> |
| 31 |
#include <ibus.h> |
| 32 |
#include <gobject/gvaluecollector.h> |
| 33 |
#include <stdio.h> |
| 34 |
#include <gio/gio.h> |
| 35 |
#include <ibusinternal.h> |
| 36 |
#include <unistd.h> |
| 37 |
#include <wayland-client.h> |
| 38 |
#include <glib/gi18n-lib.h> |
| 39 |
#include <config.h> |
| 40 |
#include <glib/gstdio.h> |
| 41 |
#include <ibusimmodule.h> |
| 42 |
#include <locale.h> |
| 43 |
|
| 44 |
#define IBUS_SCHEMAS_GENERAL "org.freedesktop.ibus.general" |
| 45 |
#define IBUS_SCHEMAS_GENERAL_HOTKEY "org.freedesktop.ibus.general.hotkey" |
| 46 |
#define IBUS_SCHEMAS_PANEL "org.freedesktop.ibus.panel" |
| 47 |
#define IBUS_SCHEMAS_PANEL_EMOJI "org.freedesktop.ibus.panel.emoji" |
| 48 |
#define SYSTEMD_SESSION_GNOME_FILE "org.freedesktop.IBus.session.GNOME.service" |
| 49 |
#if !defined(VALA_STRICT_C) |
| 50 |
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14) |
| 51 |
#pragma GCC diagnostic warning "-Wincompatible-pointer-types" |
| 52 |
#elif defined(__clang__) && (__clang_major__ >= 16) |
| 53 |
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types" |
| 54 |
#pragma clang diagnostic ignored "-Wincompatible-pointer-types" |
| 55 |
#endif |
| 56 |
#endif |
| 57 |
#if !defined(VALA_EXTERN) |
| 58 |
#if defined(_MSC_VER) |
| 59 |
#define VALA_EXTERN __declspec(dllexport) extern |
| 60 |
#elif __GNUC__ >= 4 |
| 61 |
#define VALA_EXTERN __attribute__((visibility("default"))) extern |
| 62 |
#else |
| 63 |
#define VALA_EXTERN extern |
| 64 |
#endif |
| 65 |
#endif |
| 66 |
|
| 67 |
#define TYPE_ENGINE_LIST (engine_list_get_type ()) |
| 68 |
#define ENGINE_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ENGINE_LIST, EngineList)) |
| 69 |
#define ENGINE_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ENGINE_LIST, EngineListClass)) |
| 70 |
#define IS_ENGINE_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ENGINE_LIST)) |
| 71 |
#define IS_ENGINE_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ENGINE_LIST)) |
| 72 |
#define ENGINE_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ENGINE_LIST, EngineListClass)) |
| 73 |
|
| 74 |
typedef struct _EngineList EngineList; |
| 75 |
typedef struct _EngineListClass EngineListClass; |
| 76 |
typedef struct _EngineListPrivate EngineListPrivate; |
| 77 |
typedef struct _ParamSpecEngineList ParamSpecEngineList; |
| 78 |
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) |
| 79 |
#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL))) |
| 80 |
typedef struct _Block1Data Block1Data; |
| 81 |
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) |
| 82 |
#define _g_variant_type_free0(var) ((var == NULL) ? NULL : (var = (g_variant_type_free (var), NULL))) |
| 83 |
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL))) |
| 84 |
#define _g_free0(var) (var = (g_free (var), NULL)) |
| 85 |
#define _wl_display_disconnect0(var) ((var == NULL) ? NULL : (var = (wl_display_disconnect (var), NULL))) |
| 86 |
typedef void (*wl_RegistryListenerGlobal) (void* data, struct wl_registry* wl_registry, guint32 name, const gchar* interface, guint32 version); |
| 87 |
typedef void (*wl_RegistryListenerGlobalRemove) (void* data, struct wl_registry* wl_registry, guint32 name); |
| 88 |
#define _wl_registry_destroy0(var) ((var == NULL) ? NULL : (var = (wl_registry_destroy (var), NULL))) |
| 89 |
#define _g_variant_builder_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_builder_unref (var), NULL))) |
| 90 |
typedef struct _Block2Data Block2Data; |
| 91 |
#define _g_source_unref0(var) ((var == NULL) ? NULL : (var = (g_source_unref (var), NULL))) |
| 92 |
#define _g_option_context_free0(var) ((var == NULL) ? NULL : (var = (g_option_context_free (var), NULL))) |
| 93 |
#define _engine_list_unref0(var) ((var == NULL) ? NULL : (var = (engine_list_unref (var), NULL))) |
| 94 |
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL))) |
| 95 |
|
| 96 |
#define TYPE_KRC_FILE (krc_file_get_type ()) |
| 97 |
#define KRC_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_KRC_FILE, KRcFile)) |
| 98 |
#define KRC_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_KRC_FILE, KRcFileClass)) |
| 99 |
#define IS_KRC_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_KRC_FILE)) |
| 100 |
#define IS_KRC_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_KRC_FILE)) |
| 101 |
#define KRC_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_KRC_FILE, KRcFileClass)) |
| 102 |
|
| 103 |
typedef struct _KRcFile KRcFile; |
| 104 |
typedef struct _KRcFileClass KRcFileClass; |
| 105 |
#define _krc_file_unref0(var) ((var == NULL) ? NULL : (var = (krc_file_unref (var), NULL))) |
| 106 |
typedef struct _Block3Data Block3Data; |
| 107 |
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL))) |
| 108 |
#define _g_settings_schema_source_unref0(var) ((var == NULL) ? NULL : (var = (g_settings_schema_source_unref (var), NULL))) |
| 109 |
#define _g_settings_schema_unref0(var) ((var == NULL) ? NULL : (var = (g_settings_schema_unref (var), NULL))) |
| 110 |
typedef gint (*EntryFunc) (gchar** argv, gint argv_length1, gpointer user_data); |
| 111 |
|
| 112 |
#define TYPE_COMMAND_ENTRY (command_entry_get_type ()) |
| 113 |
typedef struct _CommandEntry CommandEntry; |
| 114 |
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); |
| 115 |
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } |
| 116 |
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; } |
| 117 |
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); |
| 118 |
|
| 119 |
struct _EngineList { |
| 120 |
GTypeInstance parent_instance; |
| 121 |
volatile int ref_count; |
| 122 |
EngineListPrivate * priv; |
| 123 |
IBusEngineDesc** data; |
| 124 |
gint data_length1; |
| 125 |
gint _data_size_; |
| 126 |
}; |
| 127 |
|
| 128 |
struct _EngineListClass { |
| 129 |
GTypeClass parent_class; |
| 130 |
void (*finalize) (EngineList *self); |
| 131 |
}; |
| 132 |
|
| 133 |
struct _ParamSpecEngineList { |
| 134 |
GParamSpec parent_instance; |
| 135 |
}; |
| 136 |
|
| 137 |
struct _Block1Data { |
| 138 |
int _ref_count_; |
| 139 |
GDBusConnection* connection; |
| 140 |
gboolean verbose; |
| 141 |
}; |
| 142 |
|
| 143 |
struct _Block2Data { |
| 144 |
int _ref_count_; |
| 145 |
guint id; |
| 146 |
gboolean retval; |
| 147 |
GDBusConnection* connection; |
| 148 |
gboolean verbose; |
| 149 |
}; |
| 150 |
|
| 151 |
struct _Block3Data { |
| 152 |
int _ref_count_; |
| 153 |
guint id; |
| 154 |
IBusBus* bus; |
| 155 |
}; |
| 156 |
|
| 157 |
struct _CommandEntry { |
| 158 |
const gchar* name; |
| 159 |
const gchar* description; |
| 160 |
EntryFunc entry; |
| 161 |
gpointer entry_target; |
| 162 |
}; |
| 163 |
|
| 164 |
VALA_EXTERN gboolean is_wayland_session; |
| 165 |
gboolean is_wayland_session = FALSE; |
| 166 |
VALA_EXTERN gboolean name_only; |
| 167 |
gboolean name_only = FALSE; |
| 168 |
VALA_EXTERN gboolean is_system; |
| 169 |
gboolean is_system = FALSE; |
| 170 |
VALA_EXTERN gchar* cache_file; |
| 171 |
gchar* cache_file = NULL; |
| 172 |
VALA_EXTERN gchar* engine_id; |
| 173 |
gchar* engine_id = NULL; |
| 174 |
VALA_EXTERN gboolean verbose; |
| 175 |
gboolean verbose = FALSE; |
| 176 |
VALA_EXTERN gchar* daemon_type; |
| 177 |
gchar* daemon_type = NULL; |
| 178 |
VALA_EXTERN gchar* systemd_service_file; |
| 179 |
gchar* systemd_service_file = NULL; |
| 180 |
VALA_EXTERN GMainLoop* loop; |
| 181 |
GMainLoop* loop = NULL; |
| 182 |
static gpointer engine_list_parent_class = NULL; |
| 183 |
VALA_EXTERN gchar* program_name; |
| 184 |
gchar* program_name = NULL; |
| 185 |
|
| 186 |
VALA_EXTERN gpointer engine_list_ref (gpointer instance); |
| 187 |
VALA_EXTERN void engine_list_unref (gpointer instance); |
| 188 |
VALA_EXTERN GParamSpec* param_spec_engine_list (const gchar* name, |
| 189 |
const gchar* nick, |
| 190 |
const gchar* blurb, |
| 191 |
GType object_type, |
| 192 |
GParamFlags flags); |
| 193 |
VALA_EXTERN void value_set_engine_list (GValue* value, |
| 194 |
gpointer v_object); |
| 195 |
VALA_EXTERN void value_take_engine_list (GValue* value, |
| 196 |
gpointer v_object); |
| 197 |
VALA_EXTERN gpointer value_get_engine_list (const GValue* value); |
| 198 |
VALA_EXTERN GType engine_list_get_type (void) G_GNUC_CONST ; |
| 199 |
G_DEFINE_AUTOPTR_CLEANUP_FUNC (EngineList, engine_list_unref) |
| 200 |
VALA_EXTERN EngineList* engine_list_new (void); |
| 201 |
VALA_EXTERN EngineList* engine_list_construct (GType object_type); |
| 202 |
static void engine_list_finalize (EngineList * obj); |
| 203 |
static GType engine_list_get_type_once (void); |
| 204 |
VALA_EXTERN gboolean is_kde (gboolean verbose); |
| 205 |
VALA_EXTERN IBusBus* get_bus (void); |
| 206 |
VALA_EXTERN void name_appeared_handler (GDBusConnection* connection, |
| 207 |
const gchar* name, |
| 208 |
const gchar* name_owner); |
| 209 |
VALA_EXTERN void kde_virtual_keyboard_avail_cb (GDBusConnection* connection, |
| 210 |
const gchar* sender_name, |
| 211 |
const gchar* object_path, |
| 212 |
const gchar* interface_name, |
| 213 |
const gchar* signal_name, |
| 214 |
GVariant* parameters); |
| 215 |
VALA_EXTERN GDBusConnection* get_session_bus (gboolean verbose); |
| 216 |
static Block1Data* block1_data_ref (Block1Data* _data1_); |
| 217 |
static void block1_data_unref (void * _userdata_); |
| 218 |
static void _name_appeared_handler_gbus_name_appeared_callback (GDBusConnection* connection, |
| 219 |
const gchar* name, |
| 220 |
const gchar* name_owner, |
| 221 |
gpointer self); |
| 222 |
static void __lambda4_ (Block1Data* _data1_, |
| 223 |
GObject* obj, |
| 224 |
GAsyncResult* res); |
| 225 |
static void ___lambda4__gasync_ready_callback (GObject* source_object, |
| 226 |
GAsyncResult* res, |
| 227 |
gpointer self); |
| 228 |
VALA_EXTERN gchar* get_ibus_systemd_object_path (GDBusConnection* connection, |
| 229 |
gboolean verbose); |
| 230 |
VALA_EXTERN gboolean is_running_daemon_via_systemd (GDBusConnection* connection, |
| 231 |
const gchar* object_path, |
| 232 |
gboolean verbose); |
| 233 |
VALA_EXTERN void registry_global_cb (void* data, |
| 234 |
struct wl_registry* wl_registry, |
| 235 |
guint32 name, |
| 236 |
const gchar* interface, |
| 237 |
guint32 version); |
| 238 |
VALA_EXTERN void registry_global_remove_cb (void* data, |
| 239 |
struct wl_registry* wl_registry, |
| 240 |
guint32 name); |
| 241 |
VALA_EXTERN gboolean check_wayland_protocols (void); |
| 242 |
static void _registry_global_cb_wl_registrylistenerglobal (void* data, |
| 243 |
struct wl_registry* wl_registry, |
| 244 |
guint32 name, |
| 245 |
const gchar* interface, |
| 246 |
guint32 version); |
| 247 |
static void _registry_global_remove_cb_wl_registrylistenerglobalremove (void* data, |
| 248 |
struct wl_registry* wl_registry, |
| 249 |
guint32 name); |
| 250 |
VALA_EXTERN gboolean start_daemon_in_wayland (gboolean restart, |
| 251 |
gchar** _argv, |
| 252 |
gint _argv_length1); |
| 253 |
static void _vala_array_add2 (gchar** * array, |
| 254 |
gint* length, |
| 255 |
gint* size, |
| 256 |
gchar* value); |
| 257 |
static void _vala_array_add3 (gchar** * array, |
| 258 |
gint* length, |
| 259 |
gint* size, |
| 260 |
gchar* value); |
| 261 |
static void _vala_array_add4 (gchar** * array, |
| 262 |
gint* length, |
| 263 |
gint* size, |
| 264 |
gchar* value); |
| 265 |
static void _vala_array_add5 (gchar** * array, |
| 266 |
gint* length, |
| 267 |
gint* size, |
| 268 |
gchar* value); |
| 269 |
static void _vala_array_add6 (gchar** * array, |
| 270 |
gint* length, |
| 271 |
gint* size, |
| 272 |
gchar* value); |
| 273 |
VALA_EXTERN gboolean start_daemon_with_dbus_systemd (GDBusConnection* connection, |
| 274 |
gboolean restart, |
| 275 |
gboolean verbose); |
| 276 |
VALA_EXTERN gboolean operate_daemon_with_dbus_kde_real (GDBusConnection* connection, |
| 277 |
gboolean verbose); |
| 278 |
static void _kde_virtual_keyboard_avail_cb_gd_bus_signal_callback (GDBusConnection* connection, |
| 279 |
const gchar* sender_name, |
| 280 |
const gchar* object_path, |
| 281 |
const gchar* interface_name, |
| 282 |
const gchar* signal_name, |
| 283 |
GVariant* parameters, |
| 284 |
gpointer self); |
| 285 |
VALA_EXTERN gboolean operate_daemon_with_dbus_kde (GDBusConnection* connection, |
| 286 |
gboolean start, |
| 287 |
gboolean verbose); |
| 288 |
static Block2Data* block2_data_ref (Block2Data* _data2_); |
| 289 |
static void block2_data_unref (void * _userdata_); |
| 290 |
static gboolean __lambda5_ (Block2Data* _data2_); |
| 291 |
static gboolean ___lambda5__gsource_func (gpointer self); |
| 292 |
VALA_EXTERN gint list_engine (gchar** argv, |
| 293 |
gint argv_length1); |
| 294 |
static void _g_object_unref0_ (gpointer var); |
| 295 |
static inline void _g_list_free__g_object_unref0_ (GList* self); |
| 296 |
static void _g_free0_ (gpointer var); |
| 297 |
static void _engine_list_unref0_ (gpointer var); |
| 298 |
static void _vala_array_add7 (IBusEngineDesc** * array, |
| 299 |
gint* length, |
| 300 |
gint* size, |
| 301 |
IBusEngineDesc* value); |
| 302 |
VALA_EXTERN gint exec_setxkbmap (IBusEngineDesc* engine); |
| 303 |
static void _vala_array_add8 (gchar** * array, |
| 304 |
gint* length, |
| 305 |
gint* size, |
| 306 |
gchar* value); |
| 307 |
static void _vala_array_add9 (gchar** * array, |
| 308 |
gint* length, |
| 309 |
gint* size, |
| 310 |
gchar* value); |
| 311 |
static void _vala_array_add10 (gchar** * array, |
| 312 |
gint* length, |
| 313 |
gint* size, |
| 314 |
gchar* value); |
| 315 |
static void _vala_array_add11 (gchar** * array, |
| 316 |
gint* length, |
| 317 |
gint* size, |
| 318 |
gchar* value); |
| 319 |
static void _vala_array_add12 (gchar** * array, |
| 320 |
gint* length, |
| 321 |
gint* size, |
| 322 |
gchar* value); |
| 323 |
static void _vala_array_add13 (gchar** * array, |
| 324 |
gint* length, |
| 325 |
gint* size, |
| 326 |
gchar* value); |
| 327 |
static void _vala_array_add14 (gchar** * array, |
| 328 |
gint* length, |
| 329 |
gint* size, |
| 330 |
gchar* value); |
| 331 |
VALA_EXTERN gint get_set_engine (gchar** argv, |
| 332 |
gint argv_length1); |
| 333 |
VALA_EXTERN gint message_watch (gchar** argv, |
| 334 |
gint argv_length1); |
| 335 |
VALA_EXTERN gboolean operate_daemon_in_kde_wayland (GDBusConnection* connection, |
| 336 |
gboolean start, |
| 337 |
gboolean verbose); |
| 338 |
VALA_EXTERN gpointer krc_file_ref (gpointer instance); |
| 339 |
VALA_EXTERN void krc_file_unref (gpointer instance); |
| 340 |
VALA_EXTERN GParamSpec* param_spec_krc_file (const gchar* name, |
| 341 |
const gchar* nick, |
| 342 |
const gchar* blurb, |
| 343 |
GType object_type, |
| 344 |
GParamFlags flags); |
| 345 |
VALA_EXTERN void value_set_krc_file (GValue* value, |
| 346 |
gpointer v_object); |
| 347 |
VALA_EXTERN void value_take_krc_file (GValue* value, |
| 348 |
gpointer v_object); |
| 349 |
VALA_EXTERN gpointer value_get_krc_file (const GValue* value); |
| 350 |
VALA_EXTERN GType krc_file_get_type (void) G_GNUC_CONST ; |
| 351 |
G_DEFINE_AUTOPTR_CLEANUP_FUNC (KRcFile, krc_file_unref) |
| 352 |
VALA_EXTERN KRcFile* krc_file_new (void); |
| 353 |
VALA_EXTERN KRcFile* krc_file_construct (GType object_type); |
| 354 |
VALA_EXTERN gboolean krc_file_load_from_file (KRcFile* self, |
| 355 |
const gchar* path, |
| 356 |
GKeyFileFlags flags, |
| 357 |
GError** error); |
| 358 |
VALA_EXTERN gboolean krc_file_has_group (KRcFile* self, |
| 359 |
const gchar* group_name); |
| 360 |
VALA_EXTERN gboolean krc_file_has_key (KRcFile* self, |
| 361 |
const gchar* group_name, |
| 362 |
const gchar* key, |
| 363 |
GError** error); |
| 364 |
VALA_EXTERN gchar* krc_file_get_value (KRcFile* self, |
| 365 |
const gchar* group_name, |
| 366 |
const gchar* key, |
| 367 |
GError** error); |
| 368 |
VALA_EXTERN void krc_file_set_value (KRcFile* self, |
| 369 |
const gchar* group_name, |
| 370 |
const gchar* key, |
| 371 |
const gchar* value); |
| 372 |
VALA_EXTERN gboolean krc_file_save_to_file (KRcFile* self, |
| 373 |
const gchar* filename, |
| 374 |
GError** error); |
| 375 |
VALA_EXTERN gchar** krc_file_get_keys (KRcFile* self, |
| 376 |
const gchar* group_name, |
| 377 |
gint* result_length1, |
| 378 |
GError** error); |
| 379 |
VALA_EXTERN gboolean krc_file_remove_group (KRcFile* self, |
| 380 |
const gchar* group_name, |
| 381 |
GError** error); |
| 382 |
VALA_EXTERN gboolean krc_file_remove_key (KRcFile* self, |
| 383 |
const gchar* group_name, |
| 384 |
const gchar* key, |
| 385 |
GError** error); |
| 386 |
VALA_EXTERN gboolean start_daemon_with_systemd (gboolean restart, |
| 387 |
gboolean verbose); |
| 388 |
VALA_EXTERN gint start_daemon_real (gchar** argv, |
| 389 |
gint argv_length1, |
| 390 |
gboolean restart); |
| 391 |
VALA_EXTERN gint restart_daemon (gchar** argv, |
| 392 |
gint argv_length1); |
| 393 |
VALA_EXTERN gint start_daemon (gchar** argv, |
| 394 |
gint argv_length1); |
| 395 |
VALA_EXTERN gboolean exit_daemon_with_systemd (IBusBus* bus, |
| 396 |
gboolean verbose); |
| 397 |
static Block3Data* block3_data_ref (Block3Data* _data3_); |
| 398 |
static void block3_data_unref (void * _userdata_); |
| 399 |
static gboolean __lambda6_ (Block3Data* _data3_); |
| 400 |
static gboolean ___lambda6__gsource_func (gpointer self); |
| 401 |
VALA_EXTERN gint exit_daemon (gchar** argv, |
| 402 |
gint argv_length1); |
| 403 |
VALA_EXTERN gint print_version (gchar** argv, |
| 404 |
gint argv_length1); |
| 405 |
VALA_EXTERN gint read_cache (gchar** argv, |
| 406 |
gint argv_length1); |
| 407 |
VALA_EXTERN gint write_cache (gchar** argv, |
| 408 |
gint argv_length1); |
| 409 |
VALA_EXTERN gint print_address (gchar** argv, |
| 410 |
gint argv_length1); |
| 411 |
VALA_EXTERN gint read_config_options (gchar** argv, |
| 412 |
gint argv_length1); |
| 413 |
VALA_EXTERN GSList* get_ibus_schemas (void); |
| 414 |
VALA_EXTERN gint read_config (gchar** argv, |
| 415 |
gint argv_length1); |
| 416 |
static inline void _g_slist_free__g_free0_ (GSList* self); |
| 417 |
VALA_EXTERN gint reset_config (gchar** argv, |
| 418 |
gint argv_length1); |
| 419 |
VALA_EXTERN gint emoji_dialog (gchar** argv, |
| 420 |
gint argv_length1); |
| 421 |
VALA_EXTERN gint read_im_module (gchar** argv, |
| 422 |
gint argv_length1); |
| 423 |
VALA_EXTERN gint print_help (gchar** argv, |
| 424 |
gint argv_length1); |
| 425 |
VALA_EXTERN void print_usage (FILE* stream); |
| 426 |
VALA_EXTERN GType command_entry_get_type (void) G_GNUC_CONST ; |
| 427 |
VALA_EXTERN CommandEntry* command_entry_dup (const CommandEntry* self); |
| 428 |
VALA_EXTERN void command_entry_free (CommandEntry* self); |
| 429 |
static gint _get_set_engine_entry_func (gchar** argv, |
| 430 |
gint argv_length1, |
| 431 |
gpointer self); |
| 432 |
static gint _exit_daemon_entry_func (gchar** argv, |
| 433 |
gint argv_length1, |
| 434 |
gpointer self); |
| 435 |
static gint _list_engine_entry_func (gchar** argv, |
| 436 |
gint argv_length1, |
| 437 |
gpointer self); |
| 438 |
static gint _message_watch_entry_func (gchar** argv, |
| 439 |
gint argv_length1, |
| 440 |
gpointer self); |
| 441 |
static gint _restart_daemon_entry_func (gchar** argv, |
| 442 |
gint argv_length1, |
| 443 |
gpointer self); |
| 444 |
static gint _start_daemon_entry_func (gchar** argv, |
| 445 |
gint argv_length1, |
| 446 |
gpointer self); |
| 447 |
static gint _print_version_entry_func (gchar** argv, |
| 448 |
gint argv_length1, |
| 449 |
gpointer self); |
| 450 |
static gint _read_cache_entry_func (gchar** argv, |
| 451 |
gint argv_length1, |
| 452 |
gpointer self); |
| 453 |
static gint _write_cache_entry_func (gchar** argv, |
| 454 |
gint argv_length1, |
| 455 |
gpointer self); |
| 456 |
static gint _print_address_entry_func (gchar** argv, |
| 457 |
gint argv_length1, |
| 458 |
gpointer self); |
| 459 |
static gint _read_config_entry_func (gchar** argv, |
| 460 |
gint argv_length1, |
| 461 |
gpointer self); |
| 462 |
static gint _reset_config_entry_func (gchar** argv, |
| 463 |
gint argv_length1, |
| 464 |
gpointer self); |
| 465 |
static gint _emoji_dialog_entry_func (gchar** argv, |
| 466 |
gint argv_length1, |
| 467 |
gpointer self); |
| 468 |
static gint _read_im_module_entry_func (gchar** argv, |
| 469 |
gint argv_length1, |
| 470 |
gpointer self); |
| 471 |
static gint _print_help_entry_func (gchar** argv, |
| 472 |
gint argv_length1, |
| 473 |
gpointer self); |
| 474 |
static gint _vala_main (gchar** argv, |
| 475 |
gint argv_length1); |
| 476 |
static gchar** _vala_array_dup1 (gchar** self, |
| 477 |
gssize length); |
| 478 |
static void _vala_array_destroy (gpointer array, |
| 479 |
gssize array_length, |
| 480 |
GDestroyNotify destroy_func); |
| 481 |
static void _vala_array_free (gpointer array, |
| 482 |
gssize array_length, |
| 483 |
GDestroyNotify destroy_func); |
| 484 |
static gssize _vala_array_length (gpointer array); |
| 485 |
|
| 486 |
const CommandEntry commands[15] = {{"engine", N_ ("Set or get engine"), _get_set_engine_entry_func}, {"exit", N_ ("Exit ibus-daemon"), _exit_daemon_entry_func}, {"list-engine", N_ ("Show available engines"), _list_engine_entry_func}, {"watch", N_ ("(Not implemented)"), _message_watch_entry_func}, {"restart", N_ ("Restart ibus-daemon"), _restart_daemon_entry_func}, {"start", N_ ("Start ibus-daemon"), _start_daemon_entry_func}, {"version", N_ ("Show version"), _print_version_entry_func}, {"read-cache", N_ ("Show the content of registry cache"), _read_cache_entry_func}, {"write-cache", N_ ("Create registry cache"), _write_cache_entry_func}, {"address", N_ ("Print the D-Bus address of ibus-daemon"), _print_address_entry_func}, {"read-config", N_ ("Show the configuration values"), _read_config_entry_func}, {"reset-config", N_ ("Reset the configuration values"), _reset_config_entry_func}, {"emoji", N_ ("Save emoji on dialog to clipboard"), _emoji_dialog_entry_func}, {"im-module", N_ ("Retrieve im-module value from GTK instance"), _read_im_module_entry_func}, {"help", N_ ("Show this information"), _print_help_entry_func}}; |
| 487 |
|
| 488 |
EngineList* |
| 489 |
engine_list_construct (GType object_type) |
| 490 |
{ |
| 491 |
EngineList* self = NULL; |
| 492 |
self = (EngineList*) g_type_create_instance (object_type); |
| 493 |
return self; |
| 494 |
} |
| 495 |
|
| 496 |
EngineList* |
| 497 |
engine_list_new (void) |
| 498 |
{ |
| 499 |
return engine_list_construct (TYPE_ENGINE_LIST); |
| 500 |
} |
| 501 |
|
| 502 |
static void |
| 503 |
value_engine_list_init (GValue* value) |
| 504 |
{ |
| 505 |
value->data[0].v_pointer = NULL; |
| 506 |
} |
| 507 |
|
| 508 |
static void |
| 509 |
value_engine_list_free_value (GValue* value) |
| 510 |
{ |
| 511 |
if (value->data[0].v_pointer) { |
| 512 |
engine_list_unref (value->data[0].v_pointer); |
| 513 |
} |
| 514 |
} |
| 515 |
|
| 516 |
static void |
| 517 |
value_engine_list_copy_value (const GValue* src_value, |
| 518 |
GValue* dest_value) |
| 519 |
{ |
| 520 |
if (src_value->data[0].v_pointer) { |
| 521 |
dest_value->data[0].v_pointer = engine_list_ref (src_value->data[0].v_pointer); |
| 522 |
} else { |
| 523 |
dest_value->data[0].v_pointer = NULL; |
| 524 |
} |
| 525 |
} |
| 526 |
|
| 527 |
static gpointer |
| 528 |
value_engine_list_peek_pointer (const GValue* value) |
| 529 |
{ |
| 530 |
return value->data[0].v_pointer; |
| 531 |
} |
| 532 |
|
| 533 |
static gchar* |
| 534 |
value_engine_list_collect_value (GValue* value, |
| 535 |
guint n_collect_values, |
| 536 |
GTypeCValue* collect_values, |
| 537 |
guint collect_flags) |
| 538 |
{ |
| 539 |
if (collect_values[0].v_pointer) { |
| 540 |
EngineList * object; |
| 541 |
object = collect_values[0].v_pointer; |
| 542 |
if (object->parent_instance.g_class == NULL) { |
| 543 |
return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); |
| 544 |
} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { |
| 545 |
return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); |
| 546 |
} |
| 547 |
value->data[0].v_pointer = engine_list_ref (object); |
| 548 |
} else { |
| 549 |
value->data[0].v_pointer = NULL; |
| 550 |
} |
| 551 |
return NULL; |
| 552 |
} |
| 553 |
|
| 554 |
static gchar* |
| 555 |
value_engine_list_lcopy_value (const GValue* value, |
| 556 |
guint n_collect_values, |
| 557 |
GTypeCValue* collect_values, |
| 558 |
guint collect_flags) |
| 559 |
{ |
| 560 |
EngineList ** object_p; |
| 561 |
object_p = collect_values[0].v_pointer; |
| 562 |
if (!object_p) { |
| 563 |
return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); |
| 564 |
} |
| 565 |
if (!value->data[0].v_pointer) { |
| 566 |
*object_p = NULL; |
| 567 |
} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) { |
| 568 |
*object_p = value->data[0].v_pointer; |
| 569 |
} else { |
| 570 |
*object_p = engine_list_ref (value->data[0].v_pointer); |
| 571 |
} |
| 572 |
return NULL; |
| 573 |
} |
| 574 |
|
| 575 |
GParamSpec* |
| 576 |
param_spec_engine_list (const gchar* name, |
| 577 |
const gchar* nick, |
| 578 |
const gchar* blurb, |
| 579 |
GType object_type, |
| 580 |
GParamFlags flags) |
| 581 |
{ |
| 582 |
ParamSpecEngineList* spec; |
| 583 |
g_return_val_if_fail (g_type_is_a (object_type, TYPE_ENGINE_LIST), NULL); |
| 584 |
spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); |
| 585 |
G_PARAM_SPEC (spec)->value_type = object_type; |
| 586 |
return G_PARAM_SPEC (spec); |
| 587 |
} |
| 588 |
|
| 589 |
gpointer |
| 590 |
value_get_engine_list (const GValue* value) |
| 591 |
{ |
| 592 |
g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_ENGINE_LIST), NULL); |
| 593 |
return value->data[0].v_pointer; |
| 594 |
} |
| 595 |
|
| 596 |
void |
| 597 |
value_set_engine_list (GValue* value, |
| 598 |
gpointer v_object) |
| 599 |
{ |
| 600 |
EngineList * old; |
| 601 |
g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_ENGINE_LIST)); |
| 602 |
old = value->data[0].v_pointer; |
| 603 |
if (v_object) { |
| 604 |
g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_ENGINE_LIST)); |
| 605 |
g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); |
| 606 |
value->data[0].v_pointer = v_object; |
| 607 |
engine_list_ref (value->data[0].v_pointer); |
| 608 |
} else { |
| 609 |
value->data[0].v_pointer = NULL; |
| 610 |
} |
| 611 |
if (old) { |
| 612 |
engine_list_unref (old); |
| 613 |
} |
| 614 |
} |
| 615 |
|
| 616 |
void |
| 617 |
value_take_engine_list (GValue* value, |
| 618 |
gpointer v_object) |
| 619 |
{ |
| 620 |
EngineList * old; |
| 621 |
g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_ENGINE_LIST)); |
| 622 |
old = value->data[0].v_pointer; |
| 623 |
if (v_object) { |
| 624 |
g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_ENGINE_LIST)); |
| 625 |
g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); |
| 626 |
value->data[0].v_pointer = v_object; |
| 627 |
} else { |
| 628 |
value->data[0].v_pointer = NULL; |
| 629 |
} |
| 630 |
if (old) { |
| 631 |
engine_list_unref (old); |
| 632 |
} |
| 633 |
} |
| 634 |
|
| 635 |
static void |
| 636 |
engine_list_class_init (EngineListClass * klass, |
| 637 |
gpointer klass_data) |
| 638 |
{ |
| 639 |
engine_list_parent_class = g_type_class_peek_parent (klass); |
| 640 |
((EngineListClass *) klass)->finalize = engine_list_finalize; |
| 641 |
} |
| 642 |
|
| 643 |
static void |
| 644 |
engine_list_instance_init (EngineList * self, |
| 645 |
gpointer klass) |
| 646 |
{ |
| 647 |
IBusEngineDesc** _tmp0_; |
| 648 |
_tmp0_ = g_new0 (IBusEngineDesc*, 0 + 1); |
| 649 |
self->data = _tmp0_; |
| 650 |
self->data_length1 = 0; |
| 651 |
self->_data_size_ = self->data_length1; |
| 652 |
self->ref_count = 1; |
| 653 |
} |
| 654 |
|
| 655 |
static void |
| 656 |
engine_list_finalize (EngineList * obj) |
| 657 |
{ |
| 658 |
EngineList * self; |
| 659 |
self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_ENGINE_LIST, EngineList); |
| 660 |
g_signal_handlers_destroy (self); |
| 661 |
self->data = (_vala_array_free (self->data, self->data_length1, (GDestroyNotify) g_object_unref), NULL); |
| 662 |
} |
| 663 |
|
| 664 |
static GType |
| 665 |
engine_list_get_type_once (void) |
| 666 |
{ |
| 667 |
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 }; |
| 668 |
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 }; |
| 669 |
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) }; |
| 670 |
GType engine_list_type_id; |
| 671 |
engine_list_type_id = g_type_register_fundamental (g_type_fundamental_next (), "EngineList", &g_define_type_info, &g_define_type_fundamental_info, 0); |
| 672 |
return engine_list_type_id; |
| 673 |
} |
| 674 |
|
| 675 |
GType |
| 676 |
engine_list_get_type (void) |
| 677 |
{ |
| 678 |
static volatile gsize engine_list_type_id__once = 0; |
| 679 |
if (g_once_init_enter (&engine_list_type_id__once)) { |
| 680 |
GType engine_list_type_id; |
| 681 |
engine_list_type_id = engine_list_get_type_once (); |
| 682 |
g_once_init_leave (&engine_list_type_id__once, engine_list_type_id); |
| 683 |
} |
| 684 |
return engine_list_type_id__once; |
| 685 |
} |
| 686 |
|
| 687 |
gpointer |
| 688 |
engine_list_ref (gpointer instance) |
| 689 |
{ |
| 690 |
EngineList * self; |
| 691 |
self = instance; |
| 692 |
g_atomic_int_inc (&self->ref_count); |
| 693 |
return instance; |
| 694 |
} |
| 695 |
|
| 696 |
void |
| 697 |
engine_list_unref (gpointer instance) |
| 698 |
{ |
| 699 |
EngineList * self; |
| 700 |
self = instance; |
| 701 |
if (g_atomic_int_dec_and_test (&self->ref_count)) { |
| 702 |
ENGINE_LIST_GET_CLASS (self)->finalize (self); |
| 703 |
g_type_free_instance ((GTypeInstance *) self); |
| 704 |
} |
| 705 |
} |
| 706 |
|
| 707 |
gboolean |
| 708 |
is_kde (gboolean verbose) |
| 709 |
{ |
| 710 |
const gchar* desktop = NULL; |
| 711 |
const gchar* _tmp0_; |
| 712 |
const gchar* _tmp1_; |
| 713 |
gboolean _tmp2_ = FALSE; |
| 714 |
const gchar* _tmp3_; |
| 715 |
gboolean _tmp6_ = FALSE; |
| 716 |
const gchar* _tmp7_; |
| 717 |
const gchar* _tmp9_; |
| 718 |
gboolean result; |
| 719 |
_tmp0_ = g_getenv ("XDG_CURRENT_DESKTOP"); |
| 720 |
desktop = _tmp0_; |
| 721 |
_tmp1_ = desktop; |
| 722 |
if (g_strcmp0 (_tmp1_, "KDE") == 0) { |
| 723 |
result = TRUE; |
| 724 |
return result; |
| 725 |
} |
| 726 |
_tmp3_ = desktop; |
| 727 |
if (_tmp3_ == NULL) { |
| 728 |
_tmp2_ = TRUE; |
| 729 |
} else { |
| 730 |
const gchar* _tmp4_; |
| 731 |
_tmp4_ = desktop; |
| 732 |
_tmp2_ = g_strcmp0 (_tmp4_, "(null)") == 0; |
| 733 |
} |
| 734 |
if (_tmp2_) { |
| 735 |
const gchar* _tmp5_; |
| 736 |
_tmp5_ = g_getenv ("XDG_SESSION_DESKTOP"); |
| 737 |
desktop = _tmp5_; |
| 738 |
} |
| 739 |
_tmp7_ = desktop; |
| 740 |
if (g_strcmp0 (_tmp7_, "plasma") == 0) { |
| 741 |
_tmp6_ = TRUE; |
| 742 |
} else { |
| 743 |
const gchar* _tmp8_; |
| 744 |
_tmp8_ = desktop; |
| 745 |
_tmp6_ = g_strcmp0 (_tmp8_, "KDE-wayland") == 0; |
| 746 |
} |
| 747 |
if (_tmp6_) { |
| 748 |
result = TRUE; |
| 749 |
return result; |
| 750 |
} |
| 751 |
_tmp9_ = desktop; |
| 752 |
if (_tmp9_ == NULL) { |
| 753 |
if (verbose) { |
| 754 |
FILE* _tmp10_; |
| 755 |
_tmp10_ = stderr; |
| 756 |
fprintf (_tmp10_, "%s", "XDG_CURRENT_DESKTOP is not exported in your " "desktop session.\n"); |
| 757 |
} |
| 758 |
} else { |
| 759 |
if (verbose) { |
| 760 |
FILE* _tmp11_; |
| 761 |
const gchar* _tmp12_; |
| 762 |
_tmp11_ = stderr; |
| 763 |
_tmp12_ = desktop; |
| 764 |
fprintf (_tmp11_, "Your desktop session \"%s\" is not KDE\n.", _tmp12_); |
| 765 |
} |
| 766 |
} |
| 767 |
result = FALSE; |
| 768 |
return result; |
| 769 |
} |
| 770 |
|
| 771 |
IBusBus* |
| 772 |
get_bus (void) |
| 773 |
{ |
| 774 |
IBusBus* bus = NULL; |
| 775 |
IBusBus* _tmp0_; |
| 776 |
IBusBus* _tmp1_; |
| 777 |
IBusBus* result; |
| 778 |
_tmp0_ = ibus_bus_new (); |
| 779 |
g_object_ref_sink (_tmp0_); |
| 780 |
bus = _tmp0_; |
| 781 |
_tmp1_ = bus; |
| 782 |
if (!ibus_bus_is_connected (_tmp1_)) { |
| 783 |
result = NULL; |
| 784 |
_g_object_unref0 (bus); |
| 785 |
return result; |
| 786 |
} |
| 787 |
result = bus; |
| 788 |
return result; |
| 789 |
} |
| 790 |
|
| 791 |
void |
| 792 |
name_appeared_handler (GDBusConnection* connection, |
| 793 |
const gchar* name, |
| 794 |
const gchar* name_owner) |
| 795 |
{ |
| 796 |
GMainLoop* _tmp1_; |
| 797 |
g_return_if_fail (connection != NULL); |
| 798 |
g_return_if_fail (name != NULL); |
| 799 |
g_return_if_fail (name_owner != NULL); |
| 800 |
if (verbose) { |
| 801 |
FILE* _tmp0_; |
| 802 |
_tmp0_ = stderr; |
| 803 |
fprintf (_tmp0_, "NameAquired %s:%s\n", name, name_owner); |
| 804 |
} |
| 805 |
_tmp1_ = loop; |
| 806 |
g_main_loop_quit (_tmp1_); |
| 807 |
_g_main_loop_unref0 (loop); |
| 808 |
loop = NULL; |
| 809 |
} |
| 810 |
|
| 811 |
void |
| 812 |
kde_virtual_keyboard_avail_cb (GDBusConnection* connection, |
| 813 |
const gchar* sender_name, |
| 814 |
const gchar* object_path, |
| 815 |
const gchar* interface_name, |
| 816 |
const gchar* signal_name, |
| 817 |
GVariant* parameters) |
| 818 |
{ |
| 819 |
GMainLoop* _tmp1_; |
| 820 |
g_return_if_fail (connection != NULL); |
| 821 |
g_return_if_fail (object_path != NULL); |
| 822 |
g_return_if_fail (interface_name != NULL); |
| 823 |
g_return_if_fail (signal_name != NULL); |
| 824 |
g_return_if_fail (parameters != NULL); |
| 825 |
if (verbose) { |
| 826 |
FILE* _tmp0_; |
| 827 |
_tmp0_ = stderr; |
| 828 |
fprintf (_tmp0_, "%s.%s %s returned.\n", interface_name, signal_name, object_path); |
| 829 |
} |
| 830 |
_tmp1_ = loop; |
| 831 |
g_main_loop_quit (_tmp1_); |
| 832 |
_g_main_loop_unref0 (loop); |
| 833 |
loop = NULL; |
| 834 |
} |
| 835 |
|
| 836 |
static Block1Data* |
| 837 |
block1_data_ref (Block1Data* _data1_) |
| 838 |
{ |
| 839 |
g_atomic_int_inc (&_data1_->_ref_count_); |
| 840 |
return _data1_; |
| 841 |
} |
| 842 |
|
| 843 |
static void |
| 844 |
block1_data_unref (void * _userdata_) |
| 845 |
{ |
| 846 |
Block1Data* _data1_; |
| 847 |
_data1_ = (Block1Data*) _userdata_; |
| 848 |
if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) { |
| 849 |
_g_object_unref0 (_data1_->connection); |
| 850 |
g_slice_free (Block1Data, _data1_); |
| 851 |
} |
| 852 |
} |
| 853 |
|
| 854 |
static void |
| 855 |
_name_appeared_handler_gbus_name_appeared_callback (GDBusConnection* connection, |
| 856 |
const gchar* name, |
| 857 |
const gchar* name_owner, |
| 858 |
gpointer self) |
| 859 |
{ |
| 860 |
name_appeared_handler (connection, name, name_owner); |
| 861 |
} |
| 862 |
|
| 863 |
static void |
| 864 |
__lambda4_ (Block1Data* _data1_, |
| 865 |
GObject* obj, |
| 866 |
GAsyncResult* res) |
| 867 |
{ |
| 868 |
GError* _inner_error0_ = NULL; |
| 869 |
g_return_if_fail (res != NULL); |
| 870 |
{ |
| 871 |
GDBusConnection* _tmp0_ = NULL; |
| 872 |
GDBusConnection* _tmp1_; |
| 873 |
GDBusConnection* _tmp2_; |
| 874 |
_tmp1_ = g_bus_get_finish (res, &_inner_error0_); |
| 875 |
_tmp0_ = _tmp1_; |
| 876 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 877 |
if (_inner_error0_->domain == G_IO_ERROR) { |
| 878 |
goto __catch0_g_io_error; |
| 879 |
} |
| 880 |
g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 881 |
g_clear_error (&_inner_error0_); |
| 882 |
return; |
| 883 |
} |
| 884 |
_tmp2_ = _tmp0_; |
| 885 |
_tmp0_ = NULL; |
| 886 |
_g_object_unref0 (_data1_->connection); |
| 887 |
_data1_->connection = _tmp2_; |
| 888 |
if (_data1_->verbose) { |
| 889 |
FILE* _tmp3_; |
| 890 |
_tmp3_ = stderr; |
| 891 |
fprintf (_tmp3_, "The session bus is generated.\n"); |
| 892 |
} |
| 893 |
_g_object_unref0 (_tmp0_); |
| 894 |
} |
| 895 |
goto __finally0; |
| 896 |
__catch0_g_io_error: |
| 897 |
{ |
| 898 |
GError* e = NULL; |
| 899 |
GMainLoop* _tmp7_; |
| 900 |
e = _inner_error0_; |
| 901 |
_inner_error0_ = NULL; |
| 902 |
if (_data1_->verbose) { |
| 903 |
FILE* _tmp4_; |
| 904 |
GError* _tmp5_; |
| 905 |
const gchar* _tmp6_; |
| 906 |
_tmp4_ = stderr; |
| 907 |
_tmp5_ = e; |
| 908 |
_tmp6_ = _tmp5_->message; |
| 909 |
fprintf (_tmp4_, "The session bus error: %s\n", _tmp6_); |
| 910 |
} |
| 911 |
_tmp7_ = loop; |
| 912 |
if (_tmp7_ != NULL) { |
| 913 |
GMainLoop* _tmp8_; |
| 914 |
_tmp8_ = loop; |
| 915 |
g_main_loop_quit (_tmp8_); |
| 916 |
_g_main_loop_unref0 (loop); |
| 917 |
loop = NULL; |
| 918 |
} |
| 919 |
_g_error_free0 (e); |
| 920 |
} |
| 921 |
__finally0: |
| 922 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 923 |
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 924 |
g_clear_error (&_inner_error0_); |
| 925 |
return; |
| 926 |
} |
| 927 |
} |
| 928 |
|
| 929 |
static void |
| 930 |
___lambda4__gasync_ready_callback (GObject* source_object, |
| 931 |
GAsyncResult* res, |
| 932 |
gpointer self) |
| 933 |
{ |
| 934 |
__lambda4_ (self, source_object, res); |
| 935 |
block1_data_unref (self); |
| 936 |
} |
| 937 |
|
| 938 |
static gpointer |
| 939 |
_g_object_ref0 (gpointer self) |
| 940 |
{ |
| 941 |
return self ? g_object_ref (self) : NULL; |
| 942 |
} |
| 943 |
|
| 944 |
GDBusConnection* |
| 945 |
get_session_bus (gboolean verbose) |
| 946 |
{ |
| 947 |
Block1Data* _data1_; |
| 948 |
GMainLoop* _tmp0_; |
| 949 |
GMainLoop* _tmp1_; |
| 950 |
GMainLoop* _tmp2_; |
| 951 |
GDBusConnection* _tmp3_; |
| 952 |
GDBusConnection* _tmp5_; |
| 953 |
GDBusConnection* _tmp6_; |
| 954 |
GDBusConnection* result; |
| 955 |
_data1_ = g_slice_new0 (Block1Data); |
| 956 |
_data1_->_ref_count_ = 1; |
| 957 |
_data1_->verbose = verbose; |
| 958 |
_tmp0_ = g_main_loop_new (NULL, FALSE); |
| 959 |
_g_main_loop_unref0 (loop); |
| 960 |
loop = _tmp0_; |
| 961 |
_tmp1_ = loop; |
| 962 |
_vala_assert (_tmp1_ != NULL, "loop != null"); |
| 963 |
g_bus_watch_name_with_closures (G_BUS_TYPE_SESSION, DBUS_SERVICE_DBUS, G_BUS_NAME_WATCHER_FLAGS_NONE, (GClosure*) g_cclosure_new ((GCallback) _name_appeared_handler_gbus_name_appeared_callback, NULL, (GClosureNotify) NULL), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL))); |
| 964 |
_data1_->connection = NULL; |
| 965 |
g_bus_get (G_BUS_TYPE_SESSION, NULL, ___lambda4__gasync_ready_callback, block1_data_ref (_data1_)); |
| 966 |
_tmp2_ = loop; |
| 967 |
g_main_loop_run (_tmp2_); |
| 968 |
_tmp3_ = _data1_->connection; |
| 969 |
if (g_dbus_connection_is_closed (_tmp3_)) { |
| 970 |
if (_data1_->verbose) { |
| 971 |
FILE* _tmp4_; |
| 972 |
_tmp4_ = stderr; |
| 973 |
fprintf (_tmp4_, "The session bus is closed.\n"); |
| 974 |
} |
| 975 |
result = NULL; |
| 976 |
block1_data_unref (_data1_); |
| 977 |
_data1_ = NULL; |
| 978 |
return result; |
| 979 |
} |
| 980 |
_tmp5_ = _data1_->connection; |
| 981 |
_tmp6_ = _g_object_ref0 (_tmp5_); |
| 982 |
result = _tmp6_; |
| 983 |
block1_data_unref (_data1_); |
| 984 |
_data1_ = NULL; |
| 985 |
return result; |
| 986 |
} |
| 987 |
|
| 988 |
gchar* |
| 989 |
get_ibus_systemd_object_path (GDBusConnection* connection, |
| 990 |
gboolean verbose) |
| 991 |
{ |
| 992 |
gchar* object_path = NULL; |
| 993 |
const gchar* _tmp0_; |
| 994 |
GError* _inner_error0_ = NULL; |
| 995 |
gchar* result; |
| 996 |
g_return_val_if_fail (connection != NULL, NULL); |
| 997 |
object_path = NULL; |
| 998 |
_tmp0_ = systemd_service_file; |
| 999 |
_vala_assert (_tmp0_ != NULL, "systemd_service_file != null"); |
| 1000 |
{ |
| 1001 |
GVariant* variant = NULL; |
| 1002 |
const gchar* _tmp1_; |
| 1003 |
GVariant* _tmp2_; |
| 1004 |
GVariant* _tmp3_; |
| 1005 |
GVariantType* _tmp4_; |
| 1006 |
GVariantType* _tmp5_; |
| 1007 |
GVariant* _tmp6_; |
| 1008 |
GVariant* _tmp7_; |
| 1009 |
_tmp1_ = systemd_service_file; |
| 1010 |
_tmp2_ = g_variant_new ("(s)", _tmp1_, NULL); |
| 1011 |
g_variant_ref_sink (_tmp2_); |
| 1012 |
_tmp3_ = _tmp2_; |
| 1013 |
_tmp4_ = g_variant_type_new ("(o)"); |
| 1014 |
_tmp5_ = _tmp4_; |
| 1015 |
_tmp6_ = g_dbus_connection_call_sync (connection, "org.freedesktop.systemd1", "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", "GetUnit", _tmp3_, _tmp5_, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &_inner_error0_); |
| 1016 |
_tmp7_ = _tmp6_; |
| 1017 |
_g_variant_type_free0 (_tmp5_); |
| 1018 |
_g_variant_unref0 (_tmp3_); |
| 1019 |
variant = _tmp7_; |
| 1020 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 1021 |
goto __catch0_g_error; |
| 1022 |
} |
| 1023 |
g_variant_get (variant, "(o)", &object_path, NULL); |
| 1024 |
if (verbose) { |
| 1025 |
FILE* _tmp8_; |
| 1026 |
const gchar* _tmp9_; |
| 1027 |
const gchar* _tmp10_; |
| 1028 |
_tmp8_ = stderr; |
| 1029 |
_tmp9_ = object_path; |
| 1030 |
_tmp10_ = systemd_service_file; |
| 1031 |
fprintf (_tmp8_, "Succeed to get an object path \"%s\" for IBus " "systemd service file \"%s\".\n", _tmp9_, _tmp10_); |
| 1032 |
} |
| 1033 |
result = object_path; |
| 1034 |
_g_variant_unref0 (variant); |
| 1035 |
return result; |
| 1036 |
} |
| 1037 |
goto __finally0; |
| 1038 |
__catch0_g_error: |
| 1039 |
{ |
| 1040 |
GError* e = NULL; |
| 1041 |
e = _inner_error0_; |
| 1042 |
_inner_error0_ = NULL; |
| 1043 |
if (verbose) { |
| 1044 |
FILE* _tmp11_; |
| 1045 |
const gchar* _tmp12_; |
| 1046 |
GError* _tmp13_; |
| 1047 |
const gchar* _tmp14_; |
| 1048 |
_tmp11_ = stderr; |
| 1049 |
_tmp12_ = systemd_service_file; |
| 1050 |
_tmp13_ = e; |
| 1051 |
_tmp14_ = _tmp13_->message; |
| 1052 |
fprintf (_tmp11_, "IBus systemd service file \"%s\" is not installed " "in your system: %s\n", _tmp12_, _tmp14_); |
| 1053 |
} |
| 1054 |
_g_error_free0 (e); |
| 1055 |
} |
| 1056 |
__finally0: |
| 1057 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 1058 |
_g_free0 (object_path); |
| 1059 |
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 1060 |
g_clear_error (&_inner_error0_); |
| 1061 |
return NULL; |
| 1062 |
} |
| 1063 |
result = NULL; |
| 1064 |
_g_free0 (object_path); |
| 1065 |
return result; |
| 1066 |
} |
| 1067 |
|
| 1068 |
gboolean |
| 1069 |
is_running_daemon_via_systemd (GDBusConnection* connection, |
| 1070 |
const gchar* object_path, |
| 1071 |
gboolean verbose) |
| 1072 |
{ |
| 1073 |
gchar* state = NULL; |
| 1074 |
const gchar* _tmp16_; |
| 1075 |
GError* _inner_error0_ = NULL; |
| 1076 |
gboolean result; |
| 1077 |
g_return_val_if_fail (connection != NULL, FALSE); |
| 1078 |
g_return_val_if_fail (object_path != NULL, FALSE); |
| 1079 |
state = NULL; |
| 1080 |
{ |
| 1081 |
while (TRUE) { |
| 1082 |
GVariant* variant = NULL; |
| 1083 |
GVariant* _tmp0_; |
| 1084 |
GVariant* _tmp1_; |
| 1085 |
GVariantType* _tmp2_; |
| 1086 |
GVariantType* _tmp3_; |
| 1087 |
GVariant* _tmp4_; |
| 1088 |
GVariant* _tmp5_; |
| 1089 |
GVariant* child = NULL; |
| 1090 |
GVariant* _tmp6_; |
| 1091 |
GVariant* _tmp7_; |
| 1092 |
gchar* _tmp8_; |
| 1093 |
const gchar* _tmp11_; |
| 1094 |
_tmp0_ = g_variant_new ("(ss)", "org.freedesktop.systemd1.Unit", "ActiveState", NULL); |
| 1095 |
g_variant_ref_sink (_tmp0_); |
| 1096 |
_tmp1_ = _tmp0_; |
| 1097 |
_tmp2_ = g_variant_type_new ("(v)"); |
| 1098 |
_tmp3_ = _tmp2_; |
| 1099 |
_tmp4_ = g_dbus_connection_call_sync (connection, "org.freedesktop.systemd1", object_path, "org.freedesktop.DBus.Properties", "Get", _tmp1_, _tmp3_, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &_inner_error0_); |
| 1100 |
_tmp5_ = _tmp4_; |
| 1101 |
_g_variant_type_free0 (_tmp3_); |
| 1102 |
_g_variant_unref0 (_tmp1_); |
| 1103 |
variant = _tmp5_; |
| 1104 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 1105 |
goto __catch0_g_error; |
| 1106 |
} |
| 1107 |
child = NULL; |
| 1108 |
_tmp6_ = variant; |
| 1109 |
g_variant_get (_tmp6_, "(v)", &child, NULL); |
| 1110 |
_tmp7_ = child; |
| 1111 |
_tmp8_ = g_variant_dup_string (_tmp7_, NULL); |
| 1112 |
_g_free0 (state); |
| 1113 |
state = _tmp8_; |
| 1114 |
if (verbose) { |
| 1115 |
FILE* _tmp9_; |
| 1116 |
const gchar* _tmp10_; |
| 1117 |
_tmp9_ = stderr; |
| 1118 |
_tmp10_ = state; |
| 1119 |
fprintf (_tmp9_, "systemd state is \"%s\" for an object " "path \"%s\".\n", _tmp10_, object_path); |
| 1120 |
} |
| 1121 |
_tmp11_ = state; |
| 1122 |
if (g_strcmp0 (_tmp11_, "activating") != 0) { |
| 1123 |
_g_variant_unref0 (child); |
| 1124 |
_g_variant_unref0 (variant); |
| 1125 |
break; |
| 1126 |
} |
| 1127 |
sleep ((guint) 1); |
| 1128 |
_g_variant_unref0 (child); |
| 1129 |
_g_variant_unref0 (variant); |
| 1130 |
} |
| 1131 |
} |
| 1132 |
goto __finally0; |
| 1133 |
__catch0_g_error: |
| 1134 |
{ |
| 1135 |
GError* e = NULL; |
| 1136 |
e = _inner_error0_; |
| 1137 |
_inner_error0_ = NULL; |
| 1138 |
if (verbose) { |
| 1139 |
FILE* _tmp12_; |
| 1140 |
GError* _tmp13_; |
| 1141 |
const gchar* _tmp14_; |
| 1142 |
_tmp12_ = stderr; |
| 1143 |
_tmp13_ = e; |
| 1144 |
_tmp14_ = _tmp13_->message; |
| 1145 |
fprintf (_tmp12_, "%s\n", _tmp14_); |
| 1146 |
} |
| 1147 |
result = FALSE; |
| 1148 |
_g_error_free0 (e); |
| 1149 |
_g_free0 (state); |
| 1150 |
return result; |
| 1151 |
} |
| 1152 |
__finally0: |
| 1153 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 1154 |
gboolean _tmp15_ = FALSE; |
| 1155 |
_g_free0 (state); |
| 1156 |
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 1157 |
g_clear_error (&_inner_error0_); |
| 1158 |
return _tmp15_; |
| 1159 |
} |
| 1160 |
_tmp16_ = state; |
| 1161 |
if (g_strcmp0 (_tmp16_, "active") == 0) { |
| 1162 |
result = TRUE; |
| 1163 |
_g_free0 (state); |
| 1164 |
return result; |
| 1165 |
} |
| 1166 |
result = FALSE; |
| 1167 |
_g_free0 (state); |
| 1168 |
return result; |
| 1169 |
} |
| 1170 |
|
| 1171 |
void |
| 1172 |
registry_global_cb (void* data, |
| 1173 |
struct wl_registry* wl_registry, |
| 1174 |
guint32 name, |
| 1175 |
const gchar* interface, |
| 1176 |
guint32 version) |
| 1177 |
{ |
| 1178 |
g_return_if_fail (wl_registry != NULL); |
| 1179 |
g_return_if_fail (interface != NULL); |
| 1180 |
if (verbose) { |
| 1181 |
FILE* _tmp0_; |
| 1182 |
_tmp0_ = stderr; |
| 1183 |
fprintf (_tmp0_, "Wl.RegistryListenerGlobal name: %3u interface: %s " "version: %u.\n", name, interface, version); |
| 1184 |
} |
| 1185 |
if (g_strcmp0 (interface, "zwp_input_method_manager_v2") == 0) { |
| 1186 |
is_wayland_session = TRUE; |
| 1187 |
} else { |
| 1188 |
if (g_strcmp0 (interface, "zwp_input_method_v1") == 0) { |
| 1189 |
FILE* _tmp1_; |
| 1190 |
_tmp1_ = stderr; |
| 1191 |
fprintf (_tmp1_, "%s", "Wayland input-method protocol version 1 does not " "work with the forked application.\n"); |
| 1192 |
is_wayland_session = TRUE; |
| 1193 |
} |
| 1194 |
} |
| 1195 |
} |
| 1196 |
|
| 1197 |
void |
| 1198 |
registry_global_remove_cb (void* data, |
| 1199 |
struct wl_registry* wl_registry, |
| 1200 |
guint32 name) |
| 1201 |
{ |
| 1202 |
g_return_if_fail (wl_registry != NULL); |
| 1203 |
} |
| 1204 |
|
| 1205 |
static void |
| 1206 |
_registry_global_cb_wl_registrylistenerglobal (void* data, |
| 1207 |
struct wl_registry* wl_registry, |
| 1208 |
guint32 name, |
| 1209 |
const gchar* interface, |
| 1210 |
guint32 version) |
| 1211 |
{ |
| 1212 |
registry_global_cb (data, wl_registry, name, interface, version); |
| 1213 |
} |
| 1214 |
|
| 1215 |
static void |
| 1216 |
_registry_global_remove_cb_wl_registrylistenerglobalremove (void* data, |
| 1217 |
struct wl_registry* wl_registry, |
| 1218 |
guint32 name) |
| 1219 |
{ |
| 1220 |
registry_global_remove_cb (data, wl_registry, name); |
| 1221 |
} |
| 1222 |
|
| 1223 |
gboolean |
| 1224 |
check_wayland_protocols (void) |
| 1225 |
{ |
| 1226 |
struct wl_display* display = NULL; |
| 1227 |
struct wl_display* _tmp0_; |
| 1228 |
struct wl_display* _tmp1_; |
| 1229 |
struct wl_registry* registry = NULL; |
| 1230 |
struct wl_display* _tmp2_; |
| 1231 |
struct wl_registry* _tmp3_; |
| 1232 |
struct wl_registry_listener listener = {0}; |
| 1233 |
struct wl_registry_listener _tmp4_ = {0}; |
| 1234 |
struct wl_registry* _tmp5_; |
| 1235 |
struct wl_registry_listener _tmp6_; |
| 1236 |
struct wl_display* _tmp7_; |
| 1237 |
gboolean result; |
| 1238 |
_tmp0_ = wl_display_connect (NULL); |
| 1239 |
display = _tmp0_; |
| 1240 |
_tmp1_ = display; |
| 1241 |
if (_tmp1_ == NULL) { |
| 1242 |
result = FALSE; |
| 1243 |
_wl_display_disconnect0 (display); |
| 1244 |
return result; |
| 1245 |
} |
| 1246 |
_tmp2_ = display; |
| 1247 |
_tmp3_ = wl_display_get_registry (_tmp2_); |
| 1248 |
registry = _tmp3_; |
| 1249 |
memset (&_tmp4_, 0, sizeof (struct wl_registry_listener)); |
| 1250 |
_tmp4_.global = _registry_global_cb_wl_registrylistenerglobal; |
| 1251 |
_tmp4_.global_remove = _registry_global_remove_cb_wl_registrylistenerglobalremove; |
| 1252 |
listener = _tmp4_; |
| 1253 |
_tmp5_ = registry; |
| 1254 |
_tmp6_ = listener; |
| 1255 |
wl_registry_add_listener (_tmp5_, &_tmp6_, NULL); |
| 1256 |
_tmp7_ = display; |
| 1257 |
wl_display_roundtrip (_tmp7_); |
| 1258 |
result = TRUE; |
| 1259 |
_wl_registry_destroy0 (registry); |
| 1260 |
_wl_display_disconnect0 (display); |
| 1261 |
return result; |
| 1262 |
} |
| 1263 |
|
| 1264 |
static gchar* |
| 1265 |
_vala_g_strjoinv (const gchar* separator, |
| 1266 |
gchar** str_array, |
| 1267 |
gint str_array_length1) |
| 1268 |
{ |
| 1269 |
gboolean _tmp0_ = FALSE; |
| 1270 |
gchar* result; |
| 1271 |
if (separator == NULL) { |
| 1272 |
separator = ""; |
| 1273 |
} |
| 1274 |
if (str_array != NULL) { |
| 1275 |
gboolean _tmp1_ = FALSE; |
| 1276 |
if (str_array_length1 > 0) { |
| 1277 |
_tmp1_ = TRUE; |
| 1278 |
} else { |
| 1279 |
gboolean _tmp2_ = FALSE; |
| 1280 |
if (str_array_length1 == -1) { |
| 1281 |
const gchar* _tmp3_; |
| 1282 |
_tmp3_ = str_array[0]; |
| 1283 |
_tmp2_ = _tmp3_ != NULL; |
| 1284 |
} else { |
| 1285 |
_tmp2_ = FALSE; |
| 1286 |
} |
| 1287 |
_tmp1_ = _tmp2_; |
| 1288 |
} |
| 1289 |
_tmp0_ = _tmp1_; |
| 1290 |
} else { |
| 1291 |
_tmp0_ = FALSE; |
| 1292 |
} |
| 1293 |
if (_tmp0_) { |
| 1294 |
gint i = 0; |
| 1295 |
gsize len = 0UL; |
| 1296 |
gint _tmp16_; |
| 1297 |
gint _tmp17_; |
| 1298 |
const gchar* res = NULL; |
| 1299 |
void* _tmp18_; |
| 1300 |
const gchar* _tmp19_ = NULL; |
| 1301 |
const gchar* _tmp20_; |
| 1302 |
void* ptr = NULL; |
| 1303 |
const gchar* _tmp22_; |
| 1304 |
void* _tmp23_; |
| 1305 |
const gchar* _tmp33_; |
| 1306 |
len = (gsize) 1; |
| 1307 |
{ |
| 1308 |
gboolean _tmp4_ = FALSE; |
| 1309 |
i = 0; |
| 1310 |
_tmp4_ = TRUE; |
| 1311 |
while (TRUE) { |
| 1312 |
gboolean _tmp6_ = FALSE; |
| 1313 |
gboolean _tmp7_ = FALSE; |
| 1314 |
gint _tmp10_ = 0; |
| 1315 |
const gchar* _tmp11_; |
| 1316 |
if (!_tmp4_) { |
| 1317 |
gint _tmp5_; |
| 1318 |
_tmp5_ = i; |
| 1319 |
i = _tmp5_ + 1; |
| 1320 |
} |
| 1321 |
_tmp4_ = FALSE; |
| 1322 |
if (str_array_length1 != -1) { |
| 1323 |
_tmp7_ = i < str_array_length1; |
| 1324 |
} else { |
| 1325 |
_tmp7_ = FALSE; |
| 1326 |
} |
| 1327 |
if (_tmp7_) { |
| 1328 |
_tmp6_ = TRUE; |
| 1329 |
} else { |
| 1330 |
gboolean _tmp8_ = FALSE; |
| 1331 |
if (str_array_length1 == -1) { |
| 1332 |
const gchar* _tmp9_; |
| 1333 |
_tmp9_ = str_array[i]; |
| 1334 |
_tmp8_ = _tmp9_ != NULL; |
| 1335 |
} else { |
| 1336 |
_tmp8_ = FALSE; |
| 1337 |
} |
| 1338 |
_tmp6_ = _tmp8_; |
| 1339 |
} |
| 1340 |
if (!_tmp6_) { |
| 1341 |
break; |
| 1342 |
} |
| 1343 |
_tmp11_ = str_array[i]; |
| 1344 |
if (_tmp11_ != NULL) { |
| 1345 |
const gchar* _tmp12_; |
| 1346 |
gint _tmp13_; |
| 1347 |
gint _tmp14_; |
| 1348 |
_tmp12_ = str_array[i]; |
| 1349 |
_tmp13_ = strlen ((const gchar*) _tmp12_); |
| 1350 |
_tmp14_ = _tmp13_; |
| 1351 |
_tmp10_ = _tmp14_; |
| 1352 |
} else { |
| 1353 |
_tmp10_ = 0; |
| 1354 |
} |
| 1355 |
len += (gsize) _tmp10_; |
| 1356 |
} |
| 1357 |
} |
| 1358 |
if (i == 0) { |
| 1359 |
gchar* _tmp15_; |
| 1360 |
_tmp15_ = g_strdup (""); |
| 1361 |
result = _tmp15_; |
| 1362 |
return result; |
| 1363 |
} |
| 1364 |
str_array_length1 = i; |
| 1365 |
_tmp16_ = strlen ((const gchar*) separator); |
| 1366 |
_tmp17_ = _tmp16_; |
| 1367 |
len += (gsize) (_tmp17_ * (i - 1)); |
| 1368 |
_tmp18_ = g_malloc (len); |
| 1369 |
res = _tmp18_; |
| 1370 |
_tmp20_ = str_array[0]; |
| 1371 |
if (_tmp20_ != NULL) { |
| 1372 |
const gchar* _tmp21_; |
| 1373 |
_tmp21_ = str_array[0]; |
| 1374 |
_tmp19_ = (const gchar*) _tmp21_; |
| 1375 |
} else { |
| 1376 |
_tmp19_ = ""; |
| 1377 |
} |
| 1378 |
_tmp22_ = res; |
| 1379 |
_tmp23_ = g_stpcpy ((void*) _tmp22_, _tmp19_); |
| 1380 |
ptr = _tmp23_; |
| 1381 |
{ |
| 1382 |
gboolean _tmp24_ = FALSE; |
| 1383 |
i = 1; |
| 1384 |
_tmp24_ = TRUE; |
| 1385 |
while (TRUE) { |
| 1386 |
void* _tmp26_; |
| 1387 |
void* _tmp27_; |
| 1388 |
const gchar* _tmp28_ = NULL; |
| 1389 |
const gchar* _tmp29_; |
| 1390 |
void* _tmp31_; |
| 1391 |
void* _tmp32_; |
| 1392 |
if (!_tmp24_) { |
| 1393 |
gint _tmp25_; |
| 1394 |
_tmp25_ = i; |
| 1395 |
i = _tmp25_ + 1; |
| 1396 |
} |
| 1397 |
_tmp24_ = FALSE; |
| 1398 |
if (!(i < str_array_length1)) { |
| 1399 |
break; |
| 1400 |
} |
| 1401 |
_tmp26_ = ptr; |
| 1402 |
_tmp27_ = g_stpcpy (_tmp26_, (const gchar*) separator); |
| 1403 |
ptr = _tmp27_; |
| 1404 |
_tmp29_ = str_array[i]; |
| 1405 |
if (_tmp29_ != NULL) { |
| 1406 |
const gchar* _tmp30_; |
| 1407 |
_tmp30_ = str_array[i]; |
| 1408 |
_tmp28_ = (const gchar*) _tmp30_; |
| 1409 |
} else { |
| 1410 |
_tmp28_ = ""; |
| 1411 |
} |
| 1412 |
_tmp31_ = ptr; |
| 1413 |
_tmp32_ = g_stpcpy (_tmp31_, _tmp28_); |
| 1414 |
ptr = _tmp32_; |
| 1415 |
} |
| 1416 |
} |
| 1417 |
_tmp33_ = res; |
| 1418 |
res = NULL; |
| 1419 |
result = (gchar*) _tmp33_; |
| 1420 |
return result; |
| 1421 |
} else { |
| 1422 |
gchar* _tmp34_; |
| 1423 |
_tmp34_ = g_strdup (""); |
| 1424 |
result = _tmp34_; |
| 1425 |
return result; |
| 1426 |
} |
| 1427 |
} |
| 1428 |
|
| 1429 |
static void |
| 1430 |
_vala_array_add2 (gchar** * array, |
| 1431 |
gint* length, |
| 1432 |
gint* size, |
| 1433 |
gchar* value) |
| 1434 |
{ |
| 1435 |
if ((*length) == (*size)) { |
| 1436 |
*size = (*size) ? (2 * (*size)) : 4; |
| 1437 |
*array = g_renew (gchar*, *array, (*size) + 1); |
| 1438 |
} |
| 1439 |
(*array)[(*length)++] = value; |
| 1440 |
(*array)[*length] = NULL; |
| 1441 |
} |
| 1442 |
|
| 1443 |
static void |
| 1444 |
_vala_array_add3 (gchar** * array, |
| 1445 |
gint* length, |
| 1446 |
gint* size, |
| 1447 |
gchar* value) |
| 1448 |
{ |
| 1449 |
if ((*length) == (*size)) { |
| 1450 |
*size = (*size) ? (2 * (*size)) : 4; |
| 1451 |
*array = g_renew (gchar*, *array, (*size) + 1); |
| 1452 |
} |
| 1453 |
(*array)[(*length)++] = value; |
| 1454 |
(*array)[*length] = NULL; |
| 1455 |
} |
| 1456 |
|
| 1457 |
static void |
| 1458 |
_vala_array_add4 (gchar** * array, |
| 1459 |
gint* length, |
| 1460 |
gint* size, |
| 1461 |
gchar* value) |
| 1462 |
{ |
| 1463 |
if ((*length) == (*size)) { |
| 1464 |
*size = (*size) ? (2 * (*size)) : 4; |
| 1465 |
*array = g_renew (gchar*, *array, (*size) + 1); |
| 1466 |
} |
| 1467 |
(*array)[(*length)++] = value; |
| 1468 |
(*array)[*length] = NULL; |
| 1469 |
} |
| 1470 |
|
| 1471 |
static void |
| 1472 |
_vala_array_add5 (gchar** * array, |
| 1473 |
gint* length, |
| 1474 |
gint* size, |
| 1475 |
gchar* value) |
| 1476 |
{ |
| 1477 |
if ((*length) == (*size)) { |
| 1478 |
*size = (*size) ? (2 * (*size)) : 4; |
| 1479 |
*array = g_renew (gchar*, *array, (*size) + 1); |
| 1480 |
} |
| 1481 |
(*array)[(*length)++] = value; |
| 1482 |
(*array)[*length] = NULL; |
| 1483 |
} |
| 1484 |
|
| 1485 |
static void |
| 1486 |
_vala_array_add6 (gchar** * array, |
| 1487 |
gint* length, |
| 1488 |
gint* size, |
| 1489 |
gchar* value) |
| 1490 |
{ |
| 1491 |
if ((*length) == (*size)) { |
| 1492 |
*size = (*size) ? (2 * (*size)) : 4; |
| 1493 |
*array = g_renew (gchar*, *array, (*size) + 1); |
| 1494 |
} |
| 1495 |
(*array)[(*length)++] = value; |
| 1496 |
(*array)[*length] = NULL; |
| 1497 |
} |
| 1498 |
|
| 1499 |
gboolean |
| 1500 |
start_daemon_in_wayland (gboolean restart, |
| 1501 |
gchar** _argv, |
| 1502 |
gint _argv_length1) |
| 1503 |
{ |
| 1504 |
IBusBus* bus = NULL; |
| 1505 |
IBusBus* _tmp1_; |
| 1506 |
gchar* cmd = NULL; |
| 1507 |
gchar* _tmp10_; |
| 1508 |
GFile* file = NULL; |
| 1509 |
const gchar* _tmp11_; |
| 1510 |
GFile* _tmp12_; |
| 1511 |
GFile* _tmp13_; |
| 1512 |
gchar* daemon_args = NULL; |
| 1513 |
gchar* _tmp15_; |
| 1514 |
gchar** argv = NULL; |
| 1515 |
const gchar* _tmp17_; |
| 1516 |
gchar* _tmp18_; |
| 1517 |
gchar** _tmp19_; |
| 1518 |
gint argv_length1; |
| 1519 |
gint _argv_size_; |
| 1520 |
gchar* _tmp20_; |
| 1521 |
gchar* _tmp21_; |
| 1522 |
gchar* _tmp22_; |
| 1523 |
const gchar* _tmp23_; |
| 1524 |
gchar* _tmp24_; |
| 1525 |
gchar** env = NULL; |
| 1526 |
gchar** _tmp26_; |
| 1527 |
gchar** _tmp27_; |
| 1528 |
gint env_length1; |
| 1529 |
gint _env_size_; |
| 1530 |
GError* _inner_error0_ = NULL; |
| 1531 |
gboolean result; |
| 1532 |
check_wayland_protocols (); |
| 1533 |
if (!is_wayland_session) { |
| 1534 |
if (verbose) { |
| 1535 |
FILE* _tmp0_; |
| 1536 |
_tmp0_ = stderr; |
| 1537 |
fprintf (_tmp0_, "Cannot find the Wayland input-method protocol.\n"); |
| 1538 |
} |
| 1539 |
result = FALSE; |
| 1540 |
return result; |
| 1541 |
} |
| 1542 |
_tmp1_ = get_bus (); |
| 1543 |
bus = _tmp1_; |
| 1544 |
if (restart) { |
| 1545 |
IBusBus* _tmp2_; |
| 1546 |
IBusBus* _tmp4_; |
| 1547 |
_tmp2_ = bus; |
| 1548 |
if (_tmp2_ == NULL) { |
| 1549 |
FILE* _tmp3_; |
| 1550 |
_tmp3_ = stderr; |
| 1551 |
fprintf (_tmp3_, "%s", _ ("Can't connect to IBus.\n")); |
| 1552 |
result = FALSE; |
| 1553 |
_g_object_unref0 (bus); |
| 1554 |
return result; |
| 1555 |
} |
| 1556 |
_tmp4_ = bus; |
| 1557 |
ibus_bus_exit (_tmp4_, FALSE); |
| 1558 |
if (verbose) { |
| 1559 |
FILE* _tmp5_; |
| 1560 |
_tmp5_ = stderr; |
| 1561 |
fprintf (_tmp5_, "%s", "Succeed to exit ibus-daemon with an IBus API " "directly.\n"); |
| 1562 |
} |
| 1563 |
_g_object_unref0 (bus); |
| 1564 |
bus = NULL; |
| 1565 |
sleep ((guint) 3); |
| 1566 |
} else { |
| 1567 |
IBusBus* _tmp6_; |
| 1568 |
_tmp6_ = bus; |
| 1569 |
if (_tmp6_ != NULL) { |
| 1570 |
FILE* _tmp7_; |
| 1571 |
gchar* _tmp8_; |
| 1572 |
gchar* _tmp9_; |
| 1573 |
_tmp7_ = stderr; |
| 1574 |
_tmp8_ = g_strdup_printf ("%s\n", _ ("IBus is running.")); |
| 1575 |
_tmp9_ = _tmp8_; |
| 1576 |
fprintf (_tmp7_, "%s", _tmp9_); |
| 1577 |
_g_free0 (_tmp9_); |
| 1578 |
exit (EXIT_FAILURE); |
| 1579 |
result = TRUE; |
| 1580 |
_g_object_unref0 (bus); |
| 1581 |
return result; |
| 1582 |
} |
| 1583 |
} |
| 1584 |
_tmp10_ = g_strdup (LIBEXECDIR "/ibus-ui-gtk3"); |
| 1585 |
cmd = _tmp10_; |
| 1586 |
_tmp11_ = cmd; |
| 1587 |
_tmp12_ = g_file_new_for_path (_tmp11_); |
| 1588 |
file = _tmp12_; |
| 1589 |
_tmp13_ = file; |
| 1590 |
if (!g_file_query_exists (_tmp13_, NULL)) { |
| 1591 |
gchar* _tmp14_; |
| 1592 |
_tmp14_ = g_strdup ("../ui/gtk3/ibus-ui-gtk3"); |
| 1593 |
_g_free0 (cmd); |
| 1594 |
cmd = _tmp14_; |
| 1595 |
} |
| 1596 |
_tmp15_ = g_strdup ("--xim --panel disable"); |
| 1597 |
daemon_args = _tmp15_; |
| 1598 |
if (_argv_length1 > 1) { |
| 1599 |
gchar* _tmp16_; |
| 1600 |
_tmp16_ = _vala_g_strjoinv (" ", _argv + 1, (gint) (_argv_length1 - 1)); |
| 1601 |
_g_free0 (daemon_args); |
| 1602 |
daemon_args = _tmp16_; |
| 1603 |
} |
| 1604 |
_tmp17_ = cmd; |
| 1605 |
_tmp18_ = g_strdup (_tmp17_); |
| 1606 |
_tmp19_ = g_new0 (gchar*, 1 + 1); |
| 1607 |
_tmp19_[0] = _tmp18_; |
| 1608 |
argv = _tmp19_; |
| 1609 |
argv_length1 = 1; |
| 1610 |
_argv_size_ = argv_length1; |
| 1611 |
_tmp20_ = g_strdup ("--enable-wayland-im"); |
| 1612 |
_vala_array_add2 (&argv, &argv_length1, &_argv_size_, _tmp20_); |
| 1613 |
_tmp21_ = g_strdup ("--exec-daemon"); |
| 1614 |
_vala_array_add3 (&argv, &argv_length1, &_argv_size_, _tmp21_); |
| 1615 |
_tmp22_ = g_strdup ("--daemon-args"); |
| 1616 |
_vala_array_add4 (&argv, &argv_length1, &_argv_size_, _tmp22_); |
| 1617 |
_tmp23_ = daemon_args; |
| 1618 |
_tmp24_ = g_strdup_printf ("%s", _tmp23_); |
| 1619 |
_vala_array_add5 (&argv, &argv_length1, &_argv_size_, _tmp24_); |
| 1620 |
if (verbose) { |
| 1621 |
gchar* _tmp25_; |
| 1622 |
_tmp25_ = g_strdup ("--verbose"); |
| 1623 |
_vala_array_add6 (&argv, &argv_length1, &_argv_size_, _tmp25_); |
| 1624 |
} |
| 1625 |
_tmp27_ = _tmp26_ = g_get_environ (); |
| 1626 |
env = _tmp27_; |
| 1627 |
env_length1 = _vala_array_length (_tmp26_); |
| 1628 |
_env_size_ = env_length1; |
| 1629 |
{ |
| 1630 |
gchar** _tmp28_; |
| 1631 |
gint _tmp28__length1; |
| 1632 |
gchar** _tmp29_; |
| 1633 |
gint _tmp29__length1; |
| 1634 |
_tmp28_ = argv; |
| 1635 |
_tmp28__length1 = argv_length1; |
| 1636 |
_tmp29_ = env; |
| 1637 |
_tmp29__length1 = env_length1; |
| 1638 |
g_spawn_async (NULL, _tmp28_, _tmp29_, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &_inner_error0_); |
| 1639 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 1640 |
gboolean _tmp30_ = FALSE; |
| 1641 |
if (_inner_error0_->domain == G_SPAWN_ERROR) { |
| 1642 |
goto __catch0_g_spawn_error; |
| 1643 |
} |
| 1644 |
env = (_vala_array_free (env, env_length1, (GDestroyNotify) g_free), NULL); |
| 1645 |
argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL); |
| 1646 |
_g_free0 (daemon_args); |
| 1647 |
_g_object_unref0 (file); |
| 1648 |
_g_free0 (cmd); |
| 1649 |
_g_object_unref0 (bus); |
| 1650 |
g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 1651 |
g_clear_error (&_inner_error0_); |
| 1652 |
return _tmp30_; |
| 1653 |
} |
| 1654 |
} |
| 1655 |
goto __finally0; |
| 1656 |
__catch0_g_spawn_error: |
| 1657 |
{ |
| 1658 |
GError* e = NULL; |
| 1659 |
FILE* _tmp31_; |
| 1660 |
GError* _tmp32_; |
| 1661 |
const gchar* _tmp33_; |
| 1662 |
e = _inner_error0_; |
| 1663 |
_inner_error0_ = NULL; |
| 1664 |
_tmp31_ = stderr; |
| 1665 |
_tmp32_ = e; |
| 1666 |
_tmp33_ = _tmp32_->message; |
| 1667 |
fprintf (_tmp31_, "%s\n", _tmp33_); |
| 1668 |
exit (EXIT_FAILURE); |
| 1669 |
result = TRUE; |
| 1670 |
_g_error_free0 (e); |
| 1671 |
env = (_vala_array_free (env, env_length1, (GDestroyNotify) g_free), NULL); |
| 1672 |
argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL); |
| 1673 |
_g_free0 (daemon_args); |
| 1674 |
_g_object_unref0 (file); |
| 1675 |
_g_free0 (cmd); |
| 1676 |
_g_object_unref0 (bus); |
| 1677 |
return result; |
| 1678 |
} |
| 1679 |
__finally0: |
| 1680 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 1681 |
gboolean _tmp34_ = FALSE; |
| 1682 |
env = (_vala_array_free (env, env_length1, (GDestroyNotify) g_free), NULL); |
| 1683 |
argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL); |
| 1684 |
_g_free0 (daemon_args); |
| 1685 |
_g_object_unref0 (file); |
| 1686 |
_g_free0 (cmd); |
| 1687 |
_g_object_unref0 (bus); |
| 1688 |
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 1689 |
g_clear_error (&_inner_error0_); |
| 1690 |
return _tmp34_; |
| 1691 |
} |
| 1692 |
if (verbose) { |
| 1693 |
const gchar* _tmp35_ = NULL; |
| 1694 |
FILE* _tmp36_; |
| 1695 |
if (restart) { |
| 1696 |
_tmp35_ = "restart"; |
| 1697 |
} else { |
| 1698 |
_tmp35_ = "start"; |
| 1699 |
} |
| 1700 |
_tmp36_ = stderr; |
| 1701 |
fprintf (_tmp36_, "Succeed to %s ibus-daemon with a Wayland " "input-method version 2.\n", _tmp35_); |
| 1702 |
} |
| 1703 |
result = TRUE; |
| 1704 |
env = (_vala_array_free (env, env_length1, (GDestroyNotify) g_free), NULL); |
| 1705 |
argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL); |
| 1706 |
_g_free0 (daemon_args); |
| 1707 |
_g_object_unref0 (file); |
| 1708 |
_g_free0 (cmd); |
| 1709 |
_g_object_unref0 (bus); |
| 1710 |
return result; |
| 1711 |
} |
| 1712 |
|
| 1713 |
gboolean |
| 1714 |
start_daemon_with_dbus_systemd (GDBusConnection* connection, |
| 1715 |
gboolean restart, |
| 1716 |
gboolean verbose) |
| 1717 |
{ |
| 1718 |
gchar* object_path = NULL; |
| 1719 |
gchar* method = NULL; |
| 1720 |
gchar* _tmp0_; |
| 1721 |
const gchar* _tmp1_; |
| 1722 |
GError* _inner_error0_ = NULL; |
| 1723 |
gboolean result; |
| 1724 |
g_return_val_if_fail (connection != NULL, FALSE); |
| 1725 |
object_path = NULL; |
| 1726 |
_tmp0_ = g_strdup ("StartUnit"); |
| 1727 |
method = _tmp0_; |
| 1728 |
_tmp1_ = systemd_service_file; |
| 1729 |
_vala_assert (_tmp1_ != NULL, "systemd_service_file != null"); |
| 1730 |
if (restart) { |
| 1731 |
gchar* _tmp2_; |
| 1732 |
_tmp2_ = g_strdup ("RestartUnit"); |
| 1733 |
_g_free0 (method); |
| 1734 |
method = _tmp2_; |
| 1735 |
} |
| 1736 |
{ |
| 1737 |
GVariant* variant = NULL; |
| 1738 |
const gchar* _tmp3_; |
| 1739 |
const gchar* _tmp4_; |
| 1740 |
GVariant* _tmp5_; |
| 1741 |
GVariant* _tmp6_; |
| 1742 |
GVariantType* _tmp7_; |
| 1743 |
GVariantType* _tmp8_; |
| 1744 |
GVariant* _tmp9_; |
| 1745 |
GVariant* _tmp10_; |
| 1746 |
_tmp3_ = method; |
| 1747 |
_tmp4_ = systemd_service_file; |
| 1748 |
_tmp5_ = g_variant_new ("(ss)", _tmp4_, "fail", NULL); |
| 1749 |
g_variant_ref_sink (_tmp5_); |
| 1750 |
_tmp6_ = _tmp5_; |
| 1751 |
_tmp7_ = g_variant_type_new ("(o)"); |
| 1752 |
_tmp8_ = _tmp7_; |
| 1753 |
_tmp9_ = g_dbus_connection_call_sync (connection, "org.freedesktop.systemd1", "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", _tmp3_, _tmp6_, _tmp8_, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &_inner_error0_); |
| 1754 |
_tmp10_ = _tmp9_; |
| 1755 |
_g_variant_type_free0 (_tmp8_); |
| 1756 |
_g_variant_unref0 (_tmp6_); |
| 1757 |
variant = _tmp10_; |
| 1758 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 1759 |
goto __catch0_g_error; |
| 1760 |
} |
| 1761 |
g_variant_get (variant, "(o)", &object_path, NULL); |
| 1762 |
if (verbose) { |
| 1763 |
FILE* _tmp11_; |
| 1764 |
const gchar* _tmp12_; |
| 1765 |
const gchar* _tmp13_; |
| 1766 |
_tmp11_ = stderr; |
| 1767 |
_tmp12_ = systemd_service_file; |
| 1768 |
_tmp13_ = object_path; |
| 1769 |
fprintf (_tmp11_, "Succeed to restart IBus daemon via IBus systemd " "service file \"%s\": \"%s\"\n", _tmp12_, _tmp13_); |
| 1770 |
} |
| 1771 |
result = TRUE; |
| 1772 |
_g_variant_unref0 (variant); |
| 1773 |
_g_free0 (method); |
| 1774 |
_g_free0 (object_path); |
| 1775 |
return result; |
| 1776 |
} |
| 1777 |
goto __finally0; |
| 1778 |
__catch0_g_error: |
| 1779 |
{ |
| 1780 |
GError* e = NULL; |
| 1781 |
e = _inner_error0_; |
| 1782 |
_inner_error0_ = NULL; |
| 1783 |
if (verbose) { |
| 1784 |
const gchar* _tmp14_ = NULL; |
| 1785 |
FILE* _tmp15_; |
| 1786 |
const gchar* _tmp16_; |
| 1787 |
GError* _tmp17_; |
| 1788 |
const gchar* _tmp18_; |
| 1789 |
if (restart) { |
| 1790 |
_tmp14_ = "restart"; |
| 1791 |
} else { |
| 1792 |
_tmp14_ = "start"; |
| 1793 |
} |
| 1794 |
_tmp15_ = stderr; |
| 1795 |
_tmp16_ = systemd_service_file; |
| 1796 |
_tmp17_ = e; |
| 1797 |
_tmp18_ = _tmp17_->message; |
| 1798 |
fprintf (_tmp15_, "Failed to %s IBus daemon via IBus systemd " "service file \"%s\": %s\n", _tmp14_, _tmp16_, _tmp18_); |
| 1799 |
} |
| 1800 |
_g_error_free0 (e); |
| 1801 |
} |
| 1802 |
__finally0: |
| 1803 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 1804 |
gboolean _tmp19_ = FALSE; |
| 1805 |
_g_free0 (method); |
| 1806 |
_g_free0 (object_path); |
| 1807 |
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 1808 |
g_clear_error (&_inner_error0_); |
| 1809 |
return _tmp19_; |
| 1810 |
} |
| 1811 |
result = FALSE; |
| 1812 |
_g_free0 (method); |
| 1813 |
_g_free0 (object_path); |
| 1814 |
return result; |
| 1815 |
} |
| 1816 |
|
| 1817 |
static void |
| 1818 |
_kde_virtual_keyboard_avail_cb_gd_bus_signal_callback (GDBusConnection* connection, |
| 1819 |
const gchar* sender_name, |
| 1820 |
const gchar* object_path, |
| 1821 |
const gchar* interface_name, |
| 1822 |
const gchar* signal_name, |
| 1823 |
GVariant* parameters, |
| 1824 |
gpointer self) |
| 1825 |
{ |
| 1826 |
kde_virtual_keyboard_avail_cb (connection, sender_name, object_path, interface_name, signal_name, parameters); |
| 1827 |
} |
| 1828 |
|
| 1829 |
static gchar |
| 1830 |
string_get (const gchar* self, |
| 1831 |
glong index) |
| 1832 |
{ |
| 1833 |
gchar _tmp0_; |
| 1834 |
gchar result; |
| 1835 |
g_return_val_if_fail (self != NULL, '\0'); |
| 1836 |
_tmp0_ = ((gchar*) self)[index]; |
| 1837 |
result = _tmp0_; |
| 1838 |
return result; |
| 1839 |
} |
| 1840 |
|
| 1841 |
gboolean |
| 1842 |
operate_daemon_with_dbus_kde_real (GDBusConnection* connection, |
| 1843 |
gboolean verbose) |
| 1844 |
{ |
| 1845 |
GMainLoop* _tmp0_; |
| 1846 |
GMainLoop* _tmp1_; |
| 1847 |
guint subscripion_id = 0U; |
| 1848 |
gchar* wayland_values = NULL; |
| 1849 |
gchar* _tmp2_; |
| 1850 |
GVariantBuilder* bytes = NULL; |
| 1851 |
GVariantType* _tmp3_; |
| 1852 |
GVariantType* _tmp4_; |
| 1853 |
GVariantBuilder* _tmp5_; |
| 1854 |
GVariantBuilder* _tmp6_; |
| 1855 |
GVariantBuilder* bytes2 = NULL; |
| 1856 |
GVariantType* _tmp14_; |
| 1857 |
GVariantType* _tmp15_; |
| 1858 |
GVariantBuilder* _tmp16_; |
| 1859 |
GVariantBuilder* _tmp17_; |
| 1860 |
GVariantBuilder* _tmp18_; |
| 1861 |
GVariantBuilder* array = NULL; |
| 1862 |
GVariantType* _tmp19_; |
| 1863 |
GVariantType* _tmp20_; |
| 1864 |
GVariantBuilder* _tmp21_; |
| 1865 |
GVariantBuilder* _tmp22_; |
| 1866 |
GMainLoop* _tmp36_; |
| 1867 |
GError* _inner_error0_ = NULL; |
| 1868 |
gboolean result; |
| 1869 |
g_return_val_if_fail (connection != NULL, FALSE); |
| 1870 |
_tmp0_ = g_main_loop_new (NULL, FALSE); |
| 1871 |
_g_main_loop_unref0 (loop); |
| 1872 |
loop = _tmp0_; |
| 1873 |
_tmp1_ = loop; |
| 1874 |
_vala_assert (_tmp1_ != NULL, "loop != null"); |
| 1875 |
subscripion_id = g_dbus_connection_signal_subscribe (connection, NULL, "org.kde.kwin.VirtualKeyboard", "availableChanged", "/VirtualKeyboard", NULL, G_DBUS_SIGNAL_FLAGS_NONE, _kde_virtual_keyboard_avail_cb_gd_bus_signal_callback, NULL, NULL); |
| 1876 |
_tmp2_ = g_strdup ("InputMethod"); |
| 1877 |
wayland_values = _tmp2_; |
| 1878 |
_tmp3_ = g_variant_type_new ("ay"); |
| 1879 |
_tmp4_ = _tmp3_; |
| 1880 |
_tmp5_ = g_variant_builder_new (_tmp4_); |
| 1881 |
_tmp6_ = _tmp5_; |
| 1882 |
_g_variant_type_free0 (_tmp4_); |
| 1883 |
bytes = _tmp6_; |
| 1884 |
{ |
| 1885 |
gint i = 0; |
| 1886 |
i = 0; |
| 1887 |
{ |
| 1888 |
gboolean _tmp7_ = FALSE; |
| 1889 |
_tmp7_ = TRUE; |
| 1890 |
while (TRUE) { |
| 1891 |
const gchar* _tmp9_; |
| 1892 |
gint _tmp10_; |
| 1893 |
gint _tmp11_; |
| 1894 |
GVariantBuilder* _tmp12_; |
| 1895 |
const gchar* _tmp13_; |
| 1896 |
if (!_tmp7_) { |
| 1897 |
gint _tmp8_; |
| 1898 |
_tmp8_ = i; |
| 1899 |
i = _tmp8_ + 1; |
| 1900 |
} |
| 1901 |
_tmp7_ = FALSE; |
| 1902 |
_tmp9_ = wayland_values; |
| 1903 |
_tmp10_ = strlen (_tmp9_); |
| 1904 |
_tmp11_ = _tmp10_; |
| 1905 |
if (!(i < _tmp11_)) { |
| 1906 |
break; |
| 1907 |
} |
| 1908 |
_tmp12_ = bytes; |
| 1909 |
_tmp13_ = wayland_values; |
| 1910 |
g_variant_builder_add (_tmp12_, "y", string_get (_tmp13_, (glong) i), NULL); |
| 1911 |
} |
| 1912 |
} |
| 1913 |
} |
| 1914 |
_tmp14_ = g_variant_type_new ("aay"); |
| 1915 |
_tmp15_ = _tmp14_; |
| 1916 |
_tmp16_ = g_variant_builder_new (_tmp15_); |
| 1917 |
_tmp17_ = _tmp16_; |
| 1918 |
_g_variant_type_free0 (_tmp15_); |
| 1919 |
bytes2 = _tmp17_; |
| 1920 |
_tmp18_ = bytes; |
| 1921 |
g_variant_builder_add (bytes2, "ay", _tmp18_, NULL); |
| 1922 |
_tmp19_ = g_variant_type_new ("a{saay}"); |
| 1923 |
_tmp20_ = _tmp19_; |
| 1924 |
_tmp21_ = g_variant_builder_new (_tmp20_); |
| 1925 |
_tmp22_ = _tmp21_; |
| 1926 |
_g_variant_type_free0 (_tmp20_); |
| 1927 |
array = _tmp22_; |
| 1928 |
g_variant_builder_add (array, "{saay}", "Wayland", bytes2, NULL); |
| 1929 |
{ |
| 1930 |
gboolean _tmp23_ = FALSE; |
| 1931 |
GVariant* _tmp24_; |
| 1932 |
GVariant* _tmp25_; |
| 1933 |
gboolean _tmp26_; |
| 1934 |
_tmp24_ = g_variant_new ("(a{saay})", array, NULL); |
| 1935 |
g_variant_ref_sink (_tmp24_); |
| 1936 |
_tmp25_ = _tmp24_; |
| 1937 |
_tmp26_ = g_dbus_connection_emit_signal (connection, NULL, "/kwinrc", "org.kde.kconfig.notify", "ConfigChanged", _tmp25_, &_inner_error0_); |
| 1938 |
_g_variant_unref0 (_tmp25_); |
| 1939 |
_tmp23_ = _tmp26_; |
| 1940 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 1941 |
goto __catch0_g_error; |
| 1942 |
} |
| 1943 |
if (!_tmp23_) { |
| 1944 |
GMainLoop* _tmp28_; |
| 1945 |
if (verbose) { |
| 1946 |
FILE* _tmp27_; |
| 1947 |
_tmp27_ = stderr; |
| 1948 |
fprintf (_tmp27_, "Failed to emit a KDE D-Bus signal.\n"); |
| 1949 |
} |
| 1950 |
g_dbus_connection_signal_unsubscribe (connection, subscripion_id); |
| 1951 |
_tmp28_ = loop; |
| 1952 |
if (_tmp28_ != NULL) { |
| 1953 |
GMainLoop* _tmp29_; |
| 1954 |
_tmp29_ = loop; |
| 1955 |
g_main_loop_quit (_tmp29_); |
| 1956 |
_g_main_loop_unref0 (loop); |
| 1957 |
loop = NULL; |
| 1958 |
} |
| 1959 |
result = FALSE; |
| 1960 |
_g_variant_builder_unref0 (array); |
| 1961 |
_g_variant_builder_unref0 (bytes2); |
| 1962 |
_g_variant_builder_unref0 (bytes); |
| 1963 |
_g_free0 (wayland_values); |
| 1964 |
return result; |
| 1965 |
} |
| 1966 |
} |
| 1967 |
goto __finally0; |
| 1968 |
__catch0_g_error: |
| 1969 |
{ |
| 1970 |
GError* e = NULL; |
| 1971 |
FILE* _tmp30_; |
| 1972 |
GError* _tmp31_; |
| 1973 |
const gchar* _tmp32_; |
| 1974 |
GMainLoop* _tmp33_; |
| 1975 |
e = _inner_error0_; |
| 1976 |
_inner_error0_ = NULL; |
| 1977 |
_tmp30_ = stderr; |
| 1978 |
_tmp31_ = e; |
| 1979 |
_tmp32_ = _tmp31_->message; |
| 1980 |
fprintf (_tmp30_, "%s\n", _tmp32_); |
| 1981 |
g_dbus_connection_signal_unsubscribe (connection, subscripion_id); |
| 1982 |
_tmp33_ = loop; |
| 1983 |
if (_tmp33_ != NULL) { |
| 1984 |
GMainLoop* _tmp34_; |
| 1985 |
_tmp34_ = loop; |
| 1986 |
g_main_loop_quit (_tmp34_); |
| 1987 |
_g_main_loop_unref0 (loop); |
| 1988 |
loop = NULL; |
| 1989 |
} |
| 1990 |
result = FALSE; |
| 1991 |
_g_error_free0 (e); |
| 1992 |
_g_variant_builder_unref0 (array); |
| 1993 |
_g_variant_builder_unref0 (bytes2); |
| 1994 |
_g_variant_builder_unref0 (bytes); |
| 1995 |
_g_free0 (wayland_values); |
| 1996 |
return result; |
| 1997 |
} |
| 1998 |
__finally0: |
| 1999 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 2000 |
gboolean _tmp35_ = FALSE; |
| 2001 |
_g_variant_builder_unref0 (array); |
| 2002 |
_g_variant_builder_unref0 (bytes2); |
| 2003 |
_g_variant_builder_unref0 (bytes); |
| 2004 |
_g_free0 (wayland_values); |
| 2005 |
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 2006 |
g_clear_error (&_inner_error0_); |
| 2007 |
return _tmp35_; |
| 2008 |
} |
| 2009 |
_tmp36_ = loop; |
| 2010 |
g_main_loop_run (_tmp36_); |
| 2011 |
g_dbus_connection_signal_unsubscribe (connection, subscripion_id); |
| 2012 |
result = TRUE; |
| 2013 |
_g_variant_builder_unref0 (array); |
| 2014 |
_g_variant_builder_unref0 (bytes2); |
| 2015 |
_g_variant_builder_unref0 (bytes); |
| 2016 |
_g_free0 (wayland_values); |
| 2017 |
return result; |
| 2018 |
} |
| 2019 |
|
| 2020 |
static Block2Data* |
| 2021 |
block2_data_ref (Block2Data* _data2_) |
| 2022 |
{ |
| 2023 |
g_atomic_int_inc (&_data2_->_ref_count_); |
| 2024 |
return _data2_; |
| 2025 |
} |
| 2026 |
|
| 2027 |
static void |
| 2028 |
block2_data_unref (void * _userdata_) |
| 2029 |
{ |
| 2030 |
Block2Data* _data2_; |
| 2031 |
_data2_ = (Block2Data*) _userdata_; |
| 2032 |
if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) { |
| 2033 |
_g_object_unref0 (_data2_->connection); |
| 2034 |
g_slice_free (Block2Data, _data2_); |
| 2035 |
} |
| 2036 |
} |
| 2037 |
|
| 2038 |
static gboolean |
| 2039 |
__lambda5_ (Block2Data* _data2_) |
| 2040 |
{ |
| 2041 |
gboolean result; |
| 2042 |
_data2_->retval = operate_daemon_with_dbus_kde_real (_data2_->connection, _data2_->verbose); |
| 2043 |
_data2_->id = (guint) 0; |
| 2044 |
result = G_SOURCE_REMOVE; |
| 2045 |
return result; |
| 2046 |
} |
| 2047 |
|
| 2048 |
static gboolean |
| 2049 |
___lambda5__gsource_func (gpointer self) |
| 2050 |
{ |
| 2051 |
gboolean result; |
| 2052 |
result = __lambda5_ (self); |
| 2053 |
return result; |
| 2054 |
} |
| 2055 |
|
| 2056 |
gboolean |
| 2057 |
operate_daemon_with_dbus_kde (GDBusConnection* connection, |
| 2058 |
gboolean start, |
| 2059 |
gboolean verbose) |
| 2060 |
{ |
| 2061 |
Block2Data* _data2_; |
| 2062 |
GDBusConnection* _tmp0_; |
| 2063 |
GSource* source = NULL; |
| 2064 |
GSource* _tmp1_; |
| 2065 |
GSource* _tmp2_; |
| 2066 |
GSource* _tmp3_; |
| 2067 |
GSource* _tmp4_; |
| 2068 |
gboolean result; |
| 2069 |
g_return_val_if_fail (connection != NULL, FALSE); |
| 2070 |
_data2_ = g_slice_new0 (Block2Data); |
| 2071 |
_data2_->_ref_count_ = 1; |
| 2072 |
_tmp0_ = _g_object_ref0 (connection); |
| 2073 |
_g_object_unref0 (_data2_->connection); |
| 2074 |
_data2_->connection = _tmp0_; |
| 2075 |
_data2_->verbose = verbose; |
| 2076 |
if (start) { |
| 2077 |
result = operate_daemon_with_dbus_kde_real (_data2_->connection, _data2_->verbose); |
| 2078 |
block2_data_unref (_data2_); |
| 2079 |
_data2_ = NULL; |
| 2080 |
return result; |
| 2081 |
} |
| 2082 |
_tmp1_ = g_timeout_source_new_seconds ((guint) 1); |
| 2083 |
source = _tmp1_; |
| 2084 |
_tmp2_ = source; |
| 2085 |
g_source_attach (_tmp2_, NULL); |
| 2086 |
_tmp3_ = source; |
| 2087 |
_data2_->id = g_source_get_id (_tmp3_); |
| 2088 |
_data2_->retval = FALSE; |
| 2089 |
_tmp4_ = source; |
| 2090 |
g_source_set_callback (_tmp4_, ___lambda5__gsource_func, block2_data_ref (_data2_), block2_data_unref); |
| 2091 |
while (TRUE) { |
| 2092 |
GMainContext* _tmp5_; |
| 2093 |
if (!(_data2_->id > ((guint) 0))) { |
| 2094 |
break; |
| 2095 |
} |
| 2096 |
_tmp5_ = g_main_context_default (); |
| 2097 |
g_main_context_iteration (_tmp5_, TRUE); |
| 2098 |
} |
| 2099 |
result = _data2_->retval; |
| 2100 |
_g_source_unref0 (source); |
| 2101 |
block2_data_unref (_data2_); |
| 2102 |
_data2_ = NULL; |
| 2103 |
return result; |
| 2104 |
} |
| 2105 |
|
| 2106 |
static void |
| 2107 |
_g_object_unref0_ (gpointer var) |
| 2108 |
{ |
| 2109 |
(var == NULL) ? NULL : (var = (g_object_unref (var), NULL)); |
| 2110 |
} |
| 2111 |
|
| 2112 |
static inline void |
| 2113 |
_g_list_free__g_object_unref0_ (GList* self) |
| 2114 |
{ |
| 2115 |
g_list_free_full (self, (GDestroyNotify) _g_object_unref0_); |
| 2116 |
} |
| 2117 |
|
| 2118 |
static void |
| 2119 |
_g_free0_ (gpointer var) |
| 2120 |
{ |
| 2121 |
var = (g_free (var), NULL); |
| 2122 |
} |
| 2123 |
|
| 2124 |
static void |
| 2125 |
_engine_list_unref0_ (gpointer var) |
| 2126 |
{ |
| 2127 |
(var == NULL) ? NULL : (var = (engine_list_unref (var), NULL)); |
| 2128 |
} |
| 2129 |
|
| 2130 |
static gpointer |
| 2131 |
_engine_list_ref0 (gpointer self) |
| 2132 |
{ |
| 2133 |
return self ? engine_list_ref (self) : NULL; |
| 2134 |
} |
| 2135 |
|
| 2136 |
static void |
| 2137 |
_vala_array_add7 (IBusEngineDesc** * array, |
| 2138 |
gint* length, |
| 2139 |
gint* size, |
| 2140 |
IBusEngineDesc* value) |
| 2141 |
{ |
| 2142 |
if ((*length) == (*size)) { |
| 2143 |
*size = (*size) ? (2 * (*size)) : 4; |
| 2144 |
*array = g_renew (IBusEngineDesc*, *array, (*size) + 1); |
| 2145 |
} |
| 2146 |
(*array)[(*length)++] = value; |
| 2147 |
(*array)[*length] = NULL; |
| 2148 |
} |
| 2149 |
|
| 2150 |
gint |
| 2151 |
list_engine (gchar** argv, |
| 2152 |
gint argv_length1) |
| 2153 |
{ |
| 2154 |
static const GOptionEntry options[2] = {{"name-only", (gchar) 0, (gint) 0, G_OPTION_ARG_NONE, &name_only, N_ ("List engine name only"), NULL}, {NULL}}; |
| 2155 |
GOptionContext* option = NULL; |
| 2156 |
GOptionContext* _tmp0_; |
| 2157 |
GOptionContext* _tmp1_; |
| 2158 |
IBusBus* bus = NULL; |
| 2159 |
IBusBus* _tmp8_; |
| 2160 |
IBusBus* _tmp9_; |
| 2161 |
GList* engines = NULL; |
| 2162 |
IBusBus* _tmp11_; |
| 2163 |
GList* _tmp12_; |
| 2164 |
GHashTable* map = NULL; |
| 2165 |
GHashFunc _tmp17_; |
| 2166 |
GEqualFunc _tmp18_; |
| 2167 |
GHashTable* _tmp19_; |
| 2168 |
GList* _tmp20_; |
| 2169 |
GHashTable* _tmp39_; |
| 2170 |
GList* _tmp40_; |
| 2171 |
GError* _inner_error0_ = NULL; |
| 2172 |
gint result; |
| 2173 |
_tmp0_ = g_option_context_new (NULL); |
| 2174 |
option = _tmp0_; |
| 2175 |
_tmp1_ = option; |
| 2176 |
g_option_context_add_main_entries (_tmp1_, options, GETTEXT_PACKAGE); |
| 2177 |
{ |
| 2178 |
GOptionContext* _tmp2_; |
| 2179 |
_tmp2_ = option; |
| 2180 |
g_option_context_parse (_tmp2_, (gint*) (&argv_length1), &argv, &_inner_error0_); |
| 2181 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 2182 |
gint _tmp3_ = -1; |
| 2183 |
if (_inner_error0_->domain == G_OPTION_ERROR) { |
| 2184 |
goto __catch0_g_option_error; |
| 2185 |
} |
| 2186 |
_g_option_context_free0 (option); |
| 2187 |
g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 2188 |
g_clear_error (&_inner_error0_); |
| 2189 |
return _tmp3_; |
| 2190 |
} |
| 2191 |
} |
| 2192 |
goto __finally0; |
| 2193 |
__catch0_g_option_error: |
| 2194 |
{ |
| 2195 |
GError* e = NULL; |
| 2196 |
FILE* _tmp4_; |
| 2197 |
GError* _tmp5_; |
| 2198 |
const gchar* _tmp6_; |
| 2199 |
e = _inner_error0_; |
| 2200 |
_inner_error0_ = NULL; |
| 2201 |
_tmp4_ = stderr; |
| 2202 |
_tmp5_ = e; |
| 2203 |
_tmp6_ = _tmp5_->message; |
| 2204 |
fprintf (_tmp4_, "%s\n", _tmp6_); |
| 2205 |
result = EXIT_FAILURE; |
| 2206 |
_g_error_free0 (e); |
| 2207 |
_g_option_context_free0 (option); |
| 2208 |
return result; |
| 2209 |
} |
| 2210 |
__finally0: |
| 2211 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 2212 |
gint _tmp7_ = -1; |
| 2213 |
_g_option_context_free0 (option); |
| 2214 |
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 2215 |
g_clear_error (&_inner_error0_); |
| 2216 |
return _tmp7_; |
| 2217 |
} |
| 2218 |
_tmp8_ = get_bus (); |
| 2219 |
bus = _tmp8_; |
| 2220 |
_tmp9_ = bus; |
| 2221 |
if (_tmp9_ == NULL) { |
| 2222 |
FILE* _tmp10_; |
| 2223 |
_tmp10_ = stderr; |
| 2224 |
fprintf (_tmp10_, "%s", _ ("Can't connect to IBus.\n")); |
| 2225 |
result = EXIT_FAILURE; |
| 2226 |
_g_object_unref0 (bus); |
| 2227 |
_g_option_context_free0 (option); |
| 2228 |
return result; |
| 2229 |
} |
| 2230 |
_tmp11_ = bus; |
| 2231 |
_tmp12_ = ibus_bus_list_engines (_tmp11_); |
| 2232 |
engines = _tmp12_; |
| 2233 |
if (name_only) { |
| 2234 |
GList* _tmp13_; |
| 2235 |
_tmp13_ = engines; |
| 2236 |
{ |
| 2237 |
GList* engine_collection = NULL; |
| 2238 |
GList* engine_it = NULL; |
| 2239 |
engine_collection = _tmp13_; |
| 2240 |
for (engine_it = engine_collection; engine_it != NULL; engine_it = engine_it->next) { |
| 2241 |
IBusEngineDesc* _tmp14_; |
| 2242 |
IBusEngineDesc* engine = NULL; |
| 2243 |
_tmp14_ = _g_object_ref0 ((IBusEngineDesc*) engine_it->data); |
| 2244 |
engine = _tmp14_; |
| 2245 |
{ |
| 2246 |
IBusEngineDesc* _tmp15_; |
| 2247 |
const gchar* _tmp16_; |
| 2248 |
_tmp15_ = engine; |
| 2249 |
_tmp16_ = ibus_engine_desc_get_name (_tmp15_); |
| 2250 |
g_print ("%s\n", _tmp16_); |
| 2251 |
_g_object_unref0 (engine); |
| 2252 |
} |
| 2253 |
} |
| 2254 |
} |
| 2255 |
result = EXIT_SUCCESS; |
| 2256 |
(engines == NULL) ? NULL : (engines = (_g_list_free__g_object_unref0_ (engines), NULL)); |
| 2257 |
_g_object_unref0 (bus); |
| 2258 |
_g_option_context_free0 (option); |
| 2259 |
return result; |
| 2260 |
} |
| 2261 |
_tmp17_ = g_str_hash; |
| 2262 |
_tmp18_ = g_str_equal; |
| 2263 |
_tmp19_ = g_hash_table_new_full (_tmp17_, _tmp18_, _g_free0_, _engine_list_unref0_); |
| 2264 |
map = _tmp19_; |
| 2265 |
_tmp20_ = engines; |
| 2266 |
{ |
| 2267 |
GList* engine_collection = NULL; |
| 2268 |
GList* engine_it = NULL; |
| 2269 |
engine_collection = _tmp20_; |
| 2270 |
for (engine_it = engine_collection; engine_it != NULL; engine_it = engine_it->next) { |
| 2271 |
IBusEngineDesc* _tmp21_; |
| 2272 |
IBusEngineDesc* engine = NULL; |
| 2273 |
_tmp21_ = _g_object_ref0 ((IBusEngineDesc*) engine_it->data); |
| 2274 |
engine = _tmp21_; |
| 2275 |
{ |
| 2276 |
EngineList* list = NULL; |
| 2277 |
GHashTable* _tmp22_; |
| 2278 |
IBusEngineDesc* _tmp23_; |
| 2279 |
const gchar* _tmp24_; |
| 2280 |
gconstpointer _tmp25_; |
| 2281 |
EngineList* _tmp26_; |
| 2282 |
EngineList* _tmp27_; |
| 2283 |
EngineList* _tmp35_; |
| 2284 |
EngineList* _tmp36_; |
| 2285 |
IBusEngineDesc* _tmp37_; |
| 2286 |
IBusEngineDesc* _tmp38_; |
| 2287 |
_tmp22_ = map; |
| 2288 |
_tmp23_ = engine; |
| 2289 |
_tmp24_ = ibus_engine_desc_get_language (_tmp23_); |
| 2290 |
_tmp25_ = g_hash_table_lookup (_tmp22_, _tmp24_); |
| 2291 |
_tmp26_ = _engine_list_ref0 ((EngineList*) _tmp25_); |
| 2292 |
list = _tmp26_; |
| 2293 |
_tmp27_ = list; |
| 2294 |
if (_tmp27_ == NULL) { |
| 2295 |
EngineList* _tmp28_; |
| 2296 |
GHashTable* _tmp29_; |
| 2297 |
IBusEngineDesc* _tmp30_; |
| 2298 |
const gchar* _tmp31_; |
| 2299 |
gchar* _tmp32_; |
| 2300 |
EngineList* _tmp33_; |
| 2301 |
EngineList* _tmp34_; |
| 2302 |
_tmp28_ = engine_list_new (); |
| 2303 |
_engine_list_unref0 (list); |
| 2304 |
list = _tmp28_; |
| 2305 |
_tmp29_ = map; |
| 2306 |
_tmp30_ = engine; |
| 2307 |
_tmp31_ = ibus_engine_desc_get_language (_tmp30_); |
| 2308 |
_tmp32_ = g_strdup (_tmp31_); |
| 2309 |
_tmp33_ = list; |
| 2310 |
_tmp34_ = _engine_list_ref0 (_tmp33_); |
| 2311 |
g_hash_table_insert (_tmp29_, _tmp32_, _tmp34_); |
| 2312 |
} |
| 2313 |
_tmp35_ = list; |
| 2314 |
_tmp36_ = list; |
| 2315 |
_tmp37_ = engine; |
| 2316 |
_tmp38_ = _g_object_ref0 (_tmp37_); |
| 2317 |
_vala_array_add7 (&_tmp35_->data, &_tmp35_->data_length1, &_tmp35_->_data_size_, _tmp38_); |
| 2318 |
_engine_list_unref0 (list); |
| 2319 |
_g_object_unref0 (engine); |
| 2320 |
} |
| 2321 |
} |
| 2322 |
} |
| 2323 |
_tmp39_ = map; |
| 2324 |
_tmp40_ = g_hash_table_get_keys (_tmp39_); |
| 2325 |
{ |
| 2326 |
GList* language_collection = NULL; |
| 2327 |
GList* language_it = NULL; |
| 2328 |
language_collection = _tmp40_; |
| 2329 |
for (language_it = language_collection; language_it != NULL; language_it = language_it->next) { |
| 2330 |
const gchar* language = NULL; |
| 2331 |
language = (const gchar*) language_it->data; |
| 2332 |
{ |
| 2333 |
EngineList* list = NULL; |
| 2334 |
GHashTable* _tmp41_; |
| 2335 |
const gchar* _tmp42_; |
| 2336 |
gconstpointer _tmp43_; |
| 2337 |
EngineList* _tmp44_; |
| 2338 |
const gchar* _tmp45_; |
| 2339 |
gchar* _tmp46_; |
| 2340 |
gchar* _tmp47_; |
| 2341 |
EngineList* _tmp48_; |
| 2342 |
IBusEngineDesc** _tmp49_; |
| 2343 |
gint _tmp49__length1; |
| 2344 |
_tmp41_ = map; |
| 2345 |
_tmp42_ = language; |
| 2346 |
_tmp43_ = g_hash_table_lookup (_tmp41_, _tmp42_); |
| 2347 |
_tmp44_ = _engine_list_ref0 ((EngineList*) _tmp43_); |
| 2348 |
list = _tmp44_; |
| 2349 |
_tmp45_ = language; |
| 2350 |
_tmp46_ = ibus_get_language_name (_tmp45_); |
| 2351 |
_tmp47_ = _tmp46_; |
| 2352 |
g_print (_ ("language: %s\n"), _tmp47_); |
| 2353 |
_g_free0 (_tmp47_); |
| 2354 |
_tmp48_ = list; |
| 2355 |
_tmp49_ = _tmp48_->data; |
| 2356 |
_tmp49__length1 = _tmp48_->data_length1; |
| 2357 |
{ |
| 2358 |
IBusEngineDesc** engine_collection = NULL; |
| 2359 |
gint engine_collection_length1 = 0; |
| 2360 |
gint _engine_collection_size_ = 0; |
| 2361 |
gint engine_it = 0; |
| 2362 |
engine_collection = _tmp49_; |
| 2363 |
engine_collection_length1 = _tmp49__length1; |
| 2364 |
for (engine_it = 0; engine_it < engine_collection_length1; engine_it = engine_it + 1) { |
| 2365 |
IBusEngineDesc* _tmp50_; |
| 2366 |
IBusEngineDesc* engine = NULL; |
| 2367 |
_tmp50_ = _g_object_ref0 (engine_collection[engine_it]); |
| 2368 |
engine = _tmp50_; |
| 2369 |
{ |
| 2370 |
IBusEngineDesc* _tmp51_; |
| 2371 |
const gchar* _tmp52_; |
| 2372 |
IBusEngineDesc* _tmp53_; |
| 2373 |
const gchar* _tmp54_; |
| 2374 |
_tmp51_ = engine; |
| 2375 |
_tmp52_ = ibus_engine_desc_get_name (_tmp51_); |
| 2376 |
_tmp53_ = engine; |
| 2377 |
_tmp54_ = ibus_engine_desc_get_longname (_tmp53_); |
| 2378 |
g_print (" %s - %s\n", _tmp52_, _tmp54_); |
| 2379 |
_g_object_unref0 (engine); |
| 2380 |
} |
| 2381 |
} |
| 2382 |
} |
| 2383 |
_engine_list_unref0 (list); |
| 2384 |
} |
| 2385 |
} |
| 2386 |
(language_collection == NULL) ? NULL : (language_collection = (g_list_free (language_collection), NULL)); |
| 2387 |
} |
| 2388 |
result = EXIT_SUCCESS; |
| 2389 |
_g_hash_table_unref0 (map); |
| 2390 |
(engines == NULL) ? NULL : (engines = (_g_list_free__g_object_unref0_ (engines), NULL)); |
| 2391 |
_g_object_unref0 (bus); |
| 2392 |
_g_option_context_free0 (option); |
| 2393 |
return result; |
| 2394 |
} |
| 2395 |
|
| 2396 |
static void |
| 2397 |
_vala_array_add8 (gchar** * array, |
| 2398 |
gint* length, |
| 2399 |
gint* size, |
| 2400 |
gchar* value) |
| 2401 |
{ |
| 2402 |
if ((*length) == (*size)) { |
| 2403 |
*size = (*size) ? (2 * (*size)) : 4; |
| 2404 |
*array = g_renew (gchar*, *array, (*size) + 1); |
| 2405 |
} |
| 2406 |
(*array)[(*length)++] = value; |
| 2407 |
(*array)[*length] = NULL; |
| 2408 |
} |
| 2409 |
|
| 2410 |
static void |
| 2411 |
_vala_array_add9 (gchar** * array, |
| 2412 |
gint* length, |
| 2413 |
gint* size, |
| 2414 |
gchar* value) |
| 2415 |
{ |
| 2416 |
if ((*length) == (*size)) { |
| 2417 |
*size = (*size) ? (2 * (*size)) : 4; |
| 2418 |
*array = g_renew (gchar*, *array, (*size) + 1); |
| 2419 |
} |
| 2420 |
(*array)[(*length)++] = value; |
| 2421 |
(*array)[*length] = NULL; |
| 2422 |
} |
| 2423 |
|
| 2424 |
static void |
| 2425 |
_vala_array_add10 (gchar** * array, |
| 2426 |
gint* length, |
| 2427 |
gint* size, |
| 2428 |
gchar* value) |
| 2429 |
{ |
| 2430 |
if ((*length) == (*size)) { |
| 2431 |
*size = (*size) ? (2 * (*size)) : 4; |
| 2432 |
*array = g_renew (gchar*, *array, (*size) + 1); |
| 2433 |
} |
| 2434 |
(*array)[(*length)++] = value; |
| 2435 |
(*array)[*length] = NULL; |
| 2436 |
} |
| 2437 |
|
| 2438 |
static void |
| 2439 |
_vala_array_add11 (gchar** * array, |
| 2440 |
gint* length, |
| 2441 |
gint* size, |
| 2442 |
gchar* value) |
| 2443 |
{ |
| 2444 |
if ((*length) == (*size)) { |
| 2445 |
*size = (*size) ? (2 * (*size)) : 4; |
| 2446 |
*array = g_renew (gchar*, *array, (*size) + 1); |
| 2447 |
} |
| 2448 |
(*array)[(*length)++] = value; |
| 2449 |
(*array)[*length] = NULL; |
| 2450 |
} |
| 2451 |
|
| 2452 |
static void |
| 2453 |
_vala_array_add12 (gchar** * array, |
| 2454 |
gint* length, |
| 2455 |
gint* size, |
| 2456 |
gchar* value) |
| 2457 |
{ |
| 2458 |
if ((*length) == (*size)) { |
| 2459 |
*size = (*size) ? (2 * (*size)) : 4; |
| 2460 |
*array = g_renew (gchar*, *array, (*size) + 1); |
| 2461 |
} |
| 2462 |
(*array)[(*length)++] = value; |
| 2463 |
(*array)[*length] = NULL; |
| 2464 |
} |
| 2465 |
|
| 2466 |
static void |
| 2467 |
_vala_array_add13 (gchar** * array, |
| 2468 |
gint* length, |
| 2469 |
gint* size, |
| 2470 |
gchar* value) |
| 2471 |
{ |
| 2472 |
if ((*length) == (*size)) { |
| 2473 |
*size = (*size) ? (2 * (*size)) : 4; |
| 2474 |
*array = g_renew (gchar*, *array, (*size) + 1); |
| 2475 |
} |
| 2476 |
(*array)[(*length)++] = value; |
| 2477 |
(*array)[*length] = NULL; |
| 2478 |
} |
| 2479 |
|
| 2480 |
static void |
| 2481 |
_vala_array_add14 (gchar** * array, |
| 2482 |
gint* length, |
| 2483 |
gint* size, |
| 2484 |
gchar* value) |
| 2485 |
{ |
| 2486 |
if ((*length) == (*size)) { |
| 2487 |
*size = (*size) ? (2 * (*size)) : 4; |
| 2488 |
*array = g_renew (gchar*, *array, (*size) + 1); |
| 2489 |
} |
| 2490 |
(*array)[(*length)++] = value; |
| 2491 |
(*array)[*length] = NULL; |
| 2492 |
} |
| 2493 |
|
| 2494 |
gint |
| 2495 |
exec_setxkbmap (IBusEngineDesc* engine) |
| 2496 |
{ |
| 2497 |
gchar* layout = NULL; |
| 2498 |
const gchar* _tmp0_; |
| 2499 |
gchar* _tmp1_; |
| 2500 |
gchar* variant = NULL; |
| 2501 |
const gchar* _tmp2_; |
| 2502 |
gchar* _tmp3_; |
| 2503 |
gchar* option = NULL; |
| 2504 |
const gchar* _tmp4_; |
| 2505 |
gchar* _tmp5_; |
| 2506 |
gchar* standard_error = NULL; |
| 2507 |
gint exit_status = 0; |
| 2508 |
gchar** args = NULL; |
| 2509 |
gchar* _tmp6_; |
| 2510 |
gchar** _tmp7_; |
| 2511 |
gint args_length1; |
| 2512 |
gint _args_size_; |
| 2513 |
gboolean _tmp8_ = FALSE; |
| 2514 |
gboolean _tmp9_ = FALSE; |
| 2515 |
const gchar* _tmp10_; |
| 2516 |
gboolean _tmp16_ = FALSE; |
| 2517 |
gboolean _tmp17_ = FALSE; |
| 2518 |
const gchar* _tmp18_; |
| 2519 |
gboolean _tmp24_ = FALSE; |
| 2520 |
gboolean _tmp25_ = FALSE; |
| 2521 |
const gchar* _tmp26_; |
| 2522 |
gchar** _tmp33_; |
| 2523 |
gint _tmp33__length1; |
| 2524 |
GError* _inner_error0_ = NULL; |
| 2525 |
gint result; |
| 2526 |
g_return_val_if_fail (engine != NULL, -1); |
| 2527 |
_tmp0_ = ibus_engine_desc_get_layout (engine); |
| 2528 |
_tmp1_ = g_strdup (_tmp0_); |
| 2529 |
layout = _tmp1_; |
| 2530 |
_tmp2_ = ibus_engine_desc_get_layout_variant (engine); |
| 2531 |
_tmp3_ = g_strdup (_tmp2_); |
| 2532 |
variant = _tmp3_; |
| 2533 |
_tmp4_ = ibus_engine_desc_get_layout_option (engine); |
| 2534 |
_tmp5_ = g_strdup (_tmp4_); |
| 2535 |
option = _tmp5_; |
| 2536 |
standard_error = NULL; |
| 2537 |
exit_status = 0; |
| 2538 |
_tmp6_ = g_strdup ("setxkbmap"); |
| 2539 |
_tmp7_ = g_new0 (gchar*, 1 + 1); |
| 2540 |
_tmp7_[0] = _tmp6_; |
| 2541 |
args = _tmp7_; |
| 2542 |
args_length1 = 1; |
| 2543 |
_args_size_ = args_length1; |
| 2544 |
_tmp10_ = layout; |
| 2545 |
if (_tmp10_ != NULL) { |
| 2546 |
const gchar* _tmp11_; |
| 2547 |
_tmp11_ = layout; |
| 2548 |
_tmp9_ = g_strcmp0 (_tmp11_, "") != 0; |
| 2549 |
} else { |
| 2550 |
_tmp9_ = FALSE; |
| 2551 |
} |
| 2552 |
if (_tmp9_) { |
| 2553 |
const gchar* _tmp12_; |
| 2554 |
_tmp12_ = layout; |
| 2555 |
_tmp8_ = g_strcmp0 (_tmp12_, "default") != 0; |
| 2556 |
} else { |
| 2557 |
_tmp8_ = FALSE; |
| 2558 |
} |
| 2559 |
if (_tmp8_) { |
| 2560 |
gchar* _tmp13_; |
| 2561 |
const gchar* _tmp14_; |
| 2562 |
gchar* _tmp15_; |
| 2563 |
_tmp13_ = g_strdup ("-layout"); |
| 2564 |
_vala_array_add8 (&args, &args_length1, &_args_size_, _tmp13_); |
| 2565 |
_tmp14_ = layout; |
| 2566 |
_tmp15_ = g_strdup (_tmp14_); |
| 2567 |
_vala_array_add9 (&args, &args_length1, &_args_size_, _tmp15_); |
| 2568 |
} |
| 2569 |
_tmp18_ = variant; |
| 2570 |
if (_tmp18_ != NULL) { |
| 2571 |
const gchar* _tmp19_; |
| 2572 |
_tmp19_ = variant; |
| 2573 |
_tmp17_ = g_strcmp0 (_tmp19_, "") != 0; |
| 2574 |
} else { |
| 2575 |
_tmp17_ = FALSE; |
| 2576 |
} |
| 2577 |
if (_tmp17_) { |
| 2578 |
const gchar* _tmp20_; |
| 2579 |
_tmp20_ = variant; |
| 2580 |
_tmp16_ = g_strcmp0 (_tmp20_, "default") != 0; |
| 2581 |
} else { |
| 2582 |
_tmp16_ = FALSE; |
| 2583 |
} |
| 2584 |
if (_tmp16_) { |
| 2585 |
gchar* _tmp21_; |
| 2586 |
const gchar* _tmp22_; |
| 2587 |
gchar* _tmp23_; |
| 2588 |
_tmp21_ = g_strdup ("-variant"); |
| 2589 |
_vala_array_add10 (&args, &args_length1, &_args_size_, _tmp21_); |
| 2590 |
_tmp22_ = variant; |
| 2591 |
_tmp23_ = g_strdup (_tmp22_); |
| 2592 |
_vala_array_add11 (&args, &args_length1, &_args_size_, _tmp23_); |
| 2593 |
} |
| 2594 |
_tmp26_ = option; |
| 2595 |
if (_tmp26_ != NULL) { |
| 2596 |
const gchar* _tmp27_; |
| 2597 |
_tmp27_ = option; |
| 2598 |
_tmp25_ = g_strcmp0 (_tmp27_, "") != 0; |
| 2599 |
} else { |
| 2600 |
_tmp25_ = FALSE; |
| 2601 |
} |
| 2602 |
if (_tmp25_) { |
| 2603 |
const gchar* _tmp28_; |
| 2604 |
_tmp28_ = option; |
| 2605 |
_tmp24_ = g_strcmp0 (_tmp28_, "default") != 0; |
| 2606 |
} else { |
| 2607 |
_tmp24_ = FALSE; |
| 2608 |
} |
| 2609 |
if (_tmp24_) { |
| 2610 |
gchar* _tmp29_; |
| 2611 |
gchar* _tmp30_; |
| 2612 |
const gchar* _tmp31_; |
| 2613 |
gchar* _tmp32_; |
| 2614 |
_tmp29_ = g_strdup ("-option"); |
| 2615 |
_vala_array_add12 (&args, &args_length1, &_args_size_, _tmp29_); |
| 2616 |
_tmp30_ = g_strdup ("-option"); |
| 2617 |
_vala_array_add13 (&args, &args_length1, &_args_size_, _tmp30_); |
| 2618 |
_tmp31_ = option; |
| 2619 |
_tmp32_ = g_strdup (_tmp31_); |
| 2620 |
_vala_array_add14 (&args, &args_length1, &_args_size_, _tmp32_); |
| 2621 |
} |
| 2622 |
_tmp33_ = args; |
| 2623 |
_tmp33__length1 = args_length1; |
| 2624 |
if (_tmp33__length1 == 1) { |
| 2625 |
result = EXIT_FAILURE; |
| 2626 |
args = (_vala_array_free (args, args_length1, (GDestroyNotify) g_free), NULL); |
| 2627 |
_g_free0 (standard_error); |
| 2628 |
_g_free0 (option); |
| 2629 |
_g_free0 (variant); |
| 2630 |
_g_free0 (layout); |
| 2631 |
return result; |
| 2632 |
} |
| 2633 |
{ |
| 2634 |
gboolean _tmp34_ = FALSE; |
| 2635 |
gchar** _tmp35_; |
| 2636 |
gint _tmp35__length1; |
| 2637 |
gchar* _tmp36_ = NULL; |
| 2638 |
gint _tmp37_ = 0; |
| 2639 |
gboolean _tmp38_; |
| 2640 |
_tmp35_ = args; |
| 2641 |
_tmp35__length1 = args_length1; |
| 2642 |
_tmp38_ = g_spawn_sync (NULL, _tmp35_, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &_tmp36_, &_tmp37_, &_inner_error0_); |
| 2643 |
_g_free0 (standard_error); |
| 2644 |
standard_error = _tmp36_; |
| 2645 |
exit_status = _tmp37_; |
| 2646 |
_tmp34_ = _tmp38_; |
| 2647 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 2648 |
gint _tmp39_ = -1; |
| 2649 |
if (_inner_error0_->domain == G_SPAWN_ERROR) { |
| 2650 |
goto __catch0_g_spawn_error; |
| 2651 |
} |
| 2652 |
args = (_vala_array_free (args, args_length1, (GDestroyNotify) g_free), NULL); |
| 2653 |
_g_free0 (standard_error); |
| 2654 |
_g_free0 (option); |
| 2655 |
_g_free0 (variant); |
| 2656 |
_g_free0 (layout); |
| 2657 |
g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 2658 |
g_clear_error (&_inner_error0_); |
| 2659 |
return _tmp39_; |
| 2660 |
} |
| 2661 |
if (!_tmp34_) { |
| 2662 |
const gchar* _tmp40_; |
| 2663 |
_tmp40_ = ibus_engine_desc_get_layout (engine); |
| 2664 |
g_warning ("main.vala:531: Switch xkb layout to %s failed.", _tmp40_); |
| 2665 |
result = EXIT_FAILURE; |
| 2666 |
args = (_vala_array_free (args, args_length1, (GDestroyNotify) g_free), NULL); |
| 2667 |
_g_free0 (standard_error); |
| 2668 |
_g_free0 (option); |
| 2669 |
_g_free0 (variant); |
| 2670 |
_g_free0 (layout); |
| 2671 |
return result; |
| 2672 |
} |
| 2673 |
} |
| 2674 |
goto __finally0; |
| 2675 |
__catch0_g_spawn_error: |
| 2676 |
{ |
| 2677 |
GError* e = NULL; |
| 2678 |
GError* _tmp41_; |
| 2679 |
const gchar* _tmp42_; |
| 2680 |
e = _inner_error0_; |
| 2681 |
_inner_error0_ = NULL; |
| 2682 |
_tmp41_ = e; |
| 2683 |
_tmp42_ = _tmp41_->message; |
| 2684 |
g_warning ("main.vala:536: Execute setxkbmap failed: %s", _tmp42_); |
| 2685 |
result = EXIT_FAILURE; |
| 2686 |
_g_error_free0 (e); |
| 2687 |
args = (_vala_array_free (args, args_length1, (GDestroyNotify) g_free), NULL); |
| 2688 |
_g_free0 (standard_error); |
| 2689 |
_g_free0 (option); |
| 2690 |
_g_free0 (variant); |
| 2691 |
_g_free0 (layout); |
| 2692 |
return result; |
| 2693 |
} |
| 2694 |
__finally0: |
| 2695 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 2696 |
gint _tmp43_ = -1; |
| 2697 |
args = (_vala_array_free (args, args_length1, (GDestroyNotify) g_free), NULL); |
| 2698 |
_g_free0 (standard_error); |
| 2699 |
_g_free0 (option); |
| 2700 |
_g_free0 (variant); |
| 2701 |
_g_free0 (layout); |
| 2702 |
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 2703 |
g_clear_error (&_inner_error0_); |
| 2704 |
return _tmp43_; |
| 2705 |
} |
| 2706 |
if (exit_status != 0) { |
| 2707 |
const gchar* _tmp44_ = NULL; |
| 2708 |
const gchar* _tmp45_; |
| 2709 |
_tmp45_ = standard_error; |
| 2710 |
_tmp44_ = _tmp45_; |
| 2711 |
if (_tmp44_ == NULL) { |
| 2712 |
_tmp44_ = "(null)"; |
| 2713 |
} |
| 2714 |
g_warning ("main.vala:541: Execute setxkbmap failed: %s", _tmp44_); |
| 2715 |
result = EXIT_FAILURE; |
| 2716 |
args = (_vala_array_free (args, args_length1, (GDestroyNotify) g_free), NULL); |
| 2717 |
_g_free0 (standard_error); |
| 2718 |
_g_free0 (option); |
| 2719 |
_g_free0 (variant); |
| 2720 |
_g_free0 (layout); |
| 2721 |
return result; |
| 2722 |
} |
| 2723 |
result = EXIT_SUCCESS; |
| 2724 |
args = (_vala_array_free (args, args_length1, (GDestroyNotify) g_free), NULL); |
| 2725 |
_g_free0 (standard_error); |
| 2726 |
_g_free0 (option); |
| 2727 |
_g_free0 (variant); |
| 2728 |
_g_free0 (layout); |
| 2729 |
return result; |
| 2730 |
} |
| 2731 |
|
| 2732 |
gint |
| 2733 |
get_set_engine (gchar** argv, |
| 2734 |
gint argv_length1) |
| 2735 |
{ |
| 2736 |
IBusBus* bus = NULL; |
| 2737 |
IBusBus* _tmp0_; |
| 2738 |
gchar* engine = NULL; |
| 2739 |
const gchar* _tmp3_; |
| 2740 |
IBusBus* _tmp10_; |
| 2741 |
const gchar* _tmp11_; |
| 2742 |
IBusEngineDesc* desc = NULL; |
| 2743 |
IBusBus* _tmp13_; |
| 2744 |
IBusEngineDesc* _tmp14_; |
| 2745 |
IBusEngineDesc* _tmp15_; |
| 2746 |
GSettings* settings = NULL; |
| 2747 |
GSettings* _tmp17_; |
| 2748 |
GSettings* _tmp18_; |
| 2749 |
gint result; |
| 2750 |
_tmp0_ = get_bus (); |
| 2751 |
bus = _tmp0_; |
| 2752 |
engine = NULL; |
| 2753 |
if (argv_length1 > 1) { |
| 2754 |
const gchar* _tmp1_; |
| 2755 |
gchar* _tmp2_; |
| 2756 |
_tmp1_ = argv[1]; |
| 2757 |
_tmp2_ = g_strdup (_tmp1_); |
| 2758 |
_g_free0 (engine); |
| 2759 |
engine = _tmp2_; |
| 2760 |
} |
| 2761 |
_tmp3_ = engine; |
| 2762 |
if (_tmp3_ == NULL) { |
| 2763 |
IBusEngineDesc* desc = NULL; |
| 2764 |
IBusBus* _tmp4_; |
| 2765 |
IBusEngineDesc* _tmp5_; |
| 2766 |
IBusEngineDesc* _tmp6_; |
| 2767 |
IBusEngineDesc* _tmp8_; |
| 2768 |
const gchar* _tmp9_; |
| 2769 |
_tmp4_ = bus; |
| 2770 |
_tmp5_ = ibus_bus_get_global_engine (_tmp4_); |
| 2771 |
desc = _tmp5_; |
| 2772 |
_tmp6_ = desc; |
| 2773 |
if (_tmp6_ == NULL) { |
| 2774 |
FILE* _tmp7_; |
| 2775 |
_tmp7_ = stderr; |
| 2776 |
fprintf (_tmp7_, "%s", _ ("No engine is set.\n")); |
| 2777 |
result = EXIT_FAILURE; |
| 2778 |
_g_object_unref0 (desc); |
| 2779 |
_g_free0 (engine); |
| 2780 |
_g_object_unref0 (bus); |
| 2781 |
return result; |
| 2782 |
} |
| 2783 |
_tmp8_ = desc; |
| 2784 |
_tmp9_ = ibus_engine_desc_get_name (_tmp8_); |
| 2785 |
g_print ("%s\n", _tmp9_); |
| 2786 |
result = EXIT_SUCCESS; |
| 2787 |
_g_object_unref0 (desc); |
| 2788 |
_g_free0 (engine); |
| 2789 |
_g_object_unref0 (bus); |
| 2790 |
return result; |
| 2791 |
} |
| 2792 |
_tmp10_ = bus; |
| 2793 |
_tmp11_ = engine; |
| 2794 |
if (!ibus_bus_set_global_engine (_tmp10_, _tmp11_)) { |
| 2795 |
FILE* _tmp12_; |
| 2796 |
_tmp12_ = stderr; |
| 2797 |
fprintf (_tmp12_, "%s", _ ("Set global engine failed.\n")); |
| 2798 |
result = EXIT_FAILURE; |
| 2799 |
_g_free0 (engine); |
| 2800 |
_g_object_unref0 (bus); |
| 2801 |
return result; |
| 2802 |
} |
| 2803 |
_tmp13_ = bus; |
| 2804 |
_tmp14_ = ibus_bus_get_global_engine (_tmp13_); |
| 2805 |
desc = _tmp14_; |
| 2806 |
_tmp15_ = desc; |
| 2807 |
if (_tmp15_ == NULL) { |
| 2808 |
FILE* _tmp16_; |
| 2809 |
_tmp16_ = stderr; |
| 2810 |
fprintf (_tmp16_, "%s", _ ("Get global engine failed.\n")); |
| 2811 |
result = EXIT_FAILURE; |
| 2812 |
_g_object_unref0 (desc); |
| 2813 |
_g_free0 (engine); |
| 2814 |
_g_object_unref0 (bus); |
| 2815 |
return result; |
| 2816 |
} |
| 2817 |
_tmp17_ = g_settings_new (IBUS_SCHEMAS_GENERAL); |
| 2818 |
settings = _tmp17_; |
| 2819 |
_tmp18_ = settings; |
| 2820 |
if (!g_settings_get_boolean (_tmp18_, "use-system-keyboard-layout")) { |
| 2821 |
IBusEngineDesc* _tmp19_; |
| 2822 |
_tmp19_ = desc; |
| 2823 |
result = exec_setxkbmap (_tmp19_); |
| 2824 |
_g_object_unref0 (settings); |
| 2825 |
_g_object_unref0 (desc); |
| 2826 |
_g_free0 (engine); |
| 2827 |
_g_object_unref0 (bus); |
| 2828 |
return result; |
| 2829 |
} |
| 2830 |
result = EXIT_SUCCESS; |
| 2831 |
_g_object_unref0 (settings); |
| 2832 |
_g_object_unref0 (desc); |
| 2833 |
_g_free0 (engine); |
| 2834 |
_g_object_unref0 (bus); |
| 2835 |
return result; |
| 2836 |
} |
| 2837 |
|
| 2838 |
gint |
| 2839 |
message_watch (gchar** argv, |
| 2840 |
gint argv_length1) |
| 2841 |
{ |
| 2842 |
gint result; |
| 2843 |
result = EXIT_SUCCESS; |
| 2844 |
return result; |
| 2845 |
} |
| 2846 |
|
| 2847 |
gboolean |
| 2848 |
operate_daemon_in_kde_wayland (GDBusConnection* connection, |
| 2849 |
gboolean start, |
| 2850 |
gboolean verbose) |
| 2851 |
{ |
| 2852 |
const gchar* _tmp0_; |
| 2853 |
gchar* kwinrc = NULL; |
| 2854 |
const gchar* _tmp2_; |
| 2855 |
gchar* _tmp3_; |
| 2856 |
KRcFile* key_file = NULL; |
| 2857 |
KRcFile* _tmp4_; |
| 2858 |
GError* _inner_error0_ = NULL; |
| 2859 |
gboolean result; |
| 2860 |
g_return_val_if_fail (connection != NULL, FALSE); |
| 2861 |
if (!is_kde (verbose)) { |
| 2862 |
result = FALSE; |
| 2863 |
return result; |
| 2864 |
} |
| 2865 |
_tmp0_ = g_getenv ("WAYLAND_DISPLAY"); |
| 2866 |
if (_tmp0_ == NULL) { |
| 2867 |
if (verbose) { |
| 2868 |
FILE* _tmp1_; |
| 2869 |
_tmp1_ = stderr; |
| 2870 |
fprintf (_tmp1_, "Your KDE session is not Wayland\n."); |
| 2871 |
} |
| 2872 |
result = FALSE; |
| 2873 |
return result; |
| 2874 |
} |
| 2875 |
_tmp2_ = g_get_user_config_dir (); |
| 2876 |
_tmp3_ = g_build_filename (_tmp2_, "kwinrc", NULL); |
| 2877 |
kwinrc = _tmp3_; |
| 2878 |
_tmp4_ = krc_file_new (); |
| 2879 |
key_file = _tmp4_; |
| 2880 |
{ |
| 2881 |
KRcFile* _tmp5_; |
| 2882 |
const gchar* _tmp6_; |
| 2883 |
_tmp5_ = key_file; |
| 2884 |
_tmp6_ = kwinrc; |
| 2885 |
krc_file_load_from_file (_tmp5_, _tmp6_, G_KEY_FILE_KEEP_COMMENTS, &_inner_error0_); |
| 2886 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 2887 |
gboolean _tmp7_ = FALSE; |
| 2888 |
if (_inner_error0_->domain == G_KEY_FILE_ERROR) { |
| 2889 |
goto __catch0_g_key_file_error; |
| 2890 |
} |
| 2891 |
if (_inner_error0_->domain == G_FILE_ERROR) { |
| 2892 |
goto __catch0_g_file_error; |
| 2893 |
} |
| 2894 |
_krc_file_unref0 (key_file); |
| 2895 |
_g_free0 (kwinrc); |
| 2896 |
g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 2897 |
g_clear_error (&_inner_error0_); |
| 2898 |
return _tmp7_; |
| 2899 |
} |
| 2900 |
} |
| 2901 |
goto __finally0; |
| 2902 |
__catch0_g_key_file_error: |
| 2903 |
{ |
| 2904 |
GError* e = NULL; |
| 2905 |
FILE* _tmp8_; |
| 2906 |
const gchar* _tmp9_; |
| 2907 |
GError* _tmp10_; |
| 2908 |
const gchar* _tmp11_; |
| 2909 |
e = _inner_error0_; |
| 2910 |
_inner_error0_ = NULL; |
| 2911 |
_tmp8_ = stderr; |
| 2912 |
_tmp9_ = kwinrc; |
| 2913 |
_tmp10_ = e; |
| 2914 |
_tmp11_ = _tmp10_->message; |
| 2915 |
fprintf (_tmp8_, "Error in %s: %s\n", _tmp9_, _tmp11_); |
| 2916 |
result = FALSE; |
| 2917 |
_g_error_free0 (e); |
| 2918 |
_krc_file_unref0 (key_file); |
| 2919 |
_g_free0 (kwinrc); |
| 2920 |
return result; |
| 2921 |
} |
| 2922 |
goto __finally0; |
| 2923 |
__catch0_g_file_error: |
| 2924 |
{ |
| 2925 |
GError* e = NULL; |
| 2926 |
FILE* _tmp12_; |
| 2927 |
const gchar* _tmp13_; |
| 2928 |
GError* _tmp14_; |
| 2929 |
const gchar* _tmp15_; |
| 2930 |
e = _inner_error0_; |
| 2931 |
_inner_error0_ = NULL; |
| 2932 |
_tmp12_ = stderr; |
| 2933 |
_tmp13_ = kwinrc; |
| 2934 |
_tmp14_ = e; |
| 2935 |
_tmp15_ = _tmp14_->message; |
| 2936 |
fprintf (_tmp12_, "Error in %s: %s\n", _tmp13_, _tmp15_); |
| 2937 |
result = FALSE; |
| 2938 |
_g_error_free0 (e); |
| 2939 |
_krc_file_unref0 (key_file); |
| 2940 |
_g_free0 (kwinrc); |
| 2941 |
return result; |
| 2942 |
} |
| 2943 |
__finally0: |
| 2944 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 2945 |
gboolean _tmp16_ = FALSE; |
| 2946 |
_krc_file_unref0 (key_file); |
| 2947 |
_g_free0 (kwinrc); |
| 2948 |
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 2949 |
g_clear_error (&_inner_error0_); |
| 2950 |
return _tmp16_; |
| 2951 |
} |
| 2952 |
{ |
| 2953 |
gboolean is_updated = FALSE; |
| 2954 |
is_updated = FALSE; |
| 2955 |
if (start) { |
| 2956 |
gchar* ibus_value = NULL; |
| 2957 |
gchar* _tmp17_; |
| 2958 |
gchar* value = NULL; |
| 2959 |
gboolean _tmp18_ = FALSE; |
| 2960 |
KRcFile* _tmp19_; |
| 2961 |
const gchar* _tmp28_; |
| 2962 |
const gchar* _tmp29_; |
| 2963 |
_tmp17_ = g_build_filename (DATADIR, "applications", UI_WAYLAND_DESKTOP, NULL); |
| 2964 |
ibus_value = _tmp17_; |
| 2965 |
value = NULL; |
| 2966 |
_tmp19_ = key_file; |
| 2967 |
if (krc_file_has_group (_tmp19_, "Wayland")) { |
| 2968 |
gboolean _tmp20_ = FALSE; |
| 2969 |
KRcFile* _tmp21_; |
| 2970 |
_tmp21_ = key_file; |
| 2971 |
_tmp20_ = krc_file_has_key (_tmp21_, "Wayland", "InputMethod[$e]", &_inner_error0_); |
| 2972 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 2973 |
gboolean _tmp22_ = FALSE; |
| 2974 |
_g_free0 (value); |
| 2975 |
_g_free0 (ibus_value); |
| 2976 |
if (_inner_error0_->domain == G_KEY_FILE_ERROR) { |
| 2977 |
goto __catch1_g_key_file_error; |
| 2978 |
} |
| 2979 |
if (_inner_error0_->domain == G_FILE_ERROR) { |
| 2980 |
goto __catch1_g_file_error; |
| 2981 |
} |
| 2982 |
_krc_file_unref0 (key_file); |
| 2983 |
_g_free0 (kwinrc); |
| 2984 |
g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 2985 |
g_clear_error (&_inner_error0_); |
| 2986 |
return _tmp22_; |
| 2987 |
} |
| 2988 |
_tmp18_ = _tmp20_; |
| 2989 |
} else { |
| 2990 |
_tmp18_ = FALSE; |
| 2991 |
} |
| 2992 |
if (_tmp18_) { |
| 2993 |
gchar* _tmp23_ = NULL; |
| 2994 |
KRcFile* _tmp24_; |
| 2995 |
gchar* _tmp25_; |
| 2996 |
gchar* _tmp27_; |
| 2997 |
_tmp24_ = key_file; |
| 2998 |
_tmp25_ = krc_file_get_value (_tmp24_, "Wayland", "InputMethod[$e]", &_inner_error0_); |
| 2999 |
_tmp23_ = _tmp25_; |
| 3000 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 3001 |
gboolean _tmp26_ = FALSE; |
| 3002 |
_g_free0 (value); |
| 3003 |
_g_free0 (ibus_value); |
| 3004 |
if (_inner_error0_->domain == G_KEY_FILE_ERROR) { |
| 3005 |
goto __catch1_g_key_file_error; |
| 3006 |
} |
| 3007 |
if (_inner_error0_->domain == G_FILE_ERROR) { |
| 3008 |
goto __catch1_g_file_error; |
| 3009 |
} |
| 3010 |
_krc_file_unref0 (key_file); |
| 3011 |
_g_free0 (kwinrc); |
| 3012 |
g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 3013 |
g_clear_error (&_inner_error0_); |
| 3014 |
return _tmp26_; |
| 3015 |
} |
| 3016 |
_tmp27_ = _tmp23_; |
| 3017 |
_tmp23_ = NULL; |
| 3018 |
_g_free0 (value); |
| 3019 |
value = _tmp27_; |
| 3020 |
_g_free0 (_tmp23_); |
| 3021 |
} |
| 3022 |
_tmp28_ = value; |
| 3023 |
_tmp29_ = ibus_value; |
| 3024 |
if (g_strcmp0 (_tmp28_, _tmp29_) != 0) { |
| 3025 |
KRcFile* _tmp30_; |
| 3026 |
const gchar* _tmp31_; |
| 3027 |
KRcFile* _tmp32_; |
| 3028 |
const gchar* _tmp33_; |
| 3029 |
_tmp30_ = key_file; |
| 3030 |
_tmp31_ = ibus_value; |
| 3031 |
krc_file_set_value (_tmp30_, "Wayland", "InputMethod[$e]", _tmp31_); |
| 3032 |
_tmp32_ = key_file; |
| 3033 |
_tmp33_ = kwinrc; |
| 3034 |
krc_file_save_to_file (_tmp32_, _tmp33_, &_inner_error0_); |
| 3035 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 3036 |
gboolean _tmp34_ = FALSE; |
| 3037 |
_g_free0 (value); |
| 3038 |
_g_free0 (ibus_value); |
| 3039 |
if (_inner_error0_->domain == G_KEY_FILE_ERROR) { |
| 3040 |
goto __catch1_g_key_file_error; |
| 3041 |
} |
| 3042 |
if (_inner_error0_->domain == G_FILE_ERROR) { |
| 3043 |
goto __catch1_g_file_error; |
| 3044 |
} |
| 3045 |
_krc_file_unref0 (key_file); |
| 3046 |
_g_free0 (kwinrc); |
| 3047 |
g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 3048 |
g_clear_error (&_inner_error0_); |
| 3049 |
return _tmp34_; |
| 3050 |
} |
| 3051 |
is_updated = TRUE; |
| 3052 |
} |
| 3053 |
_g_free0 (value); |
| 3054 |
_g_free0 (ibus_value); |
| 3055 |
} else { |
| 3056 |
KRcFile* _tmp35_; |
| 3057 |
_tmp35_ = key_file; |
| 3058 |
if (krc_file_has_group (_tmp35_, "Wayland")) { |
| 3059 |
gchar** keys = NULL; |
| 3060 |
KRcFile* _tmp36_; |
| 3061 |
gint _tmp37_ = 0; |
| 3062 |
gchar** _tmp38_; |
| 3063 |
gint keys_length1; |
| 3064 |
gint _keys_size_; |
| 3065 |
gboolean _tmp40_ = FALSE; |
| 3066 |
KRcFile* _tmp41_; |
| 3067 |
_tmp36_ = key_file; |
| 3068 |
_tmp38_ = krc_file_get_keys (_tmp36_, "Wayland", &_tmp37_, &_inner_error0_); |
| 3069 |
keys = _tmp38_; |
| 3070 |
keys_length1 = _tmp37_; |
| 3071 |
_keys_size_ = keys_length1; |
| 3072 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 3073 |
gboolean _tmp39_ = FALSE; |
| 3074 |
if (_inner_error0_->domain == G_KEY_FILE_ERROR) { |
| 3075 |
goto __catch1_g_key_file_error; |
| 3076 |
} |
| 3077 |
if (_inner_error0_->domain == G_FILE_ERROR) { |
| 3078 |
goto __catch1_g_file_error; |
| 3079 |
} |
| 3080 |
_krc_file_unref0 (key_file); |
| 3081 |
_g_free0 (kwinrc); |
| 3082 |
g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 3083 |
g_clear_error (&_inner_error0_); |
| 3084 |
return _tmp39_; |
| 3085 |
} |
| 3086 |
_tmp41_ = key_file; |
| 3087 |
_tmp40_ = krc_file_has_key (_tmp41_, "Wayland", "InputMethod[$e]", &_inner_error0_); |
| 3088 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 3089 |
gboolean _tmp42_ = FALSE; |
| 3090 |
keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL); |
| 3091 |
if (_inner_error0_->domain == G_KEY_FILE_ERROR) { |
| 3092 |
goto __catch1_g_key_file_error; |
| 3093 |
} |
| 3094 |
if (_inner_error0_->domain == G_FILE_ERROR) { |
| 3095 |
goto __catch1_g_file_error; |
| 3096 |
} |
| 3097 |
_krc_file_unref0 (key_file); |
| 3098 |
_g_free0 (kwinrc); |
| 3099 |
g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 3100 |
g_clear_error (&_inner_error0_); |
| 3101 |
return _tmp42_; |
| 3102 |
} |
| 3103 |
if (_tmp40_) { |
| 3104 |
gchar** _tmp43_; |
| 3105 |
gint _tmp43__length1; |
| 3106 |
KRcFile* _tmp48_; |
| 3107 |
const gchar* _tmp49_; |
| 3108 |
_tmp43_ = keys; |
| 3109 |
_tmp43__length1 = keys_length1; |
| 3110 |
if (_tmp43__length1 == 1) { |
| 3111 |
KRcFile* _tmp44_; |
| 3112 |
_tmp44_ = key_file; |
| 3113 |
krc_file_remove_group (_tmp44_, "Wayland", &_inner_error0_); |
| 3114 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 3115 |
gboolean _tmp45_ = FALSE; |
| 3116 |
keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL); |
| 3117 |
if (_inner_error0_->domain == G_KEY_FILE_ERROR) { |
| 3118 |
goto __catch1_g_key_file_error; |
| 3119 |
} |
| 3120 |
if (_inner_error0_->domain == G_FILE_ERROR) { |
| 3121 |
goto __catch1_g_file_error; |
| 3122 |
} |
| 3123 |
_krc_file_unref0 (key_file); |
| 3124 |
_g_free0 (kwinrc); |
| 3125 |
g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 3126 |
g_clear_error (&_inner_error0_); |
| 3127 |
return _tmp45_; |
| 3128 |
} |
| 3129 |
} else { |
| 3130 |
KRcFile* _tmp46_; |
| 3131 |
_tmp46_ = key_file; |
| 3132 |
krc_file_remove_key (_tmp46_, "Wayland", "InputMethod[$e]", &_inner_error0_); |
| 3133 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 3134 |
gboolean _tmp47_ = FALSE; |
| 3135 |
keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL); |
| 3136 |
if (_inner_error0_->domain == G_KEY_FILE_ERROR) { |
| 3137 |
goto __catch1_g_key_file_error; |
| 3138 |
} |
| 3139 |
if (_inner_error0_->domain == G_FILE_ERROR) { |
| 3140 |
goto __catch1_g_file_error; |
| 3141 |
} |
| 3142 |
_krc_file_unref0 (key_file); |
| 3143 |
_g_free0 (kwinrc); |
| 3144 |
g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 3145 |
g_clear_error (&_inner_error0_); |
| 3146 |
return _tmp47_; |
| 3147 |
} |
| 3148 |
} |
| 3149 |
_tmp48_ = key_file; |
| 3150 |
_tmp49_ = kwinrc; |
| 3151 |
krc_file_save_to_file (_tmp48_, _tmp49_, &_inner_error0_); |
| 3152 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 3153 |
gboolean _tmp50_ = FALSE; |
| 3154 |
keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL); |
| 3155 |
if (_inner_error0_->domain == G_KEY_FILE_ERROR) { |
| 3156 |
goto __catch1_g_key_file_error; |
| 3157 |
} |
| 3158 |
if (_inner_error0_->domain == G_FILE_ERROR) { |
| 3159 |
goto __catch1_g_file_error; |
| 3160 |
} |
| 3161 |
_krc_file_unref0 (key_file); |
| 3162 |
_g_free0 (kwinrc); |
| 3163 |
g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 3164 |
g_clear_error (&_inner_error0_); |
| 3165 |
return _tmp50_; |
| 3166 |
} |
| 3167 |
is_updated = TRUE; |
| 3168 |
} |
| 3169 |
keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL); |
| 3170 |
} |
| 3171 |
} |
| 3172 |
if (verbose) { |
| 3173 |
if (is_updated) { |
| 3174 |
const gchar* _tmp51_ = NULL; |
| 3175 |
const gchar* _tmp52_ = NULL; |
| 3176 |
FILE* _tmp53_; |
| 3177 |
if (start) { |
| 3178 |
_tmp51_ = "added"; |
| 3179 |
} else { |
| 3180 |
_tmp51_ = "deleted"; |
| 3181 |
} |
| 3182 |
if (start) { |
| 3183 |
_tmp52_ = "start"; |
| 3184 |
} else { |
| 3185 |
_tmp52_ = "exit"; |
| 3186 |
} |
| 3187 |
_tmp53_ = stderr; |
| 3188 |
fprintf (_tmp53_, "\"InputMethod\" was %s in kwinrc for %s.\n", _tmp51_, _tmp52_); |
| 3189 |
} else { |
| 3190 |
if (start) { |
| 3191 |
FILE* _tmp54_; |
| 3192 |
_tmp54_ = stderr; |
| 3193 |
fprintf (_tmp54_, "%s", "kwinrc is not updated for start. \"ibus exit\" " "command may be needed in case kwin_wayland " "restarted.\n"); |
| 3194 |
} else { |
| 3195 |
FILE* _tmp55_; |
| 3196 |
_tmp55_ = stderr; |
| 3197 |
fprintf (_tmp55_, "kwinrc is not updated for exit.\n"); |
| 3198 |
result = TRUE; |
| 3199 |
_krc_file_unref0 (key_file); |
| 3200 |
_g_free0 (kwinrc); |
| 3201 |
return result; |
| 3202 |
} |
| 3203 |
} |
| 3204 |
} |
| 3205 |
} |
| 3206 |
goto __finally1; |
| 3207 |
__catch1_g_key_file_error: |
| 3208 |
{ |
| 3209 |
GError* e = NULL; |
| 3210 |
FILE* _tmp56_; |
| 3211 |
GError* _tmp57_; |
| 3212 |
const gchar* _tmp58_; |
| 3213 |
e = _inner_error0_; |
| 3214 |
_inner_error0_ = NULL; |
| 3215 |
_tmp56_ = stderr; |
| 3216 |
_tmp57_ = e; |
| 3217 |
_tmp58_ = _tmp57_->message; |
| 3218 |
fprintf (_tmp56_, "%s\n", _tmp58_); |
| 3219 |
result = FALSE; |
| 3220 |
_g_error_free0 (e); |
| 3221 |
_krc_file_unref0 (key_file); |
| 3222 |
_g_free0 (kwinrc); |
| 3223 |
return result; |
| 3224 |
} |
| 3225 |
goto __finally1; |
| 3226 |
__catch1_g_file_error: |
| 3227 |
{ |
| 3228 |
GError* e = NULL; |
| 3229 |
FILE* _tmp59_; |
| 3230 |
GError* _tmp60_; |
| 3231 |
const gchar* _tmp61_; |
| 3232 |
e = _inner_error0_; |
| 3233 |
_inner_error0_ = NULL; |
| 3234 |
_tmp59_ = stderr; |
| 3235 |
_tmp60_ = e; |
| 3236 |
_tmp61_ = _tmp60_->message; |
| 3237 |
fprintf (_tmp59_, "%s\n", _tmp61_); |
| 3238 |
result = FALSE; |
| 3239 |
_g_error_free0 (e); |
| 3240 |
_krc_file_unref0 (key_file); |
| 3241 |
_g_free0 (kwinrc); |
| 3242 |
return result; |
| 3243 |
} |
| 3244 |
__finally1: |
| 3245 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 3246 |
gboolean _tmp62_ = FALSE; |
| 3247 |
_krc_file_unref0 (key_file); |
| 3248 |
_g_free0 (kwinrc); |
| 3249 |
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 3250 |
g_clear_error (&_inner_error0_); |
| 3251 |
return _tmp62_; |
| 3252 |
} |
| 3253 |
if (!operate_daemon_with_dbus_kde (connection, start, verbose)) { |
| 3254 |
result = FALSE; |
| 3255 |
_krc_file_unref0 (key_file); |
| 3256 |
_g_free0 (kwinrc); |
| 3257 |
return result; |
| 3258 |
} |
| 3259 |
if (verbose) { |
| 3260 |
const gchar* _tmp63_ = NULL; |
| 3261 |
FILE* _tmp64_; |
| 3262 |
if (start) { |
| 3263 |
_tmp63_ = "start"; |
| 3264 |
} else { |
| 3265 |
_tmp63_ = "exit"; |
| 3266 |
} |
| 3267 |
_tmp64_ = stderr; |
| 3268 |
fprintf (_tmp64_, "Succeed to %s ibus-daemon with a " "KDE Wayland method.\n", _tmp63_); |
| 3269 |
} |
| 3270 |
result = TRUE; |
| 3271 |
_krc_file_unref0 (key_file); |
| 3272 |
_g_free0 (kwinrc); |
| 3273 |
return result; |
| 3274 |
} |
| 3275 |
|
| 3276 |
gboolean |
| 3277 |
start_daemon_with_systemd (gboolean restart, |
| 3278 |
gboolean verbose) |
| 3279 |
{ |
| 3280 |
GDBusConnection* connection = NULL; |
| 3281 |
GDBusConnection* _tmp0_; |
| 3282 |
GDBusConnection* _tmp1_; |
| 3283 |
gchar* object_path = NULL; |
| 3284 |
GDBusConnection* _tmp7_; |
| 3285 |
GDBusConnection* _tmp8_; |
| 3286 |
gchar* _tmp9_; |
| 3287 |
const gchar* _tmp10_; |
| 3288 |
GDBusConnection* _tmp11_; |
| 3289 |
const gchar* _tmp12_; |
| 3290 |
gboolean result; |
| 3291 |
_tmp0_ = get_session_bus (verbose); |
| 3292 |
connection = _tmp0_; |
| 3293 |
_tmp1_ = connection; |
| 3294 |
if (_tmp1_ == NULL) { |
| 3295 |
result = FALSE; |
| 3296 |
_g_object_unref0 (connection); |
| 3297 |
return result; |
| 3298 |
} |
| 3299 |
object_path = NULL; |
| 3300 |
if (restart) { |
| 3301 |
GDBusConnection* _tmp2_; |
| 3302 |
gchar* _tmp3_; |
| 3303 |
const gchar* _tmp4_; |
| 3304 |
GDBusConnection* _tmp5_; |
| 3305 |
const gchar* _tmp6_; |
| 3306 |
_tmp2_ = connection; |
| 3307 |
_tmp3_ = get_ibus_systemd_object_path (_tmp2_, verbose); |
| 3308 |
_g_free0 (object_path); |
| 3309 |
object_path = _tmp3_; |
| 3310 |
_tmp4_ = object_path; |
| 3311 |
if (_tmp4_ == NULL) { |
| 3312 |
result = FALSE; |
| 3313 |
_g_free0 (object_path); |
| 3314 |
_g_object_unref0 (connection); |
| 3315 |
return result; |
| 3316 |
} |
| 3317 |
_tmp5_ = connection; |
| 3318 |
_tmp6_ = object_path; |
| 3319 |
if (!is_running_daemon_via_systemd (_tmp5_, _tmp6_, verbose)) { |
| 3320 |
result = FALSE; |
| 3321 |
_g_free0 (object_path); |
| 3322 |
_g_object_unref0 (connection); |
| 3323 |
return result; |
| 3324 |
} |
| 3325 |
} |
| 3326 |
_tmp7_ = connection; |
| 3327 |
if (!start_daemon_with_dbus_systemd (_tmp7_, restart, verbose)) { |
| 3328 |
result = FALSE; |
| 3329 |
_g_free0 (object_path); |
| 3330 |
_g_object_unref0 (connection); |
| 3331 |
return result; |
| 3332 |
} |
| 3333 |
if (restart) { |
| 3334 |
result = TRUE; |
| 3335 |
_g_free0 (object_path); |
| 3336 |
_g_object_unref0 (connection); |
| 3337 |
return result; |
| 3338 |
} |
| 3339 |
_tmp8_ = connection; |
| 3340 |
_tmp9_ = get_ibus_systemd_object_path (_tmp8_, verbose); |
| 3341 |
_g_free0 (object_path); |
| 3342 |
object_path = _tmp9_; |
| 3343 |
_tmp10_ = object_path; |
| 3344 |
if (_tmp10_ == NULL) { |
| 3345 |
result = FALSE; |
| 3346 |
_g_free0 (object_path); |
| 3347 |
_g_object_unref0 (connection); |
| 3348 |
return result; |
| 3349 |
} |
| 3350 |
_tmp11_ = connection; |
| 3351 |
_tmp12_ = object_path; |
| 3352 |
if (!is_running_daemon_via_systemd (_tmp11_, _tmp12_, verbose)) { |
| 3353 |
result = FALSE; |
| 3354 |
_g_free0 (object_path); |
| 3355 |
_g_object_unref0 (connection); |
| 3356 |
return result; |
| 3357 |
} |
| 3358 |
result = TRUE; |
| 3359 |
_g_free0 (object_path); |
| 3360 |
_g_object_unref0 (connection); |
| 3361 |
return result; |
| 3362 |
} |
| 3363 |
|
| 3364 |
gint |
| 3365 |
start_daemon_real (gchar** argv, |
| 3366 |
gint argv_length1, |
| 3367 |
gboolean restart) |
| 3368 |
{ |
| 3369 |
static const GOptionEntry options[4] = {{"type", (gchar) 0, (gint) 0, G_OPTION_ARG_STRING, &daemon_type, N_ ("Start or restart daemon with \"direct\", \"systemd\", " "\"kde-wayland\" or \"wayland\" TYPE."), "TYPE"}, {"service-file", (gchar) 0, (gint) 0, G_OPTION_ARG_STRING, &systemd_service_file, N_ ("Start or restart daemon with SYSTEMD_SERVICE file."), "SYSTEMD_SERVICE"}, {"verbose", (gchar) 0, (gint) 0, G_OPTION_ARG_NONE, &verbose, N_ ("Show debug messages."), NULL}, {NULL}}; |
| 3370 |
GOptionContext* option = NULL; |
| 3371 |
GOptionContext* _tmp0_; |
| 3372 |
GOptionContext* _tmp1_; |
| 3373 |
GOptionContext* _tmp2_; |
| 3374 |
gboolean _tmp9_ = FALSE; |
| 3375 |
gboolean _tmp10_ = FALSE; |
| 3376 |
gboolean _tmp11_ = FALSE; |
| 3377 |
gboolean _tmp12_ = FALSE; |
| 3378 |
const gchar* _tmp13_; |
| 3379 |
const gchar* _tmp19_; |
| 3380 |
gboolean _tmp21_ = FALSE; |
| 3381 |
const gchar* _tmp22_; |
| 3382 |
gboolean _tmp24_ = FALSE; |
| 3383 |
const gchar* _tmp25_; |
| 3384 |
gboolean _tmp32_ = FALSE; |
| 3385 |
const gchar* _tmp33_; |
| 3386 |
gboolean _tmp35_ = FALSE; |
| 3387 |
const gchar* _tmp36_; |
| 3388 |
IBusBus* bus = NULL; |
| 3389 |
IBusBus* _tmp38_; |
| 3390 |
GError* _inner_error0_ = NULL; |
| 3391 |
gint result; |
| 3392 |
_tmp0_ = g_option_context_new (NULL); |
| 3393 |
option = _tmp0_; |
| 3394 |
_tmp1_ = option; |
| 3395 |
g_option_context_add_main_entries (_tmp1_, options, GETTEXT_PACKAGE); |
| 3396 |
_tmp2_ = option; |
| 3397 |
g_option_context_set_ignore_unknown_options (_tmp2_, TRUE); |
| 3398 |
{ |
| 3399 |
GOptionContext* _tmp3_; |
| 3400 |
_tmp3_ = option; |
| 3401 |
g_option_context_parse (_tmp3_, (gint*) (&argv_length1), &argv, &_inner_error0_); |
| 3402 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 3403 |
gint _tmp4_ = -1; |
| 3404 |
if (_inner_error0_->domain == G_OPTION_ERROR) { |
| 3405 |
goto __catch0_g_option_error; |
| 3406 |
} |
| 3407 |
_g_option_context_free0 (option); |
| 3408 |
g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 3409 |
g_clear_error (&_inner_error0_); |
| 3410 |
return _tmp4_; |
| 3411 |
} |
| 3412 |
} |
| 3413 |
goto __finally0; |
| 3414 |
__catch0_g_option_error: |
| 3415 |
{ |
| 3416 |
GError* e = NULL; |
| 3417 |
FILE* _tmp5_; |
| 3418 |
GError* _tmp6_; |
| 3419 |
const gchar* _tmp7_; |
| 3420 |
e = _inner_error0_; |
| 3421 |
_inner_error0_ = NULL; |
| 3422 |
_tmp5_ = stderr; |
| 3423 |
_tmp6_ = e; |
| 3424 |
_tmp7_ = _tmp6_->message; |
| 3425 |
fprintf (_tmp5_, "%s\n", _tmp7_); |
| 3426 |
result = EXIT_FAILURE; |
| 3427 |
_g_error_free0 (e); |
| 3428 |
_g_option_context_free0 (option); |
| 3429 |
return result; |
| 3430 |
} |
| 3431 |
__finally0: |
| 3432 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 3433 |
gint _tmp8_ = -1; |
| 3434 |
_g_option_context_free0 (option); |
| 3435 |
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 3436 |
g_clear_error (&_inner_error0_); |
| 3437 |
return _tmp8_; |
| 3438 |
} |
| 3439 |
_tmp13_ = daemon_type; |
| 3440 |
if (_tmp13_ != NULL) { |
| 3441 |
const gchar* _tmp14_; |
| 3442 |
_tmp14_ = daemon_type; |
| 3443 |
_tmp12_ = g_strcmp0 (_tmp14_, "direct") != 0; |
| 3444 |
} else { |
| 3445 |
_tmp12_ = FALSE; |
| 3446 |
} |
| 3447 |
if (_tmp12_) { |
| 3448 |
const gchar* _tmp15_; |
| 3449 |
_tmp15_ = daemon_type; |
| 3450 |
_tmp11_ = g_strcmp0 (_tmp15_, "systemd") != 0; |
| 3451 |
} else { |
| 3452 |
_tmp11_ = FALSE; |
| 3453 |
} |
| 3454 |
if (_tmp11_) { |
| 3455 |
const gchar* _tmp16_; |
| 3456 |
_tmp16_ = daemon_type; |
| 3457 |
_tmp10_ = g_strcmp0 (_tmp16_, "kde-wayland") != 0; |
| 3458 |
} else { |
| 3459 |
_tmp10_ = FALSE; |
| 3460 |
} |
| 3461 |
if (_tmp10_) { |
| 3462 |
const gchar* _tmp17_; |
| 3463 |
_tmp17_ = daemon_type; |
| 3464 |
_tmp9_ = g_strcmp0 (_tmp17_, "wayland") != 0; |
| 3465 |
} else { |
| 3466 |
_tmp9_ = FALSE; |
| 3467 |
} |
| 3468 |
if (_tmp9_) { |
| 3469 |
FILE* _tmp18_; |
| 3470 |
_tmp18_ = stderr; |
| 3471 |
fprintf (_tmp18_, "%s", "type argument must be \"direct\" or \"systemd\" " "or \"kde-wayland\" or \"wayland\"\n"); |
| 3472 |
result = EXIT_FAILURE; |
| 3473 |
_g_option_context_free0 (option); |
| 3474 |
return result; |
| 3475 |
} |
| 3476 |
_tmp19_ = systemd_service_file; |
| 3477 |
if (_tmp19_ == NULL) { |
| 3478 |
gchar* _tmp20_; |
| 3479 |
_tmp20_ = g_strdup (SYSTEMD_SESSION_GNOME_FILE); |
| 3480 |
_g_free0 (systemd_service_file); |
| 3481 |
systemd_service_file = _tmp20_; |
| 3482 |
} |
| 3483 |
_tmp22_ = daemon_type; |
| 3484 |
if (_tmp22_ == NULL) { |
| 3485 |
_tmp21_ = TRUE; |
| 3486 |
} else { |
| 3487 |
const gchar* _tmp23_; |
| 3488 |
_tmp23_ = daemon_type; |
| 3489 |
_tmp21_ = g_strcmp0 (_tmp23_, "wayland") == 0; |
| 3490 |
} |
| 3491 |
if (_tmp21_) { |
| 3492 |
if (start_daemon_in_wayland (restart, argv, (gint) argv_length1)) { |
| 3493 |
result = EXIT_SUCCESS; |
| 3494 |
_g_option_context_free0 (option); |
| 3495 |
return result; |
| 3496 |
} |
| 3497 |
} |
| 3498 |
_tmp25_ = daemon_type; |
| 3499 |
if (_tmp25_ == NULL) { |
| 3500 |
_tmp24_ = TRUE; |
| 3501 |
} else { |
| 3502 |
const gchar* _tmp26_; |
| 3503 |
_tmp26_ = daemon_type; |
| 3504 |
_tmp24_ = g_strcmp0 (_tmp26_, "kde-wayland") == 0; |
| 3505 |
} |
| 3506 |
if (_tmp24_) { |
| 3507 |
{ |
| 3508 |
gboolean _tmp27_ = FALSE; |
| 3509 |
_tmp27_ = TRUE; |
| 3510 |
while (TRUE) { |
| 3511 |
GDBusConnection* connection = NULL; |
| 3512 |
GDBusConnection* _tmp28_; |
| 3513 |
GDBusConnection* _tmp29_; |
| 3514 |
GDBusConnection* _tmp31_; |
| 3515 |
if (!_tmp27_) { |
| 3516 |
if (!FALSE) { |
| 3517 |
break; |
| 3518 |
} |
| 3519 |
} |
| 3520 |
_tmp27_ = FALSE; |
| 3521 |
_tmp28_ = get_session_bus (verbose); |
| 3522 |
connection = _tmp28_; |
| 3523 |
_tmp29_ = connection; |
| 3524 |
if (_tmp29_ == NULL) { |
| 3525 |
_g_object_unref0 (connection); |
| 3526 |
break; |
| 3527 |
} |
| 3528 |
if (restart) { |
| 3529 |
GDBusConnection* _tmp30_; |
| 3530 |
_tmp30_ = connection; |
| 3531 |
if (operate_daemon_in_kde_wayland (_tmp30_, FALSE, verbose)) { |
| 3532 |
sleep ((guint) 3); |
| 3533 |
} else { |
| 3534 |
_g_object_unref0 (connection); |
| 3535 |
break; |
| 3536 |
} |
| 3537 |
} |
| 3538 |
_tmp31_ = connection; |
| 3539 |
if (operate_daemon_in_kde_wayland (_tmp31_, TRUE, verbose)) { |
| 3540 |
result = EXIT_SUCCESS; |
| 3541 |
_g_object_unref0 (connection); |
| 3542 |
_g_option_context_free0 (option); |
| 3543 |
return result; |
| 3544 |
} |
| 3545 |
_g_object_unref0 (connection); |
| 3546 |
} |
| 3547 |
} |
| 3548 |
} |
| 3549 |
_tmp33_ = daemon_type; |
| 3550 |
if (_tmp33_ == NULL) { |
| 3551 |
_tmp32_ = TRUE; |
| 3552 |
} else { |
| 3553 |
const gchar* _tmp34_; |
| 3554 |
_tmp34_ = daemon_type; |
| 3555 |
_tmp32_ = g_strcmp0 (_tmp34_, "systemd") == 0; |
| 3556 |
} |
| 3557 |
if (_tmp32_) { |
| 3558 |
if (start_daemon_with_systemd (restart, verbose)) { |
| 3559 |
result = EXIT_SUCCESS; |
| 3560 |
_g_option_context_free0 (option); |
| 3561 |
return result; |
| 3562 |
} |
| 3563 |
} |
| 3564 |
_tmp36_ = daemon_type; |
| 3565 |
if (g_strcmp0 (_tmp36_, "systemd") == 0) { |
| 3566 |
_tmp35_ = TRUE; |
| 3567 |
} else { |
| 3568 |
const gchar* _tmp37_; |
| 3569 |
_tmp37_ = daemon_type; |
| 3570 |
_tmp35_ = g_strcmp0 (_tmp37_, "kde-wayland") == 0; |
| 3571 |
} |
| 3572 |
if (_tmp35_) { |
| 3573 |
result = EXIT_FAILURE; |
| 3574 |
_g_option_context_free0 (option); |
| 3575 |
return result; |
| 3576 |
} |
| 3577 |
_tmp38_ = get_bus (); |
| 3578 |
bus = _tmp38_; |
| 3579 |
if (restart) { |
| 3580 |
IBusBus* _tmp39_; |
| 3581 |
IBusBus* _tmp41_; |
| 3582 |
_tmp39_ = bus; |
| 3583 |
if (_tmp39_ == NULL) { |
| 3584 |
FILE* _tmp40_; |
| 3585 |
_tmp40_ = stderr; |
| 3586 |
fprintf (_tmp40_, "%s", _ ("Can't connect to IBus.\n")); |
| 3587 |
result = EXIT_FAILURE; |
| 3588 |
_g_object_unref0 (bus); |
| 3589 |
_g_option_context_free0 (option); |
| 3590 |
return result; |
| 3591 |
} |
| 3592 |
_tmp41_ = bus; |
| 3593 |
ibus_bus_exit (_tmp41_, TRUE); |
| 3594 |
if (verbose) { |
| 3595 |
FILE* _tmp42_; |
| 3596 |
_tmp42_ = stderr; |
| 3597 |
fprintf (_tmp42_, "%s", "Succeed to restart ibus-daemon with an IBus API " "directly.\n"); |
| 3598 |
} |
| 3599 |
} else { |
| 3600 |
IBusBus* _tmp43_; |
| 3601 |
_tmp43_ = bus; |
| 3602 |
if (_tmp43_ != NULL) { |
| 3603 |
FILE* _tmp44_; |
| 3604 |
gchar* _tmp45_; |
| 3605 |
gchar* _tmp46_; |
| 3606 |
_tmp44_ = stderr; |
| 3607 |
_tmp45_ = g_strdup_printf ("%s\n", _ ("IBus is running.")); |
| 3608 |
_tmp46_ = _tmp45_; |
| 3609 |
fprintf (_tmp44_, "%s", _tmp46_); |
| 3610 |
_g_free0 (_tmp46_); |
| 3611 |
result = EXIT_FAILURE; |
| 3612 |
_g_object_unref0 (bus); |
| 3613 |
_g_option_context_free0 (option); |
| 3614 |
return result; |
| 3615 |
} else { |
| 3616 |
gchar* startarg = NULL; |
| 3617 |
gchar* _tmp47_; |
| 3618 |
const gchar* _tmp48_; |
| 3619 |
gchar* _tmp49_; |
| 3620 |
gchar** paths = NULL; |
| 3621 |
const gchar* _tmp50_; |
| 3622 |
gchar** _tmp51_; |
| 3623 |
gchar** _tmp52_; |
| 3624 |
gint paths_length1; |
| 3625 |
gint _paths_size_; |
| 3626 |
gchar** _tmp53_; |
| 3627 |
gint _tmp53__length1; |
| 3628 |
const gchar* _tmp62_; |
| 3629 |
_tmp47_ = g_strdup ("ibus-daemon"); |
| 3630 |
startarg = _tmp47_; |
| 3631 |
_tmp48_ = startarg; |
| 3632 |
_tmp49_ = g_strdup (_tmp48_); |
| 3633 |
_g_free0 (argv[0]); |
| 3634 |
argv[0] = _tmp49_; |
| 3635 |
_tmp50_ = g_getenv ("PATH"); |
| 3636 |
_tmp52_ = _tmp51_ = g_strsplit (_tmp50_, ":", 0); |
| 3637 |
paths = _tmp52_; |
| 3638 |
paths_length1 = _vala_array_length (_tmp51_); |
| 3639 |
_paths_size_ = paths_length1; |
| 3640 |
_tmp53_ = paths; |
| 3641 |
_tmp53__length1 = paths_length1; |
| 3642 |
{ |
| 3643 |
gchar** path_collection = NULL; |
| 3644 |
gint path_collection_length1 = 0; |
| 3645 |
gint _path_collection_size_ = 0; |
| 3646 |
gint path_it = 0; |
| 3647 |
path_collection = _tmp53_; |
| 3648 |
path_collection_length1 = _tmp53__length1; |
| 3649 |
for (path_it = 0; path_it < path_collection_length1; path_it = path_it + 1) { |
| 3650 |
const gchar* path = NULL; |
| 3651 |
path = path_collection[path_it]; |
| 3652 |
{ |
| 3653 |
gchar* full_path = NULL; |
| 3654 |
const gchar* _tmp54_; |
| 3655 |
const gchar* _tmp55_; |
| 3656 |
gchar* _tmp56_; |
| 3657 |
const gchar* _tmp57_; |
| 3658 |
_tmp54_ = path; |
| 3659 |
_tmp55_ = startarg; |
| 3660 |
_tmp56_ = g_strdup_printf ("%s/%s", _tmp54_, _tmp55_); |
| 3661 |
full_path = _tmp56_; |
| 3662 |
_tmp57_ = full_path; |
| 3663 |
if (g_file_test (_tmp57_, G_FILE_TEST_IS_EXECUTABLE)) { |
| 3664 |
const gchar* _tmp58_; |
| 3665 |
gchar* _tmp59_; |
| 3666 |
_tmp58_ = full_path; |
| 3667 |
_tmp59_ = g_strdup (_tmp58_); |
| 3668 |
_g_free0 (startarg); |
| 3669 |
startarg = _tmp59_; |
| 3670 |
_g_free0 (full_path); |
| 3671 |
break; |
| 3672 |
} |
| 3673 |
_g_free0 (full_path); |
| 3674 |
} |
| 3675 |
} |
| 3676 |
} |
| 3677 |
if (verbose) { |
| 3678 |
FILE* _tmp60_; |
| 3679 |
const gchar* _tmp61_; |
| 3680 |
_tmp60_ = stderr; |
| 3681 |
_tmp61_ = startarg; |
| 3682 |
fprintf (_tmp60_, "Running \"%s\" directly as a foreground " "process.\n", _tmp61_); |
| 3683 |
} |
| 3684 |
_tmp62_ = startarg; |
| 3685 |
execv (_tmp62_, argv); |
| 3686 |
paths = (_vala_array_free (paths, paths_length1, (GDestroyNotify) g_free), NULL); |
| 3687 |
_g_free0 (startarg); |
| 3688 |
} |
| 3689 |
} |
| 3690 |
result = EXIT_SUCCESS; |
| 3691 |
_g_object_unref0 (bus); |
| 3692 |
_g_option_context_free0 (option); |
| 3693 |
return result; |
| 3694 |
} |
| 3695 |
|
| 3696 |
gint |
| 3697 |
restart_daemon (gchar** argv, |
| 3698 |
gint argv_length1) |
| 3699 |
{ |
| 3700 |
gint result; |
| 3701 |
result = start_daemon_real (argv, (gint) argv_length1, TRUE); |
| 3702 |
return result; |
| 3703 |
} |
| 3704 |
|
| 3705 |
gint |
| 3706 |
start_daemon (gchar** argv, |
| 3707 |
gint argv_length1) |
| 3708 |
{ |
| 3709 |
gint result; |
| 3710 |
result = start_daemon_real (argv, (gint) argv_length1, FALSE); |
| 3711 |
return result; |
| 3712 |
} |
| 3713 |
|
| 3714 |
static Block3Data* |
| 3715 |
block3_data_ref (Block3Data* _data3_) |
| 3716 |
{ |
| 3717 |
g_atomic_int_inc (&_data3_->_ref_count_); |
| 3718 |
return _data3_; |
| 3719 |
} |
| 3720 |
|
| 3721 |
static void |
| 3722 |
block3_data_unref (void * _userdata_) |
| 3723 |
{ |
| 3724 |
Block3Data* _data3_; |
| 3725 |
_data3_ = (Block3Data*) _userdata_; |
| 3726 |
if (g_atomic_int_dec_and_test (&_data3_->_ref_count_)) { |
| 3727 |
_g_object_unref0 (_data3_->bus); |
| 3728 |
g_slice_free (Block3Data, _data3_); |
| 3729 |
} |
| 3730 |
} |
| 3731 |
|
| 3732 |
static gboolean |
| 3733 |
__lambda6_ (Block3Data* _data3_) |
| 3734 |
{ |
| 3735 |
gboolean result; |
| 3736 |
ibus_bus_exit (_data3_->bus, FALSE); |
| 3737 |
_data3_->id = (guint) 0; |
| 3738 |
result = G_SOURCE_REMOVE; |
| 3739 |
return result; |
| 3740 |
} |
| 3741 |
|
| 3742 |
static gboolean |
| 3743 |
___lambda6__gsource_func (gpointer self) |
| 3744 |
{ |
| 3745 |
gboolean result; |
| 3746 |
result = __lambda6_ (self); |
| 3747 |
return result; |
| 3748 |
} |
| 3749 |
|
| 3750 |
gboolean |
| 3751 |
exit_daemon_with_systemd (IBusBus* bus, |
| 3752 |
gboolean verbose) |
| 3753 |
{ |
| 3754 |
Block3Data* _data3_; |
| 3755 |
IBusBus* _tmp0_; |
| 3756 |
const gchar* _tmp1_; |
| 3757 |
GDBusConnection* connection = NULL; |
| 3758 |
GDBusConnection* _tmp3_; |
| 3759 |
GDBusConnection* _tmp4_; |
| 3760 |
gchar* object_path = NULL; |
| 3761 |
GDBusConnection* _tmp5_; |
| 3762 |
gchar* _tmp6_; |
| 3763 |
const gchar* _tmp7_; |
| 3764 |
GDBusConnection* _tmp8_; |
| 3765 |
const gchar* _tmp9_; |
| 3766 |
GSource* source = NULL; |
| 3767 |
GSource* _tmp10_; |
| 3768 |
GSource* _tmp11_; |
| 3769 |
GSource* _tmp12_; |
| 3770 |
GSource* _tmp13_; |
| 3771 |
gboolean result; |
| 3772 |
g_return_val_if_fail (bus != NULL, FALSE); |
| 3773 |
_data3_ = g_slice_new0 (Block3Data); |
| 3774 |
_data3_->_ref_count_ = 1; |
| 3775 |
_tmp0_ = _g_object_ref0 (bus); |
| 3776 |
_g_object_unref0 (_data3_->bus); |
| 3777 |
_data3_->bus = _tmp0_; |
| 3778 |
_tmp1_ = systemd_service_file; |
| 3779 |
if (_tmp1_ == NULL) { |
| 3780 |
gchar* _tmp2_; |
| 3781 |
_tmp2_ = g_strdup (SYSTEMD_SESSION_GNOME_FILE); |
| 3782 |
_g_free0 (systemd_service_file); |
| 3783 |
systemd_service_file = _tmp2_; |
| 3784 |
} |
| 3785 |
_tmp3_ = get_session_bus (verbose); |
| 3786 |
connection = _tmp3_; |
| 3787 |
_tmp4_ = connection; |
| 3788 |
if (_tmp4_ == NULL) { |
| 3789 |
result = FALSE; |
| 3790 |
_g_object_unref0 (connection); |
| 3791 |
block3_data_unref (_data3_); |
| 3792 |
_data3_ = NULL; |
| 3793 |
return result; |
| 3794 |
} |
| 3795 |
_tmp5_ = connection; |
| 3796 |
_tmp6_ = get_ibus_systemd_object_path (_tmp5_, verbose); |
| 3797 |
object_path = _tmp6_; |
| 3798 |
_tmp7_ = object_path; |
| 3799 |
if (_tmp7_ == NULL) { |
| 3800 |
result = FALSE; |
| 3801 |
_g_free0 (object_path); |
| 3802 |
_g_object_unref0 (connection); |
| 3803 |
block3_data_unref (_data3_); |
| 3804 |
_data3_ = NULL; |
| 3805 |
return result; |
| 3806 |
} |
| 3807 |
_tmp8_ = connection; |
| 3808 |
_tmp9_ = object_path; |
| 3809 |
if (!is_running_daemon_via_systemd (_tmp8_, _tmp9_, verbose)) { |
| 3810 |
result = FALSE; |
| 3811 |
_g_free0 (object_path); |
| 3812 |
_g_object_unref0 (connection); |
| 3813 |
block3_data_unref (_data3_); |
| 3814 |
_data3_ = NULL; |
| 3815 |
return result; |
| 3816 |
} |
| 3817 |
_tmp10_ = g_timeout_source_new_seconds ((guint) 1); |
| 3818 |
source = _tmp10_; |
| 3819 |
_tmp11_ = source; |
| 3820 |
g_source_attach (_tmp11_, NULL); |
| 3821 |
_tmp12_ = source; |
| 3822 |
_data3_->id = g_source_get_id (_tmp12_); |
| 3823 |
_tmp13_ = source; |
| 3824 |
g_source_set_callback (_tmp13_, ___lambda6__gsource_func, block3_data_ref (_data3_), block3_data_unref); |
| 3825 |
while (TRUE) { |
| 3826 |
GMainContext* _tmp14_; |
| 3827 |
if (!(_data3_->id > ((guint) 0))) { |
| 3828 |
break; |
| 3829 |
} |
| 3830 |
_tmp14_ = g_main_context_default (); |
| 3831 |
g_main_context_iteration (_tmp14_, TRUE); |
| 3832 |
} |
| 3833 |
result = TRUE; |
| 3834 |
_g_source_unref0 (source); |
| 3835 |
_g_free0 (object_path); |
| 3836 |
_g_object_unref0 (connection); |
| 3837 |
block3_data_unref (_data3_); |
| 3838 |
_data3_ = NULL; |
| 3839 |
return result; |
| 3840 |
} |
| 3841 |
|
| 3842 |
gint |
| 3843 |
exit_daemon (gchar** argv, |
| 3844 |
gint argv_length1) |
| 3845 |
{ |
| 3846 |
static const GOptionEntry options[3] = {{"type", (gchar) 0, (gint) 0, G_OPTION_ARG_STRING, &daemon_type, N_ ("Exit daemon with \"direct\" or \"kde-wayland\" " "TYPE."), "TYPE"}, {"verbose", (gchar) 0, (gint) 0, G_OPTION_ARG_NONE, &verbose, N_ ("Show debug messages."), NULL}, {NULL}}; |
| 3847 |
GOptionContext* option = NULL; |
| 3848 |
GOptionContext* _tmp0_; |
| 3849 |
GOptionContext* _tmp1_; |
| 3850 |
GOptionContext* _tmp2_; |
| 3851 |
gboolean _tmp9_ = FALSE; |
| 3852 |
gboolean _tmp10_ = FALSE; |
| 3853 |
const gchar* _tmp11_; |
| 3854 |
gboolean _tmp15_ = FALSE; |
| 3855 |
const gchar* _tmp16_; |
| 3856 |
const gchar* _tmp22_; |
| 3857 |
IBusBus* bus = NULL; |
| 3858 |
IBusBus* _tmp23_; |
| 3859 |
IBusBus* _tmp24_; |
| 3860 |
IBusBus* _tmp26_; |
| 3861 |
const gchar* _tmp27_; |
| 3862 |
IBusBus* _tmp28_; |
| 3863 |
GError* _inner_error0_ = NULL; |
| 3864 |
gint result; |
| 3865 |
_tmp0_ = g_option_context_new (NULL); |
| 3866 |
option = _tmp0_; |
| 3867 |
_tmp1_ = option; |
| 3868 |
g_option_context_add_main_entries (_tmp1_, options, GETTEXT_PACKAGE); |
| 3869 |
_tmp2_ = option; |
| 3870 |
g_option_context_set_ignore_unknown_options (_tmp2_, TRUE); |
| 3871 |
{ |
| 3872 |
GOptionContext* _tmp3_; |
| 3873 |
_tmp3_ = option; |
| 3874 |
g_option_context_parse (_tmp3_, (gint*) (&argv_length1), &argv, &_inner_error0_); |
| 3875 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 3876 |
gint _tmp4_ = -1; |
| 3877 |
if (_inner_error0_->domain == G_OPTION_ERROR) { |
| 3878 |
goto __catch0_g_option_error; |
| 3879 |
} |
| 3880 |
_g_option_context_free0 (option); |
| 3881 |
g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 3882 |
g_clear_error (&_inner_error0_); |
| 3883 |
return _tmp4_; |
| 3884 |
} |
| 3885 |
} |
| 3886 |
goto __finally0; |
| 3887 |
__catch0_g_option_error: |
| 3888 |
{ |
| 3889 |
GError* e = NULL; |
| 3890 |
FILE* _tmp5_; |
| 3891 |
GError* _tmp6_; |
| 3892 |
const gchar* _tmp7_; |
| 3893 |
e = _inner_error0_; |
| 3894 |
_inner_error0_ = NULL; |
| 3895 |
_tmp5_ = stderr; |
| 3896 |
_tmp6_ = e; |
| 3897 |
_tmp7_ = _tmp6_->message; |
| 3898 |
fprintf (_tmp5_, "%s\n", _tmp7_); |
| 3899 |
result = EXIT_FAILURE; |
| 3900 |
_g_error_free0 (e); |
| 3901 |
_g_option_context_free0 (option); |
| 3902 |
return result; |
| 3903 |
} |
| 3904 |
__finally0: |
| 3905 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 3906 |
gint _tmp8_ = -1; |
| 3907 |
_g_option_context_free0 (option); |
| 3908 |
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 3909 |
g_clear_error (&_inner_error0_); |
| 3910 |
return _tmp8_; |
| 3911 |
} |
| 3912 |
_tmp11_ = daemon_type; |
| 3913 |
if (_tmp11_ != NULL) { |
| 3914 |
const gchar* _tmp12_; |
| 3915 |
_tmp12_ = daemon_type; |
| 3916 |
_tmp10_ = g_strcmp0 (_tmp12_, "direct") != 0; |
| 3917 |
} else { |
| 3918 |
_tmp10_ = FALSE; |
| 3919 |
} |
| 3920 |
if (_tmp10_) { |
| 3921 |
const gchar* _tmp13_; |
| 3922 |
_tmp13_ = daemon_type; |
| 3923 |
_tmp9_ = g_strcmp0 (_tmp13_, "kde-wayland") != 0; |
| 3924 |
} else { |
| 3925 |
_tmp9_ = FALSE; |
| 3926 |
} |
| 3927 |
if (_tmp9_) { |
| 3928 |
FILE* _tmp14_; |
| 3929 |
_tmp14_ = stderr; |
| 3930 |
fprintf (_tmp14_, "type argument must be \"direct\" or \"kde-wayland\"\n"); |
| 3931 |
result = EXIT_FAILURE; |
| 3932 |
_g_option_context_free0 (option); |
| 3933 |
return result; |
| 3934 |
} |
| 3935 |
_tmp16_ = daemon_type; |
| 3936 |
if (_tmp16_ == NULL) { |
| 3937 |
_tmp15_ = TRUE; |
| 3938 |
} else { |
| 3939 |
const gchar* _tmp17_; |
| 3940 |
_tmp17_ = daemon_type; |
| 3941 |
_tmp15_ = g_strcmp0 (_tmp17_, "kde-wayland") == 0; |
| 3942 |
} |
| 3943 |
if (_tmp15_) { |
| 3944 |
GDBusConnection* connection = NULL; |
| 3945 |
GDBusConnection* _tmp18_; |
| 3946 |
gboolean _tmp19_ = FALSE; |
| 3947 |
GDBusConnection* _tmp20_; |
| 3948 |
_tmp18_ = get_session_bus (verbose); |
| 3949 |
connection = _tmp18_; |
| 3950 |
_tmp20_ = connection; |
| 3951 |
if (_tmp20_ != NULL) { |
| 3952 |
GDBusConnection* _tmp21_; |
| 3953 |
_tmp21_ = connection; |
| 3954 |
_tmp19_ = operate_daemon_in_kde_wayland (_tmp21_, FALSE, verbose); |
| 3955 |
} else { |
| 3956 |
_tmp19_ = FALSE; |
| 3957 |
} |
| 3958 |
if (_tmp19_) { |
| 3959 |
result = EXIT_SUCCESS; |
| 3960 |
_g_object_unref0 (connection); |
| 3961 |
_g_option_context_free0 (option); |
| 3962 |
return result; |
| 3963 |
} |
| 3964 |
_g_object_unref0 (connection); |
| 3965 |
} |
| 3966 |
_tmp22_ = daemon_type; |
| 3967 |
if (g_strcmp0 (_tmp22_, "kde-wayland") == 0) { |
| 3968 |
result = EXIT_FAILURE; |
| 3969 |
_g_option_context_free0 (option); |
| 3970 |
return result; |
| 3971 |
} |
| 3972 |
_tmp23_ = get_bus (); |
| 3973 |
bus = _tmp23_; |
| 3974 |
_tmp24_ = bus; |
| 3975 |
if (_tmp24_ == NULL) { |
| 3976 |
FILE* _tmp25_; |
| 3977 |
_tmp25_ = stderr; |
| 3978 |
fprintf (_tmp25_, "%s", _ ("Can't connect to IBus.\n")); |
| 3979 |
result = EXIT_FAILURE; |
| 3980 |
_g_object_unref0 (bus); |
| 3981 |
_g_option_context_free0 (option); |
| 3982 |
return result; |
| 3983 |
} |
| 3984 |
_tmp26_ = bus; |
| 3985 |
if (exit_daemon_with_systemd (_tmp26_, verbose)) { |
| 3986 |
result = EXIT_SUCCESS; |
| 3987 |
_g_object_unref0 (bus); |
| 3988 |
_g_option_context_free0 (option); |
| 3989 |
return result; |
| 3990 |
} |
| 3991 |
_tmp27_ = daemon_type; |
| 3992 |
if (g_strcmp0 (_tmp27_, "systemd") == 0) { |
| 3993 |
result = EXIT_FAILURE; |
| 3994 |
_g_object_unref0 (bus); |
| 3995 |
_g_option_context_free0 (option); |
| 3996 |
return result; |
| 3997 |
} |
| 3998 |
_tmp28_ = bus; |
| 3999 |
ibus_bus_exit (_tmp28_, FALSE); |
| 4000 |
result = EXIT_SUCCESS; |
| 4001 |
_g_object_unref0 (bus); |
| 4002 |
_g_option_context_free0 (option); |
| 4003 |
return result; |
| 4004 |
} |
| 4005 |
|
| 4006 |
gint |
| 4007 |
print_version (gchar** argv, |
| 4008 |
gint argv_length1) |
| 4009 |
{ |
| 4010 |
gint result; |
| 4011 |
g_print ("IBus %s\n", PACKAGE_VERSION); |
| 4012 |
result = EXIT_SUCCESS; |
| 4013 |
return result; |
| 4014 |
} |
| 4015 |
|
| 4016 |
gint |
| 4017 |
read_cache (gchar** argv, |
| 4018 |
gint argv_length1) |
| 4019 |
{ |
| 4020 |
static const GOptionEntry options[3] = {{"system", (gchar) 0, (gint) 0, G_OPTION_ARG_NONE, &is_system, N_ ("Read the system registry cache."), NULL}, {"file", (gchar) 0, (gint) 0, G_OPTION_ARG_STRING, &cache_file, N_ ("Read the registry cache FILE."), "FILE"}, {NULL}}; |
| 4021 |
GOptionContext* option = NULL; |
| 4022 |
GOptionContext* _tmp0_; |
| 4023 |
GOptionContext* _tmp1_; |
| 4024 |
IBusRegistry* registry = NULL; |
| 4025 |
IBusRegistry* _tmp8_; |
| 4026 |
const gchar* _tmp9_; |
| 4027 |
GString* output = NULL; |
| 4028 |
GString* _tmp15_; |
| 4029 |
IBusRegistry* _tmp16_; |
| 4030 |
GString* _tmp17_; |
| 4031 |
GString* _tmp18_; |
| 4032 |
const gchar* _tmp19_; |
| 4033 |
GError* _inner_error0_ = NULL; |
| 4034 |
gint result; |
| 4035 |
_tmp0_ = g_option_context_new (NULL); |
| 4036 |
option = _tmp0_; |
| 4037 |
_tmp1_ = option; |
| 4038 |
g_option_context_add_main_entries (_tmp1_, options, GETTEXT_PACKAGE); |
| 4039 |
{ |
| 4040 |
GOptionContext* _tmp2_; |
| 4041 |
_tmp2_ = option; |
| 4042 |
g_option_context_parse (_tmp2_, (gint*) (&argv_length1), &argv, &_inner_error0_); |
| 4043 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 4044 |
gint _tmp3_ = -1; |
| 4045 |
if (_inner_error0_->domain == G_OPTION_ERROR) { |
| 4046 |
goto __catch0_g_option_error; |
| 4047 |
} |
| 4048 |
_g_option_context_free0 (option); |
| 4049 |
g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 4050 |
g_clear_error (&_inner_error0_); |
| 4051 |
return _tmp3_; |
| 4052 |
} |
| 4053 |
} |
| 4054 |
goto __finally0; |
| 4055 |
__catch0_g_option_error: |
| 4056 |
{ |
| 4057 |
GError* e = NULL; |
| 4058 |
FILE* _tmp4_; |
| 4059 |
GError* _tmp5_; |
| 4060 |
const gchar* _tmp6_; |
| 4061 |
e = _inner_error0_; |
| 4062 |
_inner_error0_ = NULL; |
| 4063 |
_tmp4_ = stderr; |
| 4064 |
_tmp5_ = e; |
| 4065 |
_tmp6_ = _tmp5_->message; |
| 4066 |
fprintf (_tmp4_, "%s\n", _tmp6_); |
| 4067 |
result = EXIT_FAILURE; |
| 4068 |
_g_error_free0 (e); |
| 4069 |
_g_option_context_free0 (option); |
| 4070 |
return result; |
| 4071 |
} |
| 4072 |
__finally0: |
| 4073 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 4074 |
gint _tmp7_ = -1; |
| 4075 |
_g_option_context_free0 (option); |
| 4076 |
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 4077 |
g_clear_error (&_inner_error0_); |
| 4078 |
return _tmp7_; |
| 4079 |
} |
| 4080 |
_tmp8_ = ibus_registry_new (); |
| 4081 |
g_object_ref_sink (_tmp8_); |
| 4082 |
registry = _tmp8_; |
| 4083 |
_tmp9_ = cache_file; |
| 4084 |
if (_tmp9_ != NULL) { |
| 4085 |
IBusRegistry* _tmp10_; |
| 4086 |
const gchar* _tmp11_; |
| 4087 |
_tmp10_ = registry; |
| 4088 |
_tmp11_ = cache_file; |
| 4089 |
if (!ibus_registry_load_cache_file (_tmp10_, _tmp11_)) { |
| 4090 |
FILE* _tmp12_; |
| 4091 |
_tmp12_ = stderr; |
| 4092 |
fprintf (_tmp12_, "%s", _ ("The registry cache is invalid.\n")); |
| 4093 |
result = EXIT_FAILURE; |
| 4094 |
_g_object_unref0 (registry); |
| 4095 |
_g_option_context_free0 (option); |
| 4096 |
return result; |
| 4097 |
} |
| 4098 |
} else { |
| 4099 |
IBusRegistry* _tmp13_; |
| 4100 |
_tmp13_ = registry; |
| 4101 |
if (!ibus_registry_load_cache (_tmp13_, !is_system)) { |
| 4102 |
FILE* _tmp14_; |
| 4103 |
_tmp14_ = stderr; |
| 4104 |
fprintf (_tmp14_, "%s", _ ("The registry cache is invalid.\n")); |
| 4105 |
result = EXIT_FAILURE; |
| 4106 |
_g_object_unref0 (registry); |
| 4107 |
_g_option_context_free0 (option); |
| 4108 |
return result; |
| 4109 |
} |
| 4110 |
} |
| 4111 |
_tmp15_ = g_string_new (""); |
| 4112 |
output = _tmp15_; |
| 4113 |
_tmp16_ = registry; |
| 4114 |
_tmp17_ = output; |
| 4115 |
ibus_registry_output (_tmp16_, _tmp17_, 1); |
| 4116 |
_tmp18_ = output; |
| 4117 |
_tmp19_ = _tmp18_->str; |
| 4118 |
g_print ("%s\n", _tmp19_); |
| 4119 |
result = EXIT_SUCCESS; |
| 4120 |
_g_string_free0 (output); |
| 4121 |
_g_object_unref0 (registry); |
| 4122 |
_g_option_context_free0 (option); |
| 4123 |
return result; |
| 4124 |
} |
| 4125 |
|
| 4126 |
gint |
| 4127 |
write_cache (gchar** argv, |
| 4128 |
gint argv_length1) |
| 4129 |
{ |
| 4130 |
static const GOptionEntry options[3] = {{"system", (gchar) 0, (gint) 0, G_OPTION_ARG_NONE, &is_system, N_ ("Write the system registry cache."), NULL}, {"file", (gchar) 0, (gint) 0, G_OPTION_ARG_STRING, &cache_file, N_ ("Write the registry cache FILE."), "FILE"}, {NULL}}; |
| 4131 |
GOptionContext* option = NULL; |
| 4132 |
GOptionContext* _tmp0_; |
| 4133 |
GOptionContext* _tmp1_; |
| 4134 |
IBusRegistry* registry = NULL; |
| 4135 |
IBusRegistry* _tmp8_; |
| 4136 |
IBusRegistry* _tmp9_; |
| 4137 |
const gchar* _tmp10_; |
| 4138 |
gint _tmp14_ = 0; |
| 4139 |
IBusRegistry* _tmp15_; |
| 4140 |
GError* _inner_error0_ = NULL; |
| 4141 |
gint result; |
| 4142 |
_tmp0_ = g_option_context_new (NULL); |
| 4143 |
option = _tmp0_; |
| 4144 |
_tmp1_ = option; |
| 4145 |
g_option_context_add_main_entries (_tmp1_, options, GETTEXT_PACKAGE); |
| 4146 |
{ |
| 4147 |
GOptionContext* _tmp2_; |
| 4148 |
_tmp2_ = option; |
| 4149 |
g_option_context_parse (_tmp2_, (gint*) (&argv_length1), &argv, &_inner_error0_); |
| 4150 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 4151 |
gint _tmp3_ = -1; |
| 4152 |
if (_inner_error0_->domain == G_OPTION_ERROR) { |
| 4153 |
goto __catch0_g_option_error; |
| 4154 |
} |
| 4155 |
_g_option_context_free0 (option); |
| 4156 |
g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 4157 |
g_clear_error (&_inner_error0_); |
| 4158 |
return _tmp3_; |
| 4159 |
} |
| 4160 |
} |
| 4161 |
goto __finally0; |
| 4162 |
__catch0_g_option_error: |
| 4163 |
{ |
| 4164 |
GError* e = NULL; |
| 4165 |
FILE* _tmp4_; |
| 4166 |
GError* _tmp5_; |
| 4167 |
const gchar* _tmp6_; |
| 4168 |
e = _inner_error0_; |
| 4169 |
_inner_error0_ = NULL; |
| 4170 |
_tmp4_ = stderr; |
| 4171 |
_tmp5_ = e; |
| 4172 |
_tmp6_ = _tmp5_->message; |
| 4173 |
fprintf (_tmp4_, "%s\n", _tmp6_); |
| 4174 |
result = EXIT_FAILURE; |
| 4175 |
_g_error_free0 (e); |
| 4176 |
_g_option_context_free0 (option); |
| 4177 |
return result; |
| 4178 |
} |
| 4179 |
__finally0: |
| 4180 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 4181 |
gint _tmp7_ = -1; |
| 4182 |
_g_option_context_free0 (option); |
| 4183 |
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 4184 |
g_clear_error (&_inner_error0_); |
| 4185 |
return _tmp7_; |
| 4186 |
} |
| 4187 |
_tmp8_ = ibus_registry_new (); |
| 4188 |
g_object_ref_sink (_tmp8_); |
| 4189 |
registry = _tmp8_; |
| 4190 |
_tmp9_ = registry; |
| 4191 |
ibus_registry_load (_tmp9_); |
| 4192 |
_tmp10_ = cache_file; |
| 4193 |
if (_tmp10_ != NULL) { |
| 4194 |
gint _tmp11_ = 0; |
| 4195 |
IBusRegistry* _tmp12_; |
| 4196 |
const gchar* _tmp13_; |
| 4197 |
_tmp12_ = registry; |
| 4198 |
_tmp13_ = cache_file; |
| 4199 |
if (ibus_registry_save_cache_file (_tmp12_, _tmp13_)) { |
| 4200 |
_tmp11_ = EXIT_SUCCESS; |
| 4201 |
} else { |
| 4202 |
_tmp11_ = EXIT_FAILURE; |
| 4203 |
} |
| 4204 |
result = _tmp11_; |
| 4205 |
_g_object_unref0 (registry); |
| 4206 |
_g_option_context_free0 (option); |
| 4207 |
return result; |
| 4208 |
} |
| 4209 |
_tmp15_ = registry; |
| 4210 |
if (ibus_registry_save_cache (_tmp15_, !is_system)) { |
| 4211 |
_tmp14_ = EXIT_SUCCESS; |
| 4212 |
} else { |
| 4213 |
_tmp14_ = EXIT_FAILURE; |
| 4214 |
} |
| 4215 |
result = _tmp14_; |
| 4216 |
_g_object_unref0 (registry); |
| 4217 |
_g_option_context_free0 (option); |
| 4218 |
return result; |
| 4219 |
} |
| 4220 |
|
| 4221 |
gint |
| 4222 |
print_address (gchar** argv, |
| 4223 |
gint argv_length1) |
| 4224 |
{ |
| 4225 |
gchar* address = NULL; |
| 4226 |
const gchar* _tmp0_; |
| 4227 |
gchar* _tmp1_; |
| 4228 |
const gchar* _tmp2_ = NULL; |
| 4229 |
const gchar* _tmp3_; |
| 4230 |
gint result; |
| 4231 |
_tmp0_ = ibus_get_address (); |
| 4232 |
_tmp1_ = g_strdup (_tmp0_); |
| 4233 |
address = _tmp1_; |
| 4234 |
_tmp3_ = address; |
| 4235 |
if (_tmp3_ != NULL) { |
| 4236 |
const gchar* _tmp4_; |
| 4237 |
_tmp4_ = address; |
| 4238 |
_tmp2_ = _tmp4_; |
| 4239 |
} else { |
| 4240 |
_tmp2_ = "(null)"; |
| 4241 |
} |
| 4242 |
g_print ("%s\n", _tmp2_); |
| 4243 |
result = EXIT_SUCCESS; |
| 4244 |
_g_free0 (address); |
| 4245 |
return result; |
| 4246 |
} |
| 4247 |
|
| 4248 |
gint |
| 4249 |
read_config_options (gchar** argv, |
| 4250 |
gint argv_length1) |
| 4251 |
{ |
| 4252 |
static const GOptionEntry options[2] = {{"engine-id", (gchar) 0, (gint) 0, G_OPTION_ARG_STRING, &engine_id, N_ ("Use engine schema paths instead of ibus core, " "which can be comma-separated values."), "ENGINE_ID"}, {NULL}}; |
| 4253 |
GOptionContext* option = NULL; |
| 4254 |
GOptionContext* _tmp0_; |
| 4255 |
GOptionContext* _tmp1_; |
| 4256 |
GError* _inner_error0_ = NULL; |
| 4257 |
gint result; |
| 4258 |
_tmp0_ = g_option_context_new (NULL); |
| 4259 |
option = _tmp0_; |
| 4260 |
_tmp1_ = option; |
| 4261 |
g_option_context_add_main_entries (_tmp1_, options, GETTEXT_PACKAGE); |
| 4262 |
{ |
| 4263 |
GOptionContext* _tmp2_; |
| 4264 |
_tmp2_ = option; |
| 4265 |
g_option_context_parse (_tmp2_, (gint*) (&argv_length1), &argv, &_inner_error0_); |
| 4266 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 4267 |
gint _tmp3_ = -1; |
| 4268 |
if (_inner_error0_->domain == G_OPTION_ERROR) { |
| 4269 |
goto __catch0_g_option_error; |
| 4270 |
} |
| 4271 |
_g_option_context_free0 (option); |
| 4272 |
g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 4273 |
g_clear_error (&_inner_error0_); |
| 4274 |
return _tmp3_; |
| 4275 |
} |
| 4276 |
} |
| 4277 |
goto __finally0; |
| 4278 |
__catch0_g_option_error: |
| 4279 |
{ |
| 4280 |
GError* e = NULL; |
| 4281 |
FILE* _tmp4_; |
| 4282 |
GError* _tmp5_; |
| 4283 |
const gchar* _tmp6_; |
| 4284 |
e = _inner_error0_; |
| 4285 |
_inner_error0_ = NULL; |
| 4286 |
_tmp4_ = stderr; |
| 4287 |
_tmp5_ = e; |
| 4288 |
_tmp6_ = _tmp5_->message; |
| 4289 |
fprintf (_tmp4_, "%s\n", _tmp6_); |
| 4290 |
result = EXIT_FAILURE; |
| 4291 |
_g_error_free0 (e); |
| 4292 |
_g_option_context_free0 (option); |
| 4293 |
return result; |
| 4294 |
} |
| 4295 |
__finally0: |
| 4296 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 4297 |
gint _tmp7_ = -1; |
| 4298 |
_g_option_context_free0 (option); |
| 4299 |
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 4300 |
g_clear_error (&_inner_error0_); |
| 4301 |
return _tmp7_; |
| 4302 |
} |
| 4303 |
result = EXIT_SUCCESS; |
| 4304 |
_g_option_context_free0 (option); |
| 4305 |
return result; |
| 4306 |
} |
| 4307 |
|
| 4308 |
static gpointer |
| 4309 |
_g_settings_schema_source_ref0 (gpointer self) |
| 4310 |
{ |
| 4311 |
return self ? g_settings_schema_source_ref (self) : NULL; |
| 4312 |
} |
| 4313 |
|
| 4314 |
GSList* |
| 4315 |
get_ibus_schemas (void) |
| 4316 |
{ |
| 4317 |
gchar** ids = NULL; |
| 4318 |
gchar** _tmp0_; |
| 4319 |
gint ids_length1; |
| 4320 |
gint _ids_size_; |
| 4321 |
const gchar* _tmp1_; |
| 4322 |
GSList* ibus_schemas = NULL; |
| 4323 |
GSettingsSchemaSource* schema_source = NULL; |
| 4324 |
GSettingsSchemaSource* _tmp5_; |
| 4325 |
GSettingsSchemaSource* _tmp6_; |
| 4326 |
gchar** list_schemas = NULL; |
| 4327 |
gchar** _tmp7_; |
| 4328 |
gint list_schemas_length1; |
| 4329 |
gint _list_schemas_size_; |
| 4330 |
GSettingsSchemaSource* _tmp8_; |
| 4331 |
gchar** _tmp9_ = NULL; |
| 4332 |
gchar** _tmp10_; |
| 4333 |
gint _tmp10__length1; |
| 4334 |
GSList* _tmp28_; |
| 4335 |
GCompareFunc _tmp29_; |
| 4336 |
GSList* result; |
| 4337 |
_tmp0_ = g_new0 (gchar*, 0 + 1); |
| 4338 |
ids = _tmp0_; |
| 4339 |
ids_length1 = 0; |
| 4340 |
_ids_size_ = ids_length1; |
| 4341 |
_tmp1_ = engine_id; |
| 4342 |
if (_tmp1_ != NULL) { |
| 4343 |
const gchar* _tmp2_; |
| 4344 |
gchar** _tmp3_; |
| 4345 |
gchar** _tmp4_; |
| 4346 |
_tmp2_ = engine_id; |
| 4347 |
_tmp4_ = _tmp3_ = g_strsplit (_tmp2_, ",", 0); |
| 4348 |
ids = (_vala_array_free (ids, ids_length1, (GDestroyNotify) g_free), NULL); |
| 4349 |
ids = _tmp4_; |
| 4350 |
ids_length1 = _vala_array_length (_tmp3_); |
| 4351 |
_ids_size_ = ids_length1; |
| 4352 |
} |
| 4353 |
ibus_schemas = NULL; |
| 4354 |
_tmp5_ = g_settings_schema_source_get_default (); |
| 4355 |
_tmp6_ = _g_settings_schema_source_ref0 (_tmp5_); |
| 4356 |
schema_source = _tmp6_; |
| 4357 |
_tmp7_ = g_new0 (gchar*, 0 + 1); |
| 4358 |
list_schemas = _tmp7_; |
| 4359 |
list_schemas_length1 = 0; |
| 4360 |
_list_schemas_size_ = list_schemas_length1; |
| 4361 |
_tmp8_ = schema_source; |
| 4362 |
g_settings_schema_source_list_schemas (_tmp8_, TRUE, &_tmp9_, NULL); |
| 4363 |
list_schemas = (_vala_array_free (list_schemas, list_schemas_length1, (GDestroyNotify) g_free), NULL); |
| 4364 |
list_schemas = _tmp9_; |
| 4365 |
list_schemas_length1 = -1; |
| 4366 |
_list_schemas_size_ = list_schemas_length1; |
| 4367 |
list_schemas_length1 = _vala_array_length (list_schemas); |
| 4368 |
_tmp10_ = list_schemas; |
| 4369 |
_tmp10__length1 = list_schemas_length1; |
| 4370 |
{ |
| 4371 |
gchar** schema_collection = NULL; |
| 4372 |
gint schema_collection_length1 = 0; |
| 4373 |
gint _schema_collection_size_ = 0; |
| 4374 |
gint schema_it = 0; |
| 4375 |
schema_collection = _tmp10_; |
| 4376 |
schema_collection_length1 = _tmp10__length1; |
| 4377 |
for (schema_it = 0; schema_it < schema_collection_length1; schema_it = schema_it + 1) { |
| 4378 |
gchar* _tmp11_; |
| 4379 |
gchar* schema = NULL; |
| 4380 |
_tmp11_ = g_strdup (schema_collection[schema_it]); |
| 4381 |
schema = _tmp11_; |
| 4382 |
{ |
| 4383 |
gchar** _tmp12_; |
| 4384 |
gint _tmp12__length1; |
| 4385 |
_tmp12_ = ids; |
| 4386 |
_tmp12__length1 = ids_length1; |
| 4387 |
if (_tmp12__length1 != 0) { |
| 4388 |
gchar** _tmp13_; |
| 4389 |
gint _tmp13__length1; |
| 4390 |
_tmp13_ = ids; |
| 4391 |
_tmp13__length1 = ids_length1; |
| 4392 |
{ |
| 4393 |
gchar** id_collection = NULL; |
| 4394 |
gint id_collection_length1 = 0; |
| 4395 |
gint _id_collection_size_ = 0; |
| 4396 |
gint id_it = 0; |
| 4397 |
id_collection = _tmp13_; |
| 4398 |
id_collection_length1 = _tmp13__length1; |
| 4399 |
for (id_it = 0; id_it < id_collection_length1; id_it = id_it + 1) { |
| 4400 |
const gchar* id = NULL; |
| 4401 |
id = id_collection[id_it]; |
| 4402 |
{ |
| 4403 |
gboolean _tmp14_ = FALSE; |
| 4404 |
const gchar* _tmp15_; |
| 4405 |
const gchar* _tmp16_; |
| 4406 |
_tmp15_ = id; |
| 4407 |
_tmp16_ = schema; |
| 4408 |
if (g_strcmp0 (_tmp15_, _tmp16_) == 0) { |
| 4409 |
_tmp14_ = TRUE; |
| 4410 |
} else { |
| 4411 |
const gchar* _tmp17_; |
| 4412 |
const gchar* _tmp18_; |
| 4413 |
gchar* _tmp19_; |
| 4414 |
gchar* _tmp20_; |
| 4415 |
_tmp17_ = schema; |
| 4416 |
_tmp18_ = id; |
| 4417 |
_tmp19_ = g_strconcat ("org.freedesktop.ibus.engine.", _tmp18_, NULL); |
| 4418 |
_tmp20_ = _tmp19_; |
| 4419 |
_tmp14_ = g_str_has_prefix (_tmp17_, _tmp20_); |
| 4420 |
_g_free0 (_tmp20_); |
| 4421 |
} |
| 4422 |
if (_tmp14_) { |
| 4423 |
const gchar* _tmp21_; |
| 4424 |
gchar* _tmp22_; |
| 4425 |
_tmp21_ = schema; |
| 4426 |
_tmp22_ = g_strdup (_tmp21_); |
| 4427 |
ibus_schemas = g_slist_prepend (ibus_schemas, _tmp22_); |
| 4428 |
break; |
| 4429 |
} |
| 4430 |
} |
| 4431 |
} |
| 4432 |
} |
| 4433 |
} else { |
| 4434 |
gboolean _tmp23_ = FALSE; |
| 4435 |
const gchar* _tmp24_; |
| 4436 |
_tmp24_ = schema; |
| 4437 |
if (g_str_has_prefix (_tmp24_, "org.freedesktop.ibus")) { |
| 4438 |
const gchar* _tmp25_; |
| 4439 |
_tmp25_ = schema; |
| 4440 |
_tmp23_ = !g_str_has_prefix (_tmp25_, "org.freedesktop.ibus.engine"); |
| 4441 |
} else { |
| 4442 |
_tmp23_ = FALSE; |
| 4443 |
} |
| 4444 |
if (_tmp23_) { |
| 4445 |
const gchar* _tmp26_; |
| 4446 |
gchar* _tmp27_; |
| 4447 |
_tmp26_ = schema; |
| 4448 |
_tmp27_ = g_strdup (_tmp26_); |
| 4449 |
ibus_schemas = g_slist_prepend (ibus_schemas, _tmp27_); |
| 4450 |
} |
| 4451 |
} |
| 4452 |
_g_free0 (schema); |
| 4453 |
} |
| 4454 |
} |
| 4455 |
} |
| 4456 |
_tmp28_ = ibus_schemas; |
| 4457 |
if (g_slist_length (_tmp28_) == ((guint) 0)) { |
| 4458 |
g_printerr ("Not found schemas of \"org.freedesktop.ibus\"\n"); |
| 4459 |
result = ibus_schemas; |
| 4460 |
list_schemas = (_vala_array_free (list_schemas, list_schemas_length1, (GDestroyNotify) g_free), NULL); |
| 4461 |
_g_settings_schema_source_unref0 (schema_source); |
| 4462 |
ids = (_vala_array_free (ids, ids_length1, (GDestroyNotify) g_free), NULL); |
| 4463 |
return result; |
| 4464 |
} |
| 4465 |
_tmp29_ = ((GCompareFunc) g_strcmp0); |
| 4466 |
ibus_schemas = g_slist_sort (ibus_schemas, _tmp29_); |
| 4467 |
result = ibus_schemas; |
| 4468 |
list_schemas = (_vala_array_free (list_schemas, list_schemas_length1, (GDestroyNotify) g_free), NULL); |
| 4469 |
_g_settings_schema_source_unref0 (schema_source); |
| 4470 |
ids = (_vala_array_free (ids, ids_length1, (GDestroyNotify) g_free), NULL); |
| 4471 |
return result; |
| 4472 |
} |
| 4473 |
|
| 4474 |
static inline void |
| 4475 |
_g_slist_free__g_free0_ (GSList* self) |
| 4476 |
{ |
| 4477 |
g_slist_free_full (self, (GDestroyNotify) _g_free0_); |
| 4478 |
} |
| 4479 |
|
| 4480 |
gint |
| 4481 |
read_config (gchar** argv, |
| 4482 |
gint argv_length1) |
| 4483 |
{ |
| 4484 |
GSList* ibus_schemas = NULL; |
| 4485 |
GSList* _tmp0_; |
| 4486 |
GSList* _tmp1_; |
| 4487 |
GSettingsSchemaSource* schema_source = NULL; |
| 4488 |
GSettingsSchemaSource* _tmp2_; |
| 4489 |
GSettingsSchemaSource* _tmp3_; |
| 4490 |
GString* output = NULL; |
| 4491 |
GString* _tmp4_; |
| 4492 |
GSList* _tmp5_; |
| 4493 |
GString* _tmp26_; |
| 4494 |
const gchar* _tmp27_; |
| 4495 |
gint result; |
| 4496 |
if (read_config_options (argv, (gint) argv_length1) == EXIT_FAILURE) { |
| 4497 |
result = EXIT_FAILURE; |
| 4498 |
return result; |
| 4499 |
} |
| 4500 |
_tmp0_ = get_ibus_schemas (); |
| 4501 |
ibus_schemas = _tmp0_; |
| 4502 |
_tmp1_ = ibus_schemas; |
| 4503 |
if (g_slist_length (_tmp1_) == ((guint) 0)) { |
| 4504 |
result = EXIT_FAILURE; |
| 4505 |
(ibus_schemas == NULL) ? NULL : (ibus_schemas = (_g_slist_free__g_free0_ (ibus_schemas), NULL)); |
| 4506 |
return result; |
| 4507 |
} |
| 4508 |
_tmp2_ = g_settings_schema_source_get_default (); |
| 4509 |
_tmp3_ = _g_settings_schema_source_ref0 (_tmp2_); |
| 4510 |
schema_source = _tmp3_; |
| 4511 |
_tmp4_ = g_string_new (""); |
| 4512 |
output = _tmp4_; |
| 4513 |
_tmp5_ = ibus_schemas; |
| 4514 |
{ |
| 4515 |
GSList* schema_collection = NULL; |
| 4516 |
GSList* schema_it = NULL; |
| 4517 |
schema_collection = _tmp5_; |
| 4518 |
for (schema_it = schema_collection; schema_it != NULL; schema_it = schema_it->next) { |
| 4519 |
gchar* _tmp6_; |
| 4520 |
gchar* schema = NULL; |
| 4521 |
_tmp6_ = g_strdup ((const gchar*) schema_it->data); |
| 4522 |
schema = _tmp6_; |
| 4523 |
{ |
| 4524 |
GSettingsSchema* settings_schema = NULL; |
| 4525 |
GSettingsSchemaSource* _tmp7_; |
| 4526 |
const gchar* _tmp8_; |
| 4527 |
GSettingsSchema* _tmp9_; |
| 4528 |
GSettings* settings = NULL; |
| 4529 |
const gchar* _tmp10_; |
| 4530 |
GSettings* _tmp11_; |
| 4531 |
GString* _tmp12_; |
| 4532 |
const gchar* _tmp13_; |
| 4533 |
GSettingsSchema* _tmp14_; |
| 4534 |
gchar** _tmp15_; |
| 4535 |
gchar** _tmp16_; |
| 4536 |
_tmp7_ = schema_source; |
| 4537 |
_tmp8_ = schema; |
| 4538 |
_tmp9_ = g_settings_schema_source_lookup (_tmp7_, _tmp8_, FALSE); |
| 4539 |
settings_schema = _tmp9_; |
| 4540 |
_tmp10_ = schema; |
| 4541 |
_tmp11_ = g_settings_new (_tmp10_); |
| 4542 |
settings = _tmp11_; |
| 4543 |
_tmp12_ = output; |
| 4544 |
_tmp13_ = schema; |
| 4545 |
g_string_append_printf (_tmp12_, "SCHEMA: %s\n", _tmp13_); |
| 4546 |
_tmp14_ = settings_schema; |
| 4547 |
_tmp16_ = _tmp15_ = g_settings_schema_list_keys (_tmp14_); |
| 4548 |
{ |
| 4549 |
gchar** key_collection = NULL; |
| 4550 |
gint key_collection_length1 = 0; |
| 4551 |
gint _key_collection_size_ = 0; |
| 4552 |
gint key_it = 0; |
| 4553 |
key_collection = _tmp16_; |
| 4554 |
key_collection_length1 = _vala_array_length (_tmp15_); |
| 4555 |
for (key_it = 0; key_it < key_collection_length1; key_it = key_it + 1) { |
| 4556 |
gchar* _tmp17_; |
| 4557 |
gchar* key = NULL; |
| 4558 |
_tmp17_ = g_strdup (key_collection[key_it]); |
| 4559 |
key = _tmp17_; |
| 4560 |
{ |
| 4561 |
GVariant* variant = NULL; |
| 4562 |
GSettings* _tmp18_; |
| 4563 |
const gchar* _tmp19_; |
| 4564 |
GVariant* _tmp20_; |
| 4565 |
GString* _tmp21_; |
| 4566 |
const gchar* _tmp22_; |
| 4567 |
GVariant* _tmp23_; |
| 4568 |
gchar* _tmp24_; |
| 4569 |
gchar* _tmp25_; |
| 4570 |
_tmp18_ = settings; |
| 4571 |
_tmp19_ = key; |
| 4572 |
_tmp20_ = g_settings_get_value (_tmp18_, _tmp19_); |
| 4573 |
variant = _tmp20_; |
| 4574 |
_tmp21_ = output; |
| 4575 |
_tmp22_ = key; |
| 4576 |
_tmp23_ = variant; |
| 4577 |
_tmp24_ = g_variant_print (_tmp23_, TRUE); |
| 4578 |
_tmp25_ = _tmp24_; |
| 4579 |
g_string_append_printf (_tmp21_, " %s: %s\n", _tmp22_, _tmp25_); |
| 4580 |
_g_free0 (_tmp25_); |
| 4581 |
_g_variant_unref0 (variant); |
| 4582 |
_g_free0 (key); |
| 4583 |
} |
| 4584 |
} |
| 4585 |
key_collection = (_vala_array_free (key_collection, key_collection_length1, (GDestroyNotify) g_free), NULL); |
| 4586 |
} |
| 4587 |
_g_object_unref0 (settings); |
| 4588 |
_g_settings_schema_unref0 (settings_schema); |
| 4589 |
_g_free0 (schema); |
| 4590 |
} |
| 4591 |
} |
| 4592 |
} |
| 4593 |
_tmp26_ = output; |
| 4594 |
_tmp27_ = _tmp26_->str; |
| 4595 |
g_print ("%s", _tmp27_); |
| 4596 |
result = EXIT_SUCCESS; |
| 4597 |
_g_string_free0 (output); |
| 4598 |
_g_settings_schema_source_unref0 (schema_source); |
| 4599 |
(ibus_schemas == NULL) ? NULL : (ibus_schemas = (_g_slist_free__g_free0_ (ibus_schemas), NULL)); |
| 4600 |
return result; |
| 4601 |
} |
| 4602 |
|
| 4603 |
gint |
| 4604 |
reset_config (gchar** argv, |
| 4605 |
gint argv_length1) |
| 4606 |
{ |
| 4607 |
GSList* ibus_schemas = NULL; |
| 4608 |
GSList* _tmp0_; |
| 4609 |
GSList* _tmp1_; |
| 4610 |
GSettingsSchemaSource* schema_source = NULL; |
| 4611 |
GSettingsSchemaSource* _tmp2_; |
| 4612 |
GSettingsSchemaSource* _tmp3_; |
| 4613 |
GSList* _tmp4_; |
| 4614 |
gint result; |
| 4615 |
if (read_config_options (argv, (gint) argv_length1) == EXIT_FAILURE) { |
| 4616 |
result = EXIT_FAILURE; |
| 4617 |
return result; |
| 4618 |
} |
| 4619 |
_tmp0_ = get_ibus_schemas (); |
| 4620 |
ibus_schemas = _tmp0_; |
| 4621 |
_tmp1_ = ibus_schemas; |
| 4622 |
if (g_slist_length (_tmp1_) == ((guint) 0)) { |
| 4623 |
result = EXIT_FAILURE; |
| 4624 |
(ibus_schemas == NULL) ? NULL : (ibus_schemas = (_g_slist_free__g_free0_ (ibus_schemas), NULL)); |
| 4625 |
return result; |
| 4626 |
} |
| 4627 |
g_print ("%s\n", _ ("Resetting…")); |
| 4628 |
_tmp2_ = g_settings_schema_source_get_default (); |
| 4629 |
_tmp3_ = _g_settings_schema_source_ref0 (_tmp2_); |
| 4630 |
schema_source = _tmp3_; |
| 4631 |
_tmp4_ = ibus_schemas; |
| 4632 |
{ |
| 4633 |
GSList* schema_collection = NULL; |
| 4634 |
GSList* schema_it = NULL; |
| 4635 |
schema_collection = _tmp4_; |
| 4636 |
for (schema_it = schema_collection; schema_it != NULL; schema_it = schema_it->next) { |
| 4637 |
gchar* _tmp5_; |
| 4638 |
gchar* schema = NULL; |
| 4639 |
_tmp5_ = g_strdup ((const gchar*) schema_it->data); |
| 4640 |
schema = _tmp5_; |
| 4641 |
{ |
| 4642 |
GSettingsSchema* settings_schema = NULL; |
| 4643 |
GSettingsSchemaSource* _tmp6_; |
| 4644 |
const gchar* _tmp7_; |
| 4645 |
GSettingsSchema* _tmp8_; |
| 4646 |
GSettings* settings = NULL; |
| 4647 |
const gchar* _tmp9_; |
| 4648 |
GSettings* _tmp10_; |
| 4649 |
const gchar* _tmp11_; |
| 4650 |
GSettingsSchema* _tmp12_; |
| 4651 |
gchar** _tmp13_; |
| 4652 |
gchar** _tmp14_; |
| 4653 |
_tmp6_ = schema_source; |
| 4654 |
_tmp7_ = schema; |
| 4655 |
_tmp8_ = g_settings_schema_source_lookup (_tmp6_, _tmp7_, FALSE); |
| 4656 |
settings_schema = _tmp8_; |
| 4657 |
_tmp9_ = schema; |
| 4658 |
_tmp10_ = g_settings_new (_tmp9_); |
| 4659 |
settings = _tmp10_; |
| 4660 |
_tmp11_ = schema; |
| 4661 |
g_print ("SCHEMA: %s\n", _tmp11_); |
| 4662 |
_tmp12_ = settings_schema; |
| 4663 |
_tmp14_ = _tmp13_ = g_settings_schema_list_keys (_tmp12_); |
| 4664 |
{ |
| 4665 |
gchar** key_collection = NULL; |
| 4666 |
gint key_collection_length1 = 0; |
| 4667 |
gint _key_collection_size_ = 0; |
| 4668 |
gint key_it = 0; |
| 4669 |
key_collection = _tmp14_; |
| 4670 |
key_collection_length1 = _vala_array_length (_tmp13_); |
| 4671 |
for (key_it = 0; key_it < key_collection_length1; key_it = key_it + 1) { |
| 4672 |
gchar* _tmp15_; |
| 4673 |
gchar* key = NULL; |
| 4674 |
_tmp15_ = g_strdup (key_collection[key_it]); |
| 4675 |
key = _tmp15_; |
| 4676 |
{ |
| 4677 |
const gchar* _tmp16_; |
| 4678 |
GSettings* _tmp17_; |
| 4679 |
const gchar* _tmp18_; |
| 4680 |
_tmp16_ = key; |
| 4681 |
g_print (" %s\n", _tmp16_); |
| 4682 |
_tmp17_ = settings; |
| 4683 |
_tmp18_ = key; |
| 4684 |
g_settings_reset (_tmp17_, _tmp18_); |
| 4685 |
_g_free0 (key); |
| 4686 |
} |
| 4687 |
} |
| 4688 |
key_collection = (_vala_array_free (key_collection, key_collection_length1, (GDestroyNotify) g_free), NULL); |
| 4689 |
} |
| 4690 |
_g_object_unref0 (settings); |
| 4691 |
_g_settings_schema_unref0 (settings_schema); |
| 4692 |
_g_free0 (schema); |
| 4693 |
} |
| 4694 |
} |
| 4695 |
} |
| 4696 |
g_settings_sync (); |
| 4697 |
g_print ("%s\n", _ ("Done")); |
| 4698 |
result = EXIT_SUCCESS; |
| 4699 |
_g_settings_schema_source_unref0 (schema_source); |
| 4700 |
(ibus_schemas == NULL) ? NULL : (ibus_schemas = (_g_slist_free__g_free0_ (ibus_schemas), NULL)); |
| 4701 |
return result; |
| 4702 |
} |
| 4703 |
|
| 4704 |
gint |
| 4705 |
emoji_dialog (gchar** argv, |
| 4706 |
gint argv_length1) |
| 4707 |
{ |
| 4708 |
gchar* cmd = NULL; |
| 4709 |
gchar* _tmp0_; |
| 4710 |
GFile* file = NULL; |
| 4711 |
const gchar* _tmp1_; |
| 4712 |
GFile* _tmp2_; |
| 4713 |
GFile* _tmp3_; |
| 4714 |
const gchar* _tmp5_; |
| 4715 |
gchar* _tmp6_; |
| 4716 |
gchar** env = NULL; |
| 4717 |
gchar** _tmp7_; |
| 4718 |
gchar** _tmp8_; |
| 4719 |
gint env_length1; |
| 4720 |
gint _env_size_; |
| 4721 |
GError* _inner_error0_ = NULL; |
| 4722 |
gint result; |
| 4723 |
_tmp0_ = g_strdup (LIBEXECDIR "/ibus-ui-emojier"); |
| 4724 |
cmd = _tmp0_; |
| 4725 |
_tmp1_ = cmd; |
| 4726 |
_tmp2_ = g_file_new_for_path (_tmp1_); |
| 4727 |
file = _tmp2_; |
| 4728 |
_tmp3_ = file; |
| 4729 |
if (!g_file_query_exists (_tmp3_, NULL)) { |
| 4730 |
gchar* _tmp4_; |
| 4731 |
_tmp4_ = g_strdup ("../ui/gtk3/ibus-ui-emojier"); |
| 4732 |
_g_free0 (cmd); |
| 4733 |
cmd = _tmp4_; |
| 4734 |
} |
| 4735 |
_tmp5_ = cmd; |
| 4736 |
_tmp6_ = g_strdup (_tmp5_); |
| 4737 |
_g_free0 (argv[0]); |
| 4738 |
argv[0] = _tmp6_; |
| 4739 |
_tmp8_ = _tmp7_ = g_get_environ (); |
| 4740 |
env = _tmp8_; |
| 4741 |
env_length1 = _vala_array_length (_tmp7_); |
| 4742 |
_env_size_ = env_length1; |
| 4743 |
{ |
| 4744 |
gchar** _tmp9_; |
| 4745 |
gint _tmp9__length1; |
| 4746 |
_tmp9_ = env; |
| 4747 |
_tmp9__length1 = env_length1; |
| 4748 |
g_spawn_async (NULL, argv, _tmp9_, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &_inner_error0_); |
| 4749 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 4750 |
gint _tmp10_ = -1; |
| 4751 |
if (_inner_error0_->domain == G_SPAWN_ERROR) { |
| 4752 |
goto __catch0_g_spawn_error; |
| 4753 |
} |
| 4754 |
env = (_vala_array_free (env, env_length1, (GDestroyNotify) g_free), NULL); |
| 4755 |
_g_object_unref0 (file); |
| 4756 |
_g_free0 (cmd); |
| 4757 |
g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 4758 |
g_clear_error (&_inner_error0_); |
| 4759 |
return _tmp10_; |
| 4760 |
} |
| 4761 |
} |
| 4762 |
goto __finally0; |
| 4763 |
__catch0_g_spawn_error: |
| 4764 |
{ |
| 4765 |
GError* e = NULL; |
| 4766 |
FILE* _tmp11_; |
| 4767 |
GError* _tmp12_; |
| 4768 |
const gchar* _tmp13_; |
| 4769 |
e = _inner_error0_; |
| 4770 |
_inner_error0_ = NULL; |
| 4771 |
_tmp11_ = stderr; |
| 4772 |
_tmp12_ = e; |
| 4773 |
_tmp13_ = _tmp12_->message; |
| 4774 |
fprintf (_tmp11_, "%s\n", _tmp13_); |
| 4775 |
result = EXIT_FAILURE; |
| 4776 |
_g_error_free0 (e); |
| 4777 |
env = (_vala_array_free (env, env_length1, (GDestroyNotify) g_free), NULL); |
| 4778 |
_g_object_unref0 (file); |
| 4779 |
_g_free0 (cmd); |
| 4780 |
return result; |
| 4781 |
} |
| 4782 |
__finally0: |
| 4783 |
if (G_UNLIKELY (_inner_error0_ != NULL)) { |
| 4784 |
gint _tmp14_ = -1; |
| 4785 |
env = (_vala_array_free (env, env_length1, (GDestroyNotify) g_free), NULL); |
| 4786 |
_g_object_unref0 (file); |
| 4787 |
_g_free0 (cmd); |
| 4788 |
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); |
| 4789 |
g_clear_error (&_inner_error0_); |
| 4790 |
return _tmp14_; |
| 4791 |
} |
| 4792 |
result = EXIT_SUCCESS; |
| 4793 |
env = (_vala_array_free (env, env_length1, (GDestroyNotify) g_free), NULL); |
| 4794 |
_g_object_unref0 (file); |
| 4795 |
_g_free0 (cmd); |
| 4796 |
return result; |
| 4797 |
} |
| 4798 |
|
| 4799 |
gint |
| 4800 |
read_im_module (gchar** argv, |
| 4801 |
gint argv_length1) |
| 4802 |
{ |
| 4803 |
gchar* im_module = NULL; |
| 4804 |
gchar* _tmp0_; |
| 4805 |
const gchar* _tmp1_; |
| 4806 |
const gchar* _tmp2_; |
| 4807 |
gchar* _tmp3_; |
| 4808 |
gchar* _tmp4_; |
| 4809 |
gint result; |
| 4810 |
_tmp0_ = ibus_im_module_get_id ((gint) argv_length1, argv); |
| 4811 |
im_module = _tmp0_; |
| 4812 |
_tmp1_ = im_module; |
| 4813 |
if (_tmp1_ == NULL) { |
| 4814 |
result = EXIT_FAILURE; |
| 4815 |
_g_free0 (im_module); |
| 4816 |
return result; |
| 4817 |
} |
| 4818 |
_tmp2_ = im_module; |
| 4819 |
_tmp3_ = g_strdup_printf ("%s\n", _tmp2_); |
| 4820 |
_tmp4_ = _tmp3_; |
| 4821 |
g_print ("%s", _tmp4_); |
| 4822 |
_g_free0 (_tmp4_); |
| 4823 |
result = EXIT_SUCCESS; |
| 4824 |
_g_free0 (im_module); |
| 4825 |
return result; |
| 4826 |
} |
| 4827 |
|
| 4828 |
gint |
| 4829 |
print_help (gchar** argv, |
| 4830 |
gint argv_length1) |
| 4831 |
{ |
| 4832 |
FILE* _tmp0_; |
| 4833 |
gint result; |
| 4834 |
_tmp0_ = stdout; |
| 4835 |
print_usage (_tmp0_); |
| 4836 |
result = EXIT_SUCCESS; |
| 4837 |
return result; |
| 4838 |
} |
| 4839 |
|
| 4840 |
CommandEntry* |
| 4841 |
command_entry_dup (const CommandEntry* self) |
| 4842 |
{ |
| 4843 |
CommandEntry* dup; |
| 4844 |
dup = g_new0 (CommandEntry, 1); |
| 4845 |
memcpy (dup, self, sizeof (CommandEntry)); |
| 4846 |
return dup; |
| 4847 |
} |
| 4848 |
|
| 4849 |
void |
| 4850 |
command_entry_free (CommandEntry* self) |
| 4851 |
{ |
| 4852 |
g_free (self); |
| 4853 |
} |
| 4854 |
|
| 4855 |
static GType |
| 4856 |
command_entry_get_type_once (void) |
| 4857 |
{ |
| 4858 |
GType command_entry_type_id; |
| 4859 |
command_entry_type_id = g_boxed_type_register_static ("CommandEntry", (GBoxedCopyFunc) command_entry_dup, (GBoxedFreeFunc) command_entry_free); |
| 4860 |
return command_entry_type_id; |
| 4861 |
} |
| 4862 |
|
| 4863 |
GType |
| 4864 |
command_entry_get_type (void) |
| 4865 |
{ |
| 4866 |
static volatile gsize command_entry_type_id__once = 0; |
| 4867 |
if (g_once_init_enter (&command_entry_type_id__once)) { |
| 4868 |
GType command_entry_type_id; |
| 4869 |
command_entry_type_id = command_entry_get_type_once (); |
| 4870 |
g_once_init_leave (&command_entry_type_id__once, command_entry_type_id); |
| 4871 |
} |
| 4872 |
return command_entry_type_id__once; |
| 4873 |
} |
| 4874 |
|
| 4875 |
static gint |
| 4876 |
_get_set_engine_entry_func (gchar** argv, |
| 4877 |
gint argv_length1, |
| 4878 |
gpointer self) |
| 4879 |
{ |
| 4880 |
gint result; |
| 4881 |
result = get_set_engine (argv, argv_length1); |
| 4882 |
return result; |
| 4883 |
} |
| 4884 |
|
| 4885 |
static gint |
| 4886 |
_exit_daemon_entry_func (gchar** argv, |
| 4887 |
gint argv_length1, |
| 4888 |
gpointer self) |
| 4889 |
{ |
| 4890 |
gint result; |
| 4891 |
result = exit_daemon (argv, argv_length1); |
| 4892 |
return result; |
| 4893 |
} |
| 4894 |
|
| 4895 |
static gint |
| 4896 |
_list_engine_entry_func (gchar** argv, |
| 4897 |
gint argv_length1, |
| 4898 |
gpointer self) |
| 4899 |
{ |
| 4900 |
gint result; |
| 4901 |
result = list_engine (argv, argv_length1); |
| 4902 |
return result; |
| 4903 |
} |
| 4904 |
|
| 4905 |
static gint |
| 4906 |
_message_watch_entry_func (gchar** argv, |
| 4907 |
gint argv_length1, |
| 4908 |
gpointer self) |
| 4909 |
{ |
| 4910 |
gint result; |
| 4911 |
result = message_watch (argv, argv_length1); |
| 4912 |
return result; |
| 4913 |
} |
| 4914 |
|
| 4915 |
static gint |
| 4916 |
_restart_daemon_entry_func (gchar** argv, |
| 4917 |
gint argv_length1, |
| 4918 |
gpointer self) |
| 4919 |
{ |
| 4920 |
gint result; |
| 4921 |
result = restart_daemon (argv, argv_length1); |
| 4922 |
return result; |
| 4923 |
} |
| 4924 |
|
| 4925 |
static gint |
| 4926 |
_start_daemon_entry_func (gchar** argv, |
| 4927 |
gint argv_length1, |
| 4928 |
gpointer self) |
| 4929 |
{ |
| 4930 |
gint result; |
| 4931 |
result = start_daemon (argv, argv_length1); |
| 4932 |
return result; |
| 4933 |
} |
| 4934 |
|
| 4935 |
static gint |
| 4936 |
_print_version_entry_func (gchar** argv, |
| 4937 |
gint argv_length1, |
| 4938 |
gpointer self) |
| 4939 |
{ |
| 4940 |
gint result; |
| 4941 |
result = print_version (argv, argv_length1); |
| 4942 |
return result; |
| 4943 |
} |
| 4944 |
|
| 4945 |
static gint |
| 4946 |
_read_cache_entry_func (gchar** argv, |
| 4947 |
gint argv_length1, |
| 4948 |
gpointer self) |
| 4949 |
{ |
| 4950 |
gint result; |
| 4951 |
result = read_cache (argv, argv_length1); |
| 4952 |
return result; |
| 4953 |
} |
| 4954 |
|
| 4955 |
static gint |
| 4956 |
_write_cache_entry_func (gchar** argv, |
| 4957 |
gint argv_length1, |
| 4958 |
gpointer self) |
| 4959 |
{ |
| 4960 |
gint result; |
| 4961 |
result = write_cache (argv, argv_length1); |
| 4962 |
return result; |
| 4963 |
} |
| 4964 |
|
| 4965 |
static gint |
| 4966 |
_print_address_entry_func (gchar** argv, |
| 4967 |
gint argv_length1, |
| 4968 |
gpointer self) |
| 4969 |
{ |
| 4970 |
gint result; |
| 4971 |
result = print_address (argv, argv_length1); |
| 4972 |
return result; |
| 4973 |
} |
| 4974 |
|
| 4975 |
static gint |
| 4976 |
_read_config_entry_func (gchar** argv, |
| 4977 |
gint argv_length1, |
| 4978 |
gpointer self) |
| 4979 |
{ |
| 4980 |
gint result; |
| 4981 |
result = read_config (argv, argv_length1); |
| 4982 |
return result; |
| 4983 |
} |
| 4984 |
|
| 4985 |
static gint |
| 4986 |
_reset_config_entry_func (gchar** argv, |
| 4987 |
gint argv_length1, |
| 4988 |
gpointer self) |
| 4989 |
{ |
| 4990 |
gint result; |
| 4991 |
result = reset_config (argv, argv_length1); |
| 4992 |
return result; |
| 4993 |
} |
| 4994 |
|
| 4995 |
static gint |
| 4996 |
_emoji_dialog_entry_func (gchar** argv, |
| 4997 |
gint argv_length1, |
| 4998 |
gpointer self) |
| 4999 |
{ |
| 5000 |
gint result; |
| 5001 |
result = emoji_dialog (argv, argv_length1); |
| 5002 |
return result; |
| 5003 |
} |
| 5004 |
|
| 5005 |
static gint |
| 5006 |
_read_im_module_entry_func (gchar** argv, |
| 5007 |
gint argv_length1, |
| 5008 |
gpointer self) |
| 5009 |
{ |
| 5010 |
gint result; |
| 5011 |
result = read_im_module (argv, argv_length1); |
| 5012 |
return result; |
| 5013 |
} |
| 5014 |
|
| 5015 |
static gint |
| 5016 |
_print_help_entry_func (gchar** argv, |
| 5017 |
gint argv_length1, |
| 5018 |
gpointer self) |
| 5019 |
{ |
| 5020 |
gint result; |
| 5021 |
result = print_help (argv, argv_length1); |
| 5022 |
return result; |
| 5023 |
} |
| 5024 |
|
| 5025 |
void |
| 5026 |
print_usage (FILE* stream) |
| 5027 |
{ |
| 5028 |
const gchar* _tmp0_; |
| 5029 |
g_return_if_fail (stream != NULL); |
| 5030 |
_tmp0_ = program_name; |
| 5031 |
fprintf (stream, _ ("Usage: %s COMMAND [OPTION...]\n\n"), _tmp0_); |
| 5032 |
fprintf (stream, "%s", _ ("Commands:\n")); |
| 5033 |
{ |
| 5034 |
gint i = 0; |
| 5035 |
i = 0; |
| 5036 |
{ |
| 5037 |
gboolean _tmp1_ = FALSE; |
| 5038 |
_tmp1_ = TRUE; |
| 5039 |
while (TRUE) { |
| 5040 |
CommandEntry _tmp3_; |
| 5041 |
const gchar* _tmp4_; |
| 5042 |
CommandEntry _tmp5_; |
| 5043 |
const gchar* _tmp6_; |
| 5044 |
if (!_tmp1_) { |
| 5045 |
gint _tmp2_; |
| 5046 |
_tmp2_ = i; |
| 5047 |
i = _tmp2_ + 1; |
| 5048 |
} |
| 5049 |
_tmp1_ = FALSE; |
| 5050 |
if (!(i < G_N_ELEMENTS (commands))) { |
| 5051 |
break; |
| 5052 |
} |
| 5053 |
_tmp3_ = commands[i]; |
| 5054 |
_tmp4_ = _tmp3_.name; |
| 5055 |
_tmp5_ = commands[i]; |
| 5056 |
_tmp6_ = _tmp5_.description; |
| 5057 |
fprintf (stream, " %-12s %s\n", _tmp4_, g_dgettext (NULL, _tmp6_)); |
| 5058 |
} |
| 5059 |
} |
| 5060 |
} |
| 5061 |
} |
| 5062 |
|
| 5063 |
static gchar** |
| 5064 |
_vala_array_dup1 (gchar** self, |
| 5065 |
gssize length) |
| 5066 |
{ |
| 5067 |
if (length >= 0) { |
| 5068 |
gchar** result; |
| 5069 |
gssize i; |
| 5070 |
result = g_new0 (gchar*, length + 1); |
| 5071 |
for (i = 0; i < length; i++) { |
| 5072 |
gchar* _tmp0_; |
| 5073 |
_tmp0_ = g_strdup (self[i]); |
| 5074 |
result[i] = _tmp0_; |
| 5075 |
} |
| 5076 |
return result; |
| 5077 |
} |
| 5078 |
return NULL; |
| 5079 |
} |
| 5080 |
|
| 5081 |
static gint |
| 5082 |
_vala_main (gchar** argv, |
| 5083 |
gint argv_length1) |
| 5084 |
{ |
| 5085 |
const gchar* _tmp0_; |
| 5086 |
gchar* _tmp1_; |
| 5087 |
gchar** new_argv = NULL; |
| 5088 |
gchar** _tmp3_; |
| 5089 |
gint _tmp3__length1; |
| 5090 |
gint new_argv_length1; |
| 5091 |
gint _new_argv_size_; |
| 5092 |
gchar** _tmp4_; |
| 5093 |
gint _tmp4__length1; |
| 5094 |
const gchar* _tmp5_; |
| 5095 |
gchar** _tmp6_; |
| 5096 |
gint _tmp6__length1; |
| 5097 |
const gchar* _tmp7_; |
| 5098 |
gchar* _tmp8_; |
| 5099 |
FILE* _tmp17_; |
| 5100 |
const gchar* _tmp18_; |
| 5101 |
FILE* _tmp19_; |
| 5102 |
gint result; |
| 5103 |
setlocale (LC_ALL, ""); |
| 5104 |
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); |
| 5105 |
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); |
| 5106 |
textdomain (GETTEXT_PACKAGE); |
| 5107 |
ibus_init (); |
| 5108 |
_tmp0_ = argv[0]; |
| 5109 |
_tmp1_ = g_path_get_basename (_tmp0_); |
| 5110 |
_g_free0 (program_name); |
| 5111 |
program_name = _tmp1_; |
| 5112 |
if (argv_length1 < 2) { |
| 5113 |
FILE* _tmp2_; |
| 5114 |
_tmp2_ = stderr; |
| 5115 |
print_usage (_tmp2_); |
| 5116 |
result = EXIT_FAILURE; |
| 5117 |
return result; |
| 5118 |
} |
| 5119 |
_tmp3_ = (argv != NULL) ? _vala_array_dup1 (argv + 1, argv_length1 - 1) : argv; |
| 5120 |
_tmp3__length1 = argv_length1 - 1; |
| 5121 |
new_argv = _tmp3_; |
| 5122 |
new_argv_length1 = _tmp3__length1; |
| 5123 |
_new_argv_size_ = new_argv_length1; |
| 5124 |
_tmp4_ = new_argv; |
| 5125 |
_tmp4__length1 = new_argv_length1; |
| 5126 |
_tmp5_ = program_name; |
| 5127 |
_tmp6_ = new_argv; |
| 5128 |
_tmp6__length1 = new_argv_length1; |
| 5129 |
_tmp7_ = _tmp6_[0]; |
| 5130 |
_tmp8_ = g_strdup_printf ("%s %s", _tmp5_, _tmp7_); |
| 5131 |
_g_free0 (_tmp4_[0]); |
| 5132 |
_tmp4_[0] = _tmp8_; |
| 5133 |
{ |
| 5134 |
gint i = 0; |
| 5135 |
i = 0; |
| 5136 |
{ |
| 5137 |
gboolean _tmp9_ = FALSE; |
| 5138 |
_tmp9_ = TRUE; |
| 5139 |
while (TRUE) { |
| 5140 |
CommandEntry _tmp11_; |
| 5141 |
const gchar* _tmp12_; |
| 5142 |
const gchar* _tmp13_; |
| 5143 |
if (!_tmp9_) { |
| 5144 |
gint _tmp10_; |
| 5145 |
_tmp10_ = i; |
| 5146 |
i = _tmp10_ + 1; |
| 5147 |
} |
| 5148 |
_tmp9_ = FALSE; |
| 5149 |
if (!(i < G_N_ELEMENTS (commands))) { |
| 5150 |
break; |
| 5151 |
} |
| 5152 |
_tmp11_ = commands[i]; |
| 5153 |
_tmp12_ = _tmp11_.name; |
| 5154 |
_tmp13_ = argv[1]; |
| 5155 |
if (g_strcmp0 (_tmp12_, _tmp13_) == 0) { |
| 5156 |
CommandEntry _tmp14_; |
| 5157 |
EntryFunc _tmp15_; |
| 5158 |
gpointer _tmp15__target; |
| 5159 |
gchar** _tmp16_; |
| 5160 |
gint _tmp16__length1; |
| 5161 |
_tmp14_ = commands[i]; |
| 5162 |
_tmp15_ = _tmp14_.entry; |
| 5163 |
_tmp15__target = _tmp14_.entry_target; |
| 5164 |
_tmp16_ = new_argv; |
| 5165 |
_tmp16__length1 = new_argv_length1; |
| 5166 |
result = _tmp15_ (_tmp16_, (gint) _tmp16__length1, _tmp15__target); |
| 5167 |
new_argv = (_vala_array_free (new_argv, new_argv_length1, (GDestroyNotify) g_free), NULL); |
| 5168 |
return result; |
| 5169 |
} |
| 5170 |
} |
| 5171 |
} |
| 5172 |
} |
| 5173 |
_tmp17_ = stderr; |
| 5174 |
_tmp18_ = argv[1]; |
| 5175 |
fprintf (_tmp17_, _ ("%s is unknown command!\n"), _tmp18_); |
| 5176 |
_tmp19_ = stderr; |
| 5177 |
print_usage (_tmp19_); |
| 5178 |
result = EXIT_FAILURE; |
| 5179 |
new_argv = (_vala_array_free (new_argv, new_argv_length1, (GDestroyNotify) g_free), NULL); |
| 5180 |
return result; |
| 5181 |
} |
| 5182 |
|
| 5183 |
int |
| 5184 |
main (int argc, |
| 5185 |
char ** argv) |
| 5186 |
{ |
| 5187 |
return _vala_main (argv, argc); |
| 5188 |
} |
| 5189 |
|
| 5190 |
static void |
| 5191 |
_vala_array_destroy (gpointer array, |
| 5192 |
gssize array_length, |
| 5193 |
GDestroyNotify destroy_func) |
| 5194 |
{ |
| 5195 |
if ((array != NULL) && (destroy_func != NULL)) { |
| 5196 |
gssize i; |
| 5197 |
for (i = 0; i < array_length; i = i + 1) { |
| 5198 |
if (((gpointer*) array)[i] != NULL) { |
| 5199 |
destroy_func (((gpointer*) array)[i]); |
| 5200 |
} |
| 5201 |
} |
| 5202 |
} |
| 5203 |
} |
| 5204 |
|
| 5205 |
static void |
| 5206 |
_vala_array_free (gpointer array, |
| 5207 |
gssize array_length, |
| 5208 |
GDestroyNotify destroy_func) |
| 5209 |
{ |
| 5210 |
_vala_array_destroy (array, array_length, destroy_func); |
| 5211 |
g_free (array); |
| 5212 |
} |
| 5213 |
|
| 5214 |
static gssize |
| 5215 |
_vala_array_length (gpointer array) |
| 5216 |
{ |
| 5217 |
gssize length; |
| 5218 |
length = 0; |
| 5219 |
if (array) { |
| 5220 |
while (((gpointer*) array)[length]) { |
| 5221 |
length++; |
| 5222 |
} |
| 5223 |
} |
| 5224 |
return length; |
| 5225 |
} |
| 5226 |
|