1
/* command-set.c generated by valac 0.17.6.5-65f99, the Vala compiler
2
* generated from command-set.vala, do not modify */
5
* Copyright (C) 2012 Jeremy Whiting <jeremy.whiting@collabora.com>
7
* This library is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU Lesser General Public License as published by
9
* the Free Software Foundation, either version 2.1 of the License, or
10
* (at your option) any later version.
12
* This library is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU Lesser General Public License for more details.
17
* You should have received a copy of the GNU Lesser General Public License
18
* along with this library. If not, see <http://www.gnu.org/licenses/>.
21
* Jeremy Whiting <jeremy.whiting@collabora.com>
25
#include <glib-object.h>
29
#include <folks/folks.h>
32
#include <readline/readline.h>
35
#define FOLKS_INSPECT_TYPE_COMMAND (folks_inspect_command_get_type ())
36
#define FOLKS_INSPECT_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_INSPECT_TYPE_COMMAND, FolksInspectCommand))
37
#define FOLKS_INSPECT_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_INSPECT_TYPE_COMMAND, FolksInspectCommandClass))
38
#define FOLKS_INSPECT_IS_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_INSPECT_TYPE_COMMAND))
39
#define FOLKS_INSPECT_IS_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_INSPECT_TYPE_COMMAND))
40
#define FOLKS_INSPECT_COMMAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_INSPECT_TYPE_COMMAND, FolksInspectCommandClass))
42
typedef struct _FolksInspectCommand FolksInspectCommand;
43
typedef struct _FolksInspectCommandClass FolksInspectCommandClass;
44
typedef struct _FolksInspectCommandPrivate FolksInspectCommandPrivate;
46
#define FOLKS_INSPECT_TYPE_CLIENT (folks_inspect_client_get_type ())
47
#define FOLKS_INSPECT_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_INSPECT_TYPE_CLIENT, FolksInspectClient))
48
#define FOLKS_INSPECT_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_INSPECT_TYPE_CLIENT, FolksInspectClientClass))
49
#define FOLKS_INSPECT_IS_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_INSPECT_TYPE_CLIENT))
50
#define FOLKS_INSPECT_IS_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_INSPECT_TYPE_CLIENT))
51
#define FOLKS_INSPECT_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_INSPECT_TYPE_CLIENT, FolksInspectClientClass))
53
typedef struct _FolksInspectClient FolksInspectClient;
54
typedef struct _FolksInspectClientClass FolksInspectClientClass;
56
#define FOLKS_INSPECT_COMMANDS_TYPE_SET (folks_inspect_commands_set_get_type ())
57
#define FOLKS_INSPECT_COMMANDS_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_INSPECT_COMMANDS_TYPE_SET, FolksInspectCommandsSet))
58
#define FOLKS_INSPECT_COMMANDS_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_INSPECT_COMMANDS_TYPE_SET, FolksInspectCommandsSetClass))
59
#define FOLKS_INSPECT_COMMANDS_IS_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_INSPECT_COMMANDS_TYPE_SET))
60
#define FOLKS_INSPECT_COMMANDS_IS_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_INSPECT_COMMANDS_TYPE_SET))
61
#define FOLKS_INSPECT_COMMANDS_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_INSPECT_COMMANDS_TYPE_SET, FolksInspectCommandsSetClass))
63
typedef struct _FolksInspectCommandsSet FolksInspectCommandsSet;
64
typedef struct _FolksInspectCommandsSetClass FolksInspectCommandsSetClass;
65
typedef struct _FolksInspectCommandsSetPrivate FolksInspectCommandsSetPrivate;
66
#define _g_free0(var) (var = (g_free (var), NULL))
67
#define _folks_inspect_command_unref0(var) ((var == NULL) ? NULL : (var = (folks_inspect_command_unref (var), NULL)))
68
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
69
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
70
typedef struct _FolksInspectCommandsSetRunData FolksInspectCommandsSetRunData;
72
struct _FolksInspectCommand {
73
GTypeInstance parent_instance;
74
volatile int ref_count;
75
FolksInspectCommandPrivate * priv;
76
FolksInspectClient* client;
79
struct _FolksInspectCommandClass {
80
GTypeClass parent_class;
81
void (*finalize) (FolksInspectCommand *self);
82
void (*run) (FolksInspectCommand* self, const gchar* command_string, GAsyncReadyCallback _callback_, gpointer _user_data_);
83
void (*run_finish) (FolksInspectCommand* self, GAsyncResult* _res_);
84
gchar** (*complete_subcommand) (FolksInspectCommand* self, const gchar* subcommand, int* result_length1);
85
const gchar* (*get_name) (FolksInspectCommand* self);
86
const gchar* (*get_description) (FolksInspectCommand* self);
87
const gchar* (*get_help) (FolksInspectCommand* self);
90
struct _FolksInspectCommandsSet {
91
FolksInspectCommand parent_instance;
92
FolksInspectCommandsSetPrivate * priv;
95
struct _FolksInspectCommandsSetClass {
96
FolksInspectCommandClass parent_class;
99
struct _FolksInspectCommandsSetRunData {
101
GObject* _source_object_;
103
GSimpleAsyncResult* _async_result;
104
FolksInspectCommandsSet* self;
105
gchar* command_string;
121
const gchar* _tmp10_;
123
gint _tmp11__length1;
124
const gchar* _tmp12_;
126
gint _tmp13__length1;
129
gint _tmp15__length1;
130
const gchar* _tmp16_;
132
gint _tmp17__length1;
133
const gchar* _tmp18_;
138
gint _tmp22__length1;
139
const gchar* _tmp23_;
141
gint _tmp24__length1;
142
const gchar* _tmp25_;
145
FolksInspectClient* _tmp27_;
146
FolksIndividualAggregator* _tmp28_;
147
FolksIndividualAggregator* _tmp29_;
150
const gchar* _tmp32_;
152
FolksIndividual* individual;
153
FolksIndividual* _tmp34_;
154
const gchar* _tmp35_;
155
FolksInspectClient* _tmp36_;
156
FolksIndividualAggregator* _tmp37_;
157
FolksIndividualAggregator* _tmp38_;
158
FolksIndividual* _tmp39_;
159
FolksPersona* _tmp40_;
160
FolksPersona* persona;
161
FolksPersona* _tmp41_;
162
FolksIndividual* _tmp42_;
163
FolksIndividual* _tmp43_;
165
gint _tmp44__length1;
166
const gchar* _tmp45_;
168
gint _tmp46__length1;
169
const gchar* _tmp47_;
172
gint _tmp48__length1;
173
const gchar* _tmp49_;
174
GError * _inner_error_;
178
static gpointer folks_inspect_commands_set_parent_class = NULL;
179
static gchar** folks_inspect_commands_set_subcommand_completions;
180
static gchar** folks_inspect_commands_set_subcommand_completions = NULL;
181
static guint folks_inspect_commands_set_completion_count;
182
static guint folks_inspect_commands_set_completion_count = 0U;
183
static gchar* folks_inspect_commands_set_prefix;
184
static gchar* folks_inspect_commands_set_prefix = NULL;
186
gpointer folks_inspect_command_ref (gpointer instance);
187
void folks_inspect_command_unref (gpointer instance);
188
GParamSpec* folks_inspect_param_spec_command (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
189
void folks_inspect_value_set_command (GValue* value, gpointer v_object);
190
void folks_inspect_value_take_command (GValue* value, gpointer v_object);
191
gpointer folks_inspect_value_get_command (const GValue* value);
192
GType folks_inspect_command_get_type (void) G_GNUC_CONST;
193
GType folks_inspect_client_get_type (void) G_GNUC_CONST;
194
GType folks_inspect_commands_set_get_type (void) G_GNUC_CONST;
196
FOLKS_INSPECT_COMMANDS_SET_DUMMY_PROPERTY
198
FolksInspectCommandsSet* folks_inspect_commands_set_new (FolksInspectClient* client);
199
FolksInspectCommandsSet* folks_inspect_commands_set_construct (GType object_type, FolksInspectClient* client);
200
FolksInspectCommand* folks_inspect_command_construct (GType object_type, FolksInspectClient* client);
201
static void folks_inspect_commands_set_real_run_data_free (gpointer _data);
202
static void folks_inspect_commands_set_real_run (FolksInspectCommand* base, const gchar* command_string, GAsyncReadyCallback _callback_, gpointer _user_data_);
203
static gboolean folks_inspect_commands_set_real_run_co (FolksInspectCommandsSetRunData* _data_);
204
void folks_inspect_utils_print_line (const gchar* format, ...);
205
FolksIndividualAggregator* folks_inspect_client_get_aggregator (FolksInspectClient* self);
206
static void folks_inspect_commands_set_run_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
207
gchar* folks_inspect_commands_set_subcommand_name_completion_cb (const gchar* word, gint state);
208
gchar* folks_inspect_utils_individual_id_completion_cb (const gchar* word, gint state);
209
static gchar* _folks_inspect_utils_individual_id_completion_cb_rl_compentry_func_t (const gchar* str, gint a);
210
static gchar** _vala_array_dup10 (gchar** self, int length);
211
static gchar** folks_inspect_commands_set_real_complete_subcommand (FolksInspectCommand* base, const gchar* subcommand, int* result_length1);
212
static gchar* _folks_inspect_commands_set_subcommand_name_completion_cb_rl_compentry_func_t (const gchar* str, gint a);
213
static gchar** _vala_array_dup11 (gchar** self, int length);
214
static void folks_inspect_commands_set_finalize (FolksInspectCommand* obj);
215
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
216
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
217
static gint _vala_array_length (gpointer array);
220
FolksInspectCommandsSet* folks_inspect_commands_set_construct (GType object_type, FolksInspectClient* client) {
221
FolksInspectCommandsSet* self = NULL;
222
FolksInspectClient* _tmp0_;
223
g_return_val_if_fail (client != NULL, NULL);
225
self = (FolksInspectCommandsSet*) folks_inspect_command_construct (object_type, _tmp0_);
230
FolksInspectCommandsSet* folks_inspect_commands_set_new (FolksInspectClient* client) {
231
return folks_inspect_commands_set_construct (FOLKS_INSPECT_COMMANDS_TYPE_SET, client);
235
static void folks_inspect_commands_set_real_run_data_free (gpointer _data) {
236
FolksInspectCommandsSetRunData* _data_;
238
_g_free0 (_data_->command_string);
239
_folks_inspect_command_unref0 (_data_->self);
240
g_slice_free (FolksInspectCommandsSetRunData, _data_);
244
static gpointer _folks_inspect_command_ref0 (gpointer self) {
245
return self ? folks_inspect_command_ref (self) : NULL;
249
static void folks_inspect_commands_set_real_run (FolksInspectCommand* base, const gchar* command_string, GAsyncReadyCallback _callback_, gpointer _user_data_) {
250
FolksInspectCommandsSet * self;
251
FolksInspectCommandsSetRunData* _data_;
252
FolksInspectCommandsSet* _tmp0_;
255
self = (FolksInspectCommandsSet*) base;
256
_data_ = g_slice_new0 (FolksInspectCommandsSetRunData);
257
_data_->_async_result = g_simple_async_result_new (g_object_newv (G_TYPE_OBJECT, 0, NULL), _callback_, _user_data_, folks_inspect_commands_set_real_run);
258
g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, folks_inspect_commands_set_real_run_data_free);
259
_tmp0_ = _folks_inspect_command_ref0 (self);
260
_data_->self = _tmp0_;
261
_tmp1_ = command_string;
262
_tmp2_ = g_strdup (_tmp1_);
263
_g_free0 (_data_->command_string);
264
_data_->command_string = _tmp2_;
265
folks_inspect_commands_set_real_run_co (_data_);
269
static void folks_inspect_commands_set_real_run_finish (FolksInspectCommand* base, GAsyncResult* _res_) {
270
FolksInspectCommandsSetRunData* _data_;
271
_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
275
static gchar* string_strip (const gchar* self) {
276
gchar* result = NULL;
277
gchar* _tmp0_ = NULL;
280
g_return_val_if_fail (self != NULL, NULL);
281
_tmp0_ = g_strdup (self);
290
static void folks_inspect_commands_set_run_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
291
FolksInspectCommandsSetRunData* _data_;
292
_data_ = _user_data_;
293
_data_->_source_object_ = source_object;
294
_data_->_res_ = _res_;
295
folks_inspect_commands_set_real_run_co (_data_);
299
static gboolean folks_inspect_commands_set_real_run_co (FolksInspectCommandsSetRunData* _data_) {
300
switch (_data_->_state_) {
306
g_assert_not_reached ();
309
_data_->_tmp0_ = NULL;
310
_data_->_tmp0_ = g_new0 (gchar*, 0 + 1);
311
_data_->parts = _data_->_tmp0_;
312
_data_->parts_length1 = 0;
313
_data_->_parts_size_ = _data_->parts_length1;
314
_data_->_tmp1_ = _data_->command_string;
315
if (_data_->_tmp1_ != NULL) {
316
_data_->_tmp2_ = _data_->command_string;
317
_data_->_tmp4_ = NULL;
318
_data_->_tmp4_ = _data_->_tmp3_ = g_strsplit (_data_->_tmp2_, " ", 0);
319
_data_->parts = (_vala_array_free (_data_->parts, _data_->parts_length1, (GDestroyNotify) g_free), NULL);
320
_data_->parts = _data_->_tmp4_;
321
_data_->parts_length1 = _vala_array_length (_data_->_tmp3_);
322
_data_->_parts_size_ = _data_->parts_length1;
324
_data_->_tmp6_ = _data_->parts;
325
_data_->_tmp6__length1 = _data_->parts_length1;
326
if (_data_->_tmp6__length1 < 1) {
327
_data_->_tmp5_ = TRUE;
329
_data_->_tmp7_ = _data_->parts;
330
_data_->_tmp7__length1 = _data_->parts_length1;
331
_data_->_tmp8_ = _data_->_tmp7_[0];
332
_data_->_tmp5_ = g_strcmp0 (_data_->_tmp8_, "alias") != 0;
334
_data_->_tmp9_ = _data_->_tmp5_;
335
if (_data_->_tmp9_) {
336
_data_->_tmp10_ = _data_->command_string;
337
folks_inspect_utils_print_line ("Unrecognised 'set' command '%s'.", _data_->_tmp10_);
338
_data_->parts = (_vala_array_free (_data_->parts, _data_->parts_length1, (GDestroyNotify) g_free), NULL);
339
if (_data_->_state_ == 0) {
340
g_simple_async_result_complete_in_idle (_data_->_async_result);
342
g_simple_async_result_complete (_data_->_async_result);
344
g_object_unref (_data_->_async_result);
347
_data_->_tmp11_ = _data_->parts;
348
_data_->_tmp11__length1 = _data_->parts_length1;
349
_data_->_tmp12_ = _data_->_tmp11_[0];
350
if (g_strcmp0 (_data_->_tmp12_, "alias") == 0) {
351
_data_->_tmp13_ = _data_->parts;
352
_data_->_tmp13__length1 = _data_->parts_length1;
353
if (_data_->_tmp13__length1 < 3) {
354
folks_inspect_utils_print_line ("%s", "Must pass at least one individual ID and a new alias to an " "'alias' subcommand.");
355
_data_->parts = (_vala_array_free (_data_->parts, _data_->parts_length1, (GDestroyNotify) g_free), NULL);
356
if (_data_->_state_ == 0) {
357
g_simple_async_result_complete_in_idle (_data_->_async_result);
359
g_simple_async_result_complete (_data_->_async_result);
361
g_object_unref (_data_->_async_result);
364
_data_->_tmp15_ = _data_->parts;
365
_data_->_tmp15__length1 = _data_->parts_length1;
366
_data_->_tmp16_ = _data_->_tmp15_[1];
367
if (_data_->_tmp16_ == NULL) {
368
_data_->_tmp14_ = TRUE;
370
_data_->_tmp17_ = _data_->parts;
371
_data_->_tmp17__length1 = _data_->parts_length1;
372
_data_->_tmp18_ = _data_->_tmp17_[1];
373
_data_->_tmp19_ = NULL;
374
_data_->_tmp19_ = string_strip (_data_->_tmp18_);
375
_data_->_tmp20_ = _data_->_tmp19_;
376
_data_->_tmp14_ = g_strcmp0 (_data_->_tmp20_, "") == 0;
377
_g_free0 (_data_->_tmp20_);
379
_data_->_tmp21_ = _data_->_tmp14_;
380
if (_data_->_tmp21_) {
381
_data_->_tmp22_ = _data_->parts;
382
_data_->_tmp22__length1 = _data_->parts_length1;
383
_data_->_tmp23_ = _data_->_tmp22_[1];
384
folks_inspect_utils_print_line ("Unrecognised individual ID '%s'.", _data_->_tmp23_);
385
_data_->parts = (_vala_array_free (_data_->parts, _data_->parts_length1, (GDestroyNotify) g_free), NULL);
386
if (_data_->_state_ == 0) {
387
g_simple_async_result_complete_in_idle (_data_->_async_result);
389
g_simple_async_result_complete (_data_->_async_result);
391
g_object_unref (_data_->_async_result);
394
_data_->_tmp24_ = _data_->parts;
395
_data_->_tmp24__length1 = _data_->parts_length1;
396
_data_->_tmp25_ = _data_->_tmp24_[1];
397
_data_->_tmp26_ = NULL;
398
_data_->_tmp26_ = string_strip (_data_->_tmp25_);
399
_data_->id = _data_->_tmp26_;
400
_data_->_tmp27_ = ((FolksInspectCommand*) _data_->self)->client;
401
_data_->_tmp28_ = folks_inspect_client_get_aggregator (_data_->_tmp27_);
402
_data_->_tmp29_ = _data_->_tmp28_;
403
_data_->_tmp30_ = folks_individual_aggregator_get_individuals (_data_->_tmp29_);
404
_data_->_tmp31_ = _data_->_tmp30_;
405
_data_->_tmp32_ = _data_->id;
406
_data_->_tmp33_ = NULL;
407
_data_->_tmp33_ = gee_map_get (_data_->_tmp31_, _data_->_tmp32_);
408
_data_->individual = (FolksIndividual*) _data_->_tmp33_;
409
_data_->_tmp34_ = _data_->individual;
410
if (_data_->_tmp34_ == NULL) {
411
_data_->_tmp35_ = _data_->id;
412
folks_inspect_utils_print_line ("Unrecognized individual ID '%s'.", _data_->_tmp35_);
413
_g_object_unref0 (_data_->individual);
414
_g_free0 (_data_->id);
415
_data_->parts = (_vala_array_free (_data_->parts, _data_->parts_length1, (GDestroyNotify) g_free), NULL);
416
if (_data_->_state_ == 0) {
417
g_simple_async_result_complete_in_idle (_data_->_async_result);
419
g_simple_async_result_complete (_data_->_async_result);
421
g_object_unref (_data_->_async_result);
425
_data_->_tmp36_ = ((FolksInspectCommand*) _data_->self)->client;
426
_data_->_tmp37_ = folks_inspect_client_get_aggregator (_data_->_tmp36_);
427
_data_->_tmp38_ = _data_->_tmp37_;
428
_data_->_tmp39_ = _data_->individual;
430
folks_individual_aggregator_ensure_individual_property_writeable (_data_->_tmp38_, _data_->_tmp39_, "alias", folks_inspect_commands_set_run_ready, _data_);
433
_data_->_tmp40_ = NULL;
434
_data_->_tmp40_ = folks_individual_aggregator_ensure_individual_property_writeable_finish (_data_->_tmp38_, _data_->_res_, &_data_->_inner_error_);
435
_data_->persona = _data_->_tmp40_;
436
if (_data_->_inner_error_ != NULL) {
437
if (_data_->_inner_error_->domain == FOLKS_INDIVIDUAL_AGGREGATOR_ERROR) {
438
goto __catch2_folks_individual_aggregator_error;
440
_g_object_unref0 (_data_->individual);
441
_g_free0 (_data_->id);
442
_data_->parts = (_vala_array_free (_data_->parts, _data_->parts_length1, (GDestroyNotify) g_free), NULL);
443
g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
444
g_clear_error (&_data_->_inner_error_);
447
_data_->_tmp41_ = _data_->persona;
448
_data_->_tmp42_ = folks_persona_get_individual (_data_->_tmp41_);
449
_data_->_tmp43_ = _data_->_tmp42_;
450
_data_->_tmp44_ = _data_->parts;
451
_data_->_tmp44__length1 = _data_->parts_length1;
452
_data_->_tmp45_ = _data_->_tmp44_[2];
453
folks_alias_details_set_alias ((FolksAliasDetails*) _data_->_tmp43_, _data_->_tmp45_);
454
_data_->_tmp46_ = _data_->parts;
455
_data_->_tmp46__length1 = _data_->parts_length1;
456
_data_->_tmp47_ = _data_->_tmp46_[2];
457
folks_inspect_utils_print_line ("Setting of individual's alias to '%s' was successful.", _data_->_tmp47_);
458
_g_object_unref0 (_data_->persona);
461
__catch2_folks_individual_aggregator_error:
463
_data_->e = _data_->_inner_error_;
464
_data_->_inner_error_ = NULL;
465
_data_->_tmp48_ = _data_->parts;
466
_data_->_tmp48__length1 = _data_->parts_length1;
467
_data_->_tmp49_ = _data_->_tmp48_[2];
468
folks_inspect_utils_print_line ("Setting of individual's alias to '%s' failed.", _data_->_tmp49_);
469
_g_error_free0 (_data_->e);
472
if (_data_->_inner_error_ != NULL) {
473
_g_object_unref0 (_data_->individual);
474
_g_free0 (_data_->id);
475
_data_->parts = (_vala_array_free (_data_->parts, _data_->parts_length1, (GDestroyNotify) g_free), NULL);
476
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
477
g_clear_error (&_data_->_inner_error_);
480
_g_object_unref0 (_data_->individual);
481
_g_free0 (_data_->id);
482
_data_->parts = (_vala_array_free (_data_->parts, _data_->parts_length1, (GDestroyNotify) g_free), NULL);
483
if (_data_->_state_ == 0) {
484
g_simple_async_result_complete_in_idle (_data_->_async_result);
486
g_simple_async_result_complete (_data_->_async_result);
488
g_object_unref (_data_->_async_result);
491
g_assert_not_reached ();
493
_data_->parts = (_vala_array_free (_data_->parts, _data_->parts_length1, (GDestroyNotify) g_free), NULL);
494
if (_data_->_state_ == 0) {
495
g_simple_async_result_complete_in_idle (_data_->_async_result);
497
g_simple_async_result_complete (_data_->_async_result);
499
g_object_unref (_data_->_async_result);
504
static gchar* _folks_inspect_utils_individual_id_completion_cb_rl_compentry_func_t (const gchar* str, gint a) {
506
result = folks_inspect_utils_individual_id_completion_cb (str, a);
511
static gchar** _vala_array_dup10 (gchar** self, int length) {
514
result = g_new0 (gchar*, length + 1);
515
for (i = 0; i < length; i++) {
517
_tmp0_ = g_strdup (self[i]);
524
static gchar* string_slice (const gchar* self, glong start, glong end) {
525
gchar* result = NULL;
531
gboolean _tmp8_ = FALSE;
534
gboolean _tmp13_ = FALSE;
542
gchar* _tmp23_ = NULL;
543
g_return_val_if_fail (self != NULL, NULL);
544
_tmp0_ = strlen (self);
546
string_length = (glong) _tmp1_;
548
if (_tmp2_ < ((glong) 0)) {
551
_tmp3_ = string_length;
553
start = _tmp3_ + _tmp4_;
556
if (_tmp5_ < ((glong) 0)) {
559
_tmp6_ = string_length;
561
end = _tmp6_ + _tmp7_;
564
if (_tmp9_ >= ((glong) 0)) {
568
_tmp11_ = string_length;
569
_tmp8_ = _tmp10_ <= _tmp11_;
574
g_return_val_if_fail (_tmp12_, NULL);
576
if (_tmp14_ >= ((glong) 0)) {
580
_tmp16_ = string_length;
581
_tmp13_ = _tmp15_ <= _tmp16_;
586
g_return_val_if_fail (_tmp17_, NULL);
589
g_return_val_if_fail (_tmp18_ <= _tmp19_, NULL);
593
_tmp23_ = g_strndup (((gchar*) self) + _tmp20_, (gsize) (_tmp21_ - _tmp22_));
599
gchar* folks_inspect_commands_set_subcommand_name_completion_cb (const gchar* word, gint state) {
600
gchar* result = NULL;
603
g_return_val_if_fail (word != NULL, NULL);
608
gchar** _tmp3_ = NULL;
612
gboolean _tmp4_ = FALSE;
617
_tmp3_ = _tmp2_ = g_strsplit (_tmp1_, " ", 0);
619
parts_length1 = _vala_array_length (_tmp2_);
620
_parts_size_ = parts_length1;
622
_tmp5__length1 = parts_length1;
623
if (_tmp5__length1 > 0) {
628
_tmp6__length1 = parts_length1;
630
_tmp4_ = g_strcmp0 (_tmp7_, "alias") == 0;
639
gint _tmp10__length1;
640
const gchar* _tmp11_;
644
gint _tmp13__length1;
645
const gchar* _tmp14_;
646
const gchar* _tmp19_;
648
_tmp9__length1 = parts_length1;
650
_tmp10__length1 = parts_length1;
651
_tmp11_ = _tmp9_[_tmp10__length1 - 1];
652
_tmp12_ = g_strdup (_tmp11_);
655
_tmp13__length1 = parts_length1;
656
_tmp14_ = _tmp13_[0];
657
if (g_strcmp0 (_tmp14_, "alias") == 0) {
658
const gchar* _tmp15_;
660
gchar** _tmp17_ = NULL;
662
gint _tmp18__length1;
664
_tmp17_ = _tmp16_ = rl_completion_matches (_tmp15_, _folks_inspect_utils_individual_id_completion_cb_rl_compentry_func_t);
665
_tmp18_ = (_tmp17_ != NULL) ? _vala_array_dup10 (_tmp17_, _vala_array_length (_tmp16_)) : ((gpointer) _tmp17_);
666
_tmp18__length1 = _vala_array_length (_tmp16_);
667
folks_inspect_commands_set_subcommand_completions = (_vala_array_free (folks_inspect_commands_set_subcommand_completions, _vala_array_length (folks_inspect_commands_set_subcommand_completions), (GDestroyNotify) g_free), NULL);
668
folks_inspect_commands_set_subcommand_completions = _tmp18_;
671
if (g_strcmp0 (_tmp19_, "") == 0) {
672
const gchar* _tmp20_;
675
_tmp21_ = g_strdup (_tmp20_);
676
_g_free0 (folks_inspect_commands_set_prefix);
677
folks_inspect_commands_set_prefix = _tmp21_;
679
const gchar* _tmp22_;
680
const gchar* _tmp23_;
683
gchar* _tmp26_ = NULL;
686
_tmp24_ = strlen (_tmp23_);
688
_tmp26_ = string_slice (_tmp22_, (glong) 0, (glong) (-_tmp25_));
689
_g_free0 (folks_inspect_commands_set_prefix);
690
folks_inspect_commands_set_prefix = _tmp26_;
692
_g_free0 (last_part);
695
gchar** _tmp28_ = NULL;
697
_tmp27_ = g_strdup ("alias");
698
_tmp28_ = g_new0 (gchar*, 2 + 1);
699
_tmp28_[0] = _tmp27_;
701
folks_inspect_commands_set_subcommand_completions = (_vala_array_free (folks_inspect_commands_set_subcommand_completions, _vala_array_length (folks_inspect_commands_set_subcommand_completions), (GDestroyNotify) g_free), NULL);
702
folks_inspect_commands_set_subcommand_completions = _tmp28_;
703
_tmp29_ = g_strdup ("");
704
_g_free0 (folks_inspect_commands_set_prefix);
705
folks_inspect_commands_set_prefix = _tmp29_;
707
folks_inspect_commands_set_completion_count = (guint) 0;
708
parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
713
gint _tmp31__length1;
715
gint _tmp32__length1;
717
const gchar* _tmp34_;
720
const gchar* _tmp36_;
721
const gchar* _tmp37_;
725
gboolean _tmp40_ = FALSE;
726
gboolean _tmp41_ = FALSE;
727
const gchar* _tmp42_;
730
_tmp30_ = folks_inspect_commands_set_completion_count;
731
_tmp31_ = folks_inspect_commands_set_subcommand_completions;
732
_tmp31__length1 = _vala_array_length (folks_inspect_commands_set_subcommand_completions);
733
if (!(_tmp30_ < ((guint) _tmp31__length1))) {
736
_tmp32_ = folks_inspect_commands_set_subcommand_completions;
737
_tmp32__length1 = _vala_array_length (folks_inspect_commands_set_subcommand_completions);
738
_tmp33_ = folks_inspect_commands_set_completion_count;
739
_tmp34_ = _tmp32_[_tmp33_];
740
_tmp35_ = g_strdup (_tmp34_);
741
completion = _tmp35_;
742
_tmp36_ = folks_inspect_commands_set_prefix;
743
_tmp37_ = completion;
744
_tmp38_ = g_strconcat (_tmp36_, _tmp37_, NULL);
746
_tmp39_ = folks_inspect_commands_set_completion_count;
747
folks_inspect_commands_set_completion_count = _tmp39_ + 1;
748
_tmp42_ = completion;
749
if (_tmp42_ != NULL) {
750
const gchar* _tmp43_;
751
_tmp43_ = completion;
752
_tmp41_ = g_strcmp0 (_tmp43_, "") != 0;
758
const gchar* _tmp45_;
759
const gchar* _tmp46_;
760
gboolean _tmp47_ = FALSE;
763
_tmp47_ = g_str_has_prefix (_tmp45_, _tmp46_);
771
_g_free0 (candidate);
774
_g_free0 (candidate);
775
_g_free0 (completion);
777
folks_inspect_commands_set_subcommand_completions = (_vala_array_free (folks_inspect_commands_set_subcommand_completions, _vala_array_length (folks_inspect_commands_set_subcommand_completions), (GDestroyNotify) g_free), NULL);
778
folks_inspect_commands_set_subcommand_completions = NULL;
779
folks_inspect_commands_set_completion_count = (guint) 0;
780
_tmp49_ = g_strdup ("");
781
_g_free0 (folks_inspect_commands_set_prefix);
782
folks_inspect_commands_set_prefix = _tmp49_;
788
static gchar* _folks_inspect_commands_set_subcommand_name_completion_cb_rl_compentry_func_t (const gchar* str, gint a) {
790
result = folks_inspect_commands_set_subcommand_name_completion_cb (str, a);
795
static gchar** _vala_array_dup11 (gchar** self, int length) {
798
result = g_new0 (gchar*, length + 1);
799
for (i = 0; i < length; i++) {
801
_tmp0_ = g_strdup (self[i]);
808
static gchar** folks_inspect_commands_set_real_complete_subcommand (FolksInspectCommand* base, const gchar* subcommand, int* result_length1) {
809
FolksInspectCommandsSet * self;
810
gchar** result = NULL;
813
gchar** _tmp2_ = NULL;
818
self = (FolksInspectCommandsSet*) base;
819
g_return_val_if_fail (subcommand != NULL, NULL);
821
_tmp2_ = _tmp1_ = rl_completion_matches (_tmp0_, _folks_inspect_commands_set_subcommand_name_completion_cb_rl_compentry_func_t);
822
_tmp3_ = (_tmp2_ != NULL) ? _vala_array_dup11 (_tmp2_, _vala_array_length (_tmp1_)) : ((gpointer) _tmp2_);
823
_tmp3__length1 = _vala_array_length (_tmp1_);
825
_tmp4__length1 = _tmp3__length1;
826
if (result_length1) {
827
*result_length1 = _tmp4__length1;
834
static const gchar* folks_inspect_commands_set_real_get_name (FolksInspectCommand* base) {
836
FolksInspectCommandsSet* self;
837
self = (FolksInspectCommandsSet*) base;
843
static const gchar* folks_inspect_commands_set_real_get_description (FolksInspectCommand* base) {
845
FolksInspectCommandsSet* self;
846
self = (FolksInspectCommandsSet*) base;
847
result = "set an individual's attributes";
852
static const gchar* folks_inspect_commands_set_real_get_help (FolksInspectCommand* base) {
854
FolksInspectCommandsSet* self;
855
self = (FolksInspectCommandsSet*) base;
856
result = "set alias [individual UID] [new alias]" " Set the alias of the given individual.";
861
static void folks_inspect_commands_set_class_init (FolksInspectCommandsSetClass * klass) {
862
folks_inspect_commands_set_parent_class = g_type_class_peek_parent (klass);
863
FOLKS_INSPECT_COMMAND_CLASS (klass)->finalize = folks_inspect_commands_set_finalize;
864
FOLKS_INSPECT_COMMAND_CLASS (klass)->run = folks_inspect_commands_set_real_run;
865
FOLKS_INSPECT_COMMAND_CLASS (klass)->run_finish = folks_inspect_commands_set_real_run_finish;
866
FOLKS_INSPECT_COMMAND_CLASS (klass)->complete_subcommand = folks_inspect_commands_set_real_complete_subcommand;
867
FOLKS_INSPECT_COMMAND_CLASS (klass)->get_name = folks_inspect_commands_set_real_get_name;
868
FOLKS_INSPECT_COMMAND_CLASS (klass)->get_description = folks_inspect_commands_set_real_get_description;
869
FOLKS_INSPECT_COMMAND_CLASS (klass)->get_help = folks_inspect_commands_set_real_get_help;
873
static void folks_inspect_commands_set_instance_init (FolksInspectCommandsSet * self) {
877
static void folks_inspect_commands_set_finalize (FolksInspectCommand* obj) {
878
FolksInspectCommandsSet * self;
879
self = G_TYPE_CHECK_INSTANCE_CAST (obj, FOLKS_INSPECT_COMMANDS_TYPE_SET, FolksInspectCommandsSet);
880
FOLKS_INSPECT_COMMAND_CLASS (folks_inspect_commands_set_parent_class)->finalize (obj);
884
GType folks_inspect_commands_set_get_type (void) {
885
static volatile gsize folks_inspect_commands_set_type_id__volatile = 0;
886
if (g_once_init_enter (&folks_inspect_commands_set_type_id__volatile)) {
887
static const GTypeInfo g_define_type_info = { sizeof (FolksInspectCommandsSetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) folks_inspect_commands_set_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FolksInspectCommandsSet), 0, (GInstanceInitFunc) folks_inspect_commands_set_instance_init, NULL };
888
GType folks_inspect_commands_set_type_id;
889
folks_inspect_commands_set_type_id = g_type_register_static (FOLKS_INSPECT_TYPE_COMMAND, "FolksInspectCommandsSet", &g_define_type_info, 0);
890
g_once_init_leave (&folks_inspect_commands_set_type_id__volatile, folks_inspect_commands_set_type_id);
892
return folks_inspect_commands_set_type_id__volatile;
896
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
897
if ((array != NULL) && (destroy_func != NULL)) {
899
for (i = 0; i < array_length; i = i + 1) {
900
if (((gpointer*) array)[i] != NULL) {
901
destroy_func (((gpointer*) array)[i]);
908
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
909
_vala_array_destroy (array, array_length, destroy_func);
914
static gint _vala_array_length (gpointer array) {
918
while (((gpointer*) array)[length]) {