1 /* autostart.c generated by valac 0.34.7, the Vala compiler
2  * generated from autostart.vala, do not modify */
3 
4 /*
5     Copyright 2013 Julien Lavergne <gilir@ubuntu.com>
6 
7     This program is free software: you can redistribute it and/or modify
8     it under the terms of the GNU General Public License as published by
9     the Free Software Foundation, either version 3 of the License, or
10     (at your option) any later version.
11 
12     This program 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 General Public License for more details.
16 
17     You should have received a copy of the GNU General Public License
18     along with this program.  If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #include <glib.h>
22 #include <glib-object.h>
23 #include <stdlib.h>
24 #include <string.h>
25 #include <gio/gio.h>
26 #include <gtk/gtk.h>
27 #include <stdio.h>
28 #include <glib/gstdio.h>
29 
30 #define _g_free0(var) (var = (g_free (var), NULL))
31 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
32 #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
33 typedef struct _Block1Data Block1Data;
34 typedef struct _Block2Data Block2Data;
35 #define _g_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL)))
36 typedef struct _Block3Data Block3Data;
37 #define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
38 #define _fclose0(var) ((var == NULL) ? NULL : (var = (fclose (var), NULL)))
39 
40 #define LDEFAULT_APPS_TYPE_DBUS_BACKEND (ldefault_apps_dbus_backend_get_type ())
41 #define LDEFAULT_APPS_DBUS_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LDEFAULT_APPS_TYPE_DBUS_BACKEND, LDefaultAppsDbusBackend))
42 #define LDEFAULT_APPS_DBUS_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LDEFAULT_APPS_TYPE_DBUS_BACKEND, LDefaultAppsDbusBackendClass))
43 #define LDEFAULT_APPS_IS_DBUS_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LDEFAULT_APPS_TYPE_DBUS_BACKEND))
44 #define LDEFAULT_APPS_IS_DBUS_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LDEFAULT_APPS_TYPE_DBUS_BACKEND))
45 #define LDEFAULT_APPS_DBUS_BACKEND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LDEFAULT_APPS_TYPE_DBUS_BACKEND, LDefaultAppsDbusBackendClass))
46 
47 typedef struct _LDefaultAppsDbusBackend LDefaultAppsDbusBackend;
48 typedef struct _LDefaultAppsDbusBackendClass LDefaultAppsDbusBackendClass;
49 #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
50 #define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
51 #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; }
52 #define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
53 
54 struct _Block1Data {
55 	int _ref_count_;
56 	GtkBuilder* builder;
57 };
58 
59 struct _Block2Data {
60 	int _ref_count_;
61 	Block1Data * _data1_;
62 	GtkEntry* add_entry;
63 };
64 
65 struct _Block3Data {
66 	int _ref_count_;
67 	Block2Data * _data2_;
68 	GtkCheckButton* check;
69 };
70 
71 
72 
73 gchar* ldefault_apps_read_autostart_conf (void);
74 gchar* ldefault_apps_get_config_home_path (const gchar* conf_file);
75 gchar* ldefault_apps_get_config_path (const gchar* conf_file);
76 void ldefault_apps_manual_autostart_init (GtkBuilder* builder);
77 static Block1Data* block1_data_ref (Block1Data* _data1_);
78 static void block1_data_unref (void * _userdata_);
79 static Block2Data* block2_data_ref (Block2Data* _data2_);
80 static void block2_data_unref (void * _userdata_);
81 static Block3Data* block3_data_ref (Block3Data* _data3_);
82 static void block3_data_unref (void * _userdata_);
83 static void ____lambda4_ (Block3Data* _data3_);
84 void ldefault_apps_update_autostart_conf (const gchar* line, const gchar* action, GtkBuilder* builder);
85 static void _____lambda4__gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self);
86 static void ____lambda5_ (Block3Data* _data3_);
87 static void _____lambda5__gtk_button_clicked (GtkButton* _sender, gpointer self);
88 static void ___lambda6_ (Block2Data* _data2_);
89 static void ____lambda6__gtk_button_clicked (GtkButton* _sender, gpointer self);
90 GType ldefault_apps_dbus_backend_get_type (void) G_GNUC_CONST;
91 void ldefault_apps_autostart_core_applications (GtkBuilder* builder, LDefaultAppsDbusBackend* dbus_backend);
92 static gchar** _vala_array_dup1 (gchar** self, int length);
93 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
94 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
95 static gint _vala_array_length (gpointer array);
96 
97 
ldefault_apps_read_autostart_conf(void)98 gchar* ldefault_apps_read_autostart_conf (void) {
99 	gchar* result = NULL;
100 	gchar* config_path = NULL;
101 	gchar* _tmp0_ = NULL;
102 	GFile* config_file = NULL;
103 	const gchar* _tmp1_ = NULL;
104 	GFile* _tmp2_ = NULL;
105 	GFile* _tmp3_ = NULL;
106 	gboolean _tmp4_ = FALSE;
107 	const gchar* _tmp27_ = NULL;
108 	GError * _inner_error_ = NULL;
109 	_tmp0_ = ldefault_apps_get_config_home_path ("autostart");
110 	_g_free0 (config_path);
111 	config_path = _tmp0_;
112 	_tmp1_ = config_path;
113 	_tmp2_ = g_file_new_for_path (_tmp1_);
114 	config_file = _tmp2_;
115 	_tmp3_ = config_file;
116 	_tmp4_ = g_file_query_exists (_tmp3_, NULL);
117 	if (!_tmp4_) {
118 		gchar* config_system_path = NULL;
119 		gchar* _tmp5_ = NULL;
120 		const gchar* _tmp6_ = NULL;
121 		_tmp5_ = ldefault_apps_get_config_path ("autostart");
122 		_g_free0 (config_system_path);
123 		config_system_path = _tmp5_;
124 		_tmp6_ = config_system_path;
125 		if (_tmp6_ == NULL) {
126 			{
127 				GFile* blank_file = NULL;
128 				const gchar* _tmp7_ = NULL;
129 				GFile* _tmp8_ = NULL;
130 				GFile* _tmp9_ = NULL;
131 				GFileOutputStream* _tmp10_ = NULL;
132 				GFileOutputStream* _tmp11_ = NULL;
133 				g_message ("autostart.vala:36: Create blank file");
134 				_tmp7_ = config_path;
135 				_tmp8_ = g_file_new_for_path (_tmp7_);
136 				blank_file = _tmp8_;
137 				_tmp9_ = blank_file;
138 				_tmp10_ = g_file_create (_tmp9_, G_FILE_CREATE_PRIVATE, NULL, &_inner_error_);
139 				_tmp11_ = _tmp10_;
140 				_g_object_unref0 (_tmp11_);
141 				if (G_UNLIKELY (_inner_error_ != NULL)) {
142 					_g_object_unref0 (blank_file);
143 					goto __catch0_g_error;
144 				}
145 				_g_object_unref0 (blank_file);
146 			}
147 			goto __finally0;
148 			__catch0_g_error:
149 			{
150 				GError* e = NULL;
151 				GError* _tmp12_ = NULL;
152 				const gchar* _tmp13_ = NULL;
153 				e = _inner_error_;
154 				_inner_error_ = NULL;
155 				_tmp12_ = e;
156 				_tmp13_ = _tmp12_->message;
157 				g_message ("autostart.vala:42: %s", _tmp13_);
158 				_g_error_free0 (e);
159 			}
160 			__finally0:
161 			if (G_UNLIKELY (_inner_error_ != NULL)) {
162 				_g_free0 (config_system_path);
163 				_g_object_unref0 (config_file);
164 				_g_free0 (config_path);
165 				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
166 				g_clear_error (&_inner_error_);
167 				return NULL;
168 			}
169 		} else {
170 			GFile* file = NULL;
171 			const gchar* _tmp14_ = NULL;
172 			GFile* _tmp15_ = NULL;
173 			GFile* config_parent = NULL;
174 			GFile* _tmp16_ = NULL;
175 			GFile* _tmp17_ = NULL;
176 			GFile* _tmp18_ = NULL;
177 			gboolean _tmp19_ = FALSE;
178 			_tmp14_ = config_system_path;
179 			_tmp15_ = g_file_new_for_path (_tmp14_);
180 			file = _tmp15_;
181 			_tmp16_ = config_file;
182 			_tmp17_ = g_file_get_parent (_tmp16_);
183 			config_parent = _tmp17_;
184 			_tmp18_ = config_parent;
185 			_tmp19_ = g_file_query_exists (_tmp18_, NULL);
186 			if (!_tmp19_) {
187 				{
188 					GFile* _tmp20_ = NULL;
189 					_tmp20_ = config_parent;
190 					g_file_make_directory_with_parents (_tmp20_, NULL, &_inner_error_);
191 					if (G_UNLIKELY (_inner_error_ != NULL)) {
192 						goto __catch1_g_error;
193 					}
194 				}
195 				goto __finally1;
196 				__catch1_g_error:
197 				{
198 					GError* e = NULL;
199 					GError* _tmp21_ = NULL;
200 					const gchar* _tmp22_ = NULL;
201 					e = _inner_error_;
202 					_inner_error_ = NULL;
203 					_tmp21_ = e;
204 					_tmp22_ = _tmp21_->message;
205 					g_message ("autostart.vala:58: %s", _tmp22_);
206 					_g_error_free0 (e);
207 				}
208 				__finally1:
209 				if (G_UNLIKELY (_inner_error_ != NULL)) {
210 					_g_object_unref0 (config_parent);
211 					_g_object_unref0 (file);
212 					_g_free0 (config_system_path);
213 					_g_object_unref0 (config_file);
214 					_g_free0 (config_path);
215 					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
216 					g_clear_error (&_inner_error_);
217 					return NULL;
218 				}
219 			}
220 			{
221 				GFile* _tmp23_ = NULL;
222 				GFile* _tmp24_ = NULL;
223 				_tmp23_ = file;
224 				_tmp24_ = config_file;
225 				g_file_copy (_tmp23_, _tmp24_, G_FILE_COPY_NONE, NULL, NULL, NULL, &_inner_error_);
226 				if (G_UNLIKELY (_inner_error_ != NULL)) {
227 					goto __catch2_g_error;
228 				}
229 			}
230 			goto __finally2;
231 			__catch2_g_error:
232 			{
233 				GError* e = NULL;
234 				GError* _tmp25_ = NULL;
235 				const gchar* _tmp26_ = NULL;
236 				e = _inner_error_;
237 				_inner_error_ = NULL;
238 				_tmp25_ = e;
239 				_tmp26_ = _tmp25_->message;
240 				g_message ("autostart.vala:68: %s", _tmp26_);
241 				_g_error_free0 (e);
242 			}
243 			__finally2:
244 			if (G_UNLIKELY (_inner_error_ != NULL)) {
245 				_g_object_unref0 (config_parent);
246 				_g_object_unref0 (file);
247 				_g_free0 (config_system_path);
248 				_g_object_unref0 (config_file);
249 				_g_free0 (config_path);
250 				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
251 				g_clear_error (&_inner_error_);
252 				return NULL;
253 			}
254 			_g_object_unref0 (config_parent);
255 			_g_object_unref0 (file);
256 		}
257 		_g_free0 (config_system_path);
258 	}
259 	_tmp27_ = config_path;
260 	g_message ("autostart.vala:72: Conf file for autostart: %s", _tmp27_);
261 	result = config_path;
262 	_g_object_unref0 (config_file);
263 	return result;
264 }
265 
266 
_g_object_ref0(gpointer self)267 static gpointer _g_object_ref0 (gpointer self) {
268 	return self ? g_object_ref (self) : NULL;
269 }
270 
271 
block1_data_ref(Block1Data * _data1_)272 static Block1Data* block1_data_ref (Block1Data* _data1_) {
273 	g_atomic_int_inc (&_data1_->_ref_count_);
274 	return _data1_;
275 }
276 
277 
block1_data_unref(void * _userdata_)278 static void block1_data_unref (void * _userdata_) {
279 	Block1Data* _data1_;
280 	_data1_ = (Block1Data*) _userdata_;
281 	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
282 		_g_object_unref0 (_data1_->builder);
283 		g_slice_free (Block1Data, _data1_);
284 	}
285 }
286 
287 
block2_data_ref(Block2Data * _data2_)288 static Block2Data* block2_data_ref (Block2Data* _data2_) {
289 	g_atomic_int_inc (&_data2_->_ref_count_);
290 	return _data2_;
291 }
292 
293 
block2_data_unref(void * _userdata_)294 static void block2_data_unref (void * _userdata_) {
295 	Block2Data* _data2_;
296 	_data2_ = (Block2Data*) _userdata_;
297 	if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
298 		_g_object_unref0 (_data2_->add_entry);
299 		block1_data_unref (_data2_->_data1_);
300 		_data2_->_data1_ = NULL;
301 		g_slice_free (Block2Data, _data2_);
302 	}
303 }
304 
305 
block3_data_ref(Block3Data * _data3_)306 static Block3Data* block3_data_ref (Block3Data* _data3_) {
307 	g_atomic_int_inc (&_data3_->_ref_count_);
308 	return _data3_;
309 }
310 
311 
block3_data_unref(void * _userdata_)312 static void block3_data_unref (void * _userdata_) {
313 	Block3Data* _data3_;
314 	_data3_ = (Block3Data*) _userdata_;
315 	if (g_atomic_int_dec_and_test (&_data3_->_ref_count_)) {
316 		_g_object_unref0 (_data3_->check);
317 		block2_data_unref (_data3_->_data2_);
318 		_data3_->_data2_ = NULL;
319 		g_slice_free (Block3Data, _data3_);
320 	}
321 }
322 
323 
g_file_stream_read_line(FILE * self)324 static gchar* g_file_stream_read_line (FILE* self) {
325 	gchar* result = NULL;
326 	gint c = 0;
327 	GString* ret = NULL;
328 	GString* _tmp7_ = NULL;
329 	g_return_val_if_fail (self != NULL, NULL);
330 	ret = NULL;
331 	while (TRUE) {
332 		gint _tmp0_ = 0;
333 		gint _tmp1_ = 0;
334 		GString* _tmp2_ = NULL;
335 		gint _tmp4_ = 0;
336 		GString* _tmp5_ = NULL;
337 		gint _tmp6_ = 0;
338 		_tmp0_ = fgetc (self);
339 		c = _tmp0_;
340 		_tmp1_ = c;
341 		if (!(_tmp1_ != EOF)) {
342 			break;
343 		}
344 		_tmp2_ = ret;
345 		if (_tmp2_ == NULL) {
346 			GString* _tmp3_ = NULL;
347 			_tmp3_ = g_string_new ("");
348 			_g_string_free0 (ret);
349 			ret = _tmp3_;
350 		}
351 		_tmp4_ = c;
352 		if (_tmp4_ == ((gint) '\n')) {
353 			break;
354 		}
355 		_tmp5_ = ret;
356 		_tmp6_ = c;
357 		g_string_append_c ((GString*) _tmp5_, (gchar) _tmp6_);
358 	}
359 	_tmp7_ = ret;
360 	if (_tmp7_ == NULL) {
361 		result = NULL;
362 		_g_string_free0 (ret);
363 		return result;
364 	} else {
365 		GString* _tmp8_ = NULL;
366 		const gchar* _tmp9_ = NULL;
367 		gchar* _tmp10_ = NULL;
368 		_tmp8_ = ret;
369 		_tmp9_ = ((GString*) _tmp8_)->str;
370 		_tmp10_ = g_strdup (_tmp9_);
371 		result = _tmp10_;
372 		_g_string_free0 (ret);
373 		return result;
374 	}
375 	_g_string_free0 (ret);
376 }
377 
378 
string_slice(const gchar * self,glong start,glong end)379 static gchar* string_slice (const gchar* self, glong start, glong end) {
380 	gchar* result = NULL;
381 	glong string_length = 0L;
382 	gint _tmp0_ = 0;
383 	gint _tmp1_ = 0;
384 	glong _tmp2_ = 0L;
385 	glong _tmp5_ = 0L;
386 	gboolean _tmp8_ = FALSE;
387 	glong _tmp9_ = 0L;
388 	gboolean _tmp12_ = FALSE;
389 	glong _tmp13_ = 0L;
390 	glong _tmp16_ = 0L;
391 	glong _tmp17_ = 0L;
392 	glong _tmp18_ = 0L;
393 	glong _tmp19_ = 0L;
394 	glong _tmp20_ = 0L;
395 	gchar* _tmp21_ = NULL;
396 	g_return_val_if_fail (self != NULL, NULL);
397 	_tmp0_ = strlen (self);
398 	_tmp1_ = _tmp0_;
399 	string_length = (glong) _tmp1_;
400 	_tmp2_ = start;
401 	if (_tmp2_ < ((glong) 0)) {
402 		glong _tmp3_ = 0L;
403 		glong _tmp4_ = 0L;
404 		_tmp3_ = string_length;
405 		_tmp4_ = start;
406 		start = _tmp3_ + _tmp4_;
407 	}
408 	_tmp5_ = end;
409 	if (_tmp5_ < ((glong) 0)) {
410 		glong _tmp6_ = 0L;
411 		glong _tmp7_ = 0L;
412 		_tmp6_ = string_length;
413 		_tmp7_ = end;
414 		end = _tmp6_ + _tmp7_;
415 	}
416 	_tmp9_ = start;
417 	if (_tmp9_ >= ((glong) 0)) {
418 		glong _tmp10_ = 0L;
419 		glong _tmp11_ = 0L;
420 		_tmp10_ = start;
421 		_tmp11_ = string_length;
422 		_tmp8_ = _tmp10_ <= _tmp11_;
423 	} else {
424 		_tmp8_ = FALSE;
425 	}
426 	g_return_val_if_fail (_tmp8_, NULL);
427 	_tmp13_ = end;
428 	if (_tmp13_ >= ((glong) 0)) {
429 		glong _tmp14_ = 0L;
430 		glong _tmp15_ = 0L;
431 		_tmp14_ = end;
432 		_tmp15_ = string_length;
433 		_tmp12_ = _tmp14_ <= _tmp15_;
434 	} else {
435 		_tmp12_ = FALSE;
436 	}
437 	g_return_val_if_fail (_tmp12_, NULL);
438 	_tmp16_ = start;
439 	_tmp17_ = end;
440 	g_return_val_if_fail (_tmp16_ <= _tmp17_, NULL);
441 	_tmp18_ = start;
442 	_tmp19_ = end;
443 	_tmp20_ = start;
444 	_tmp21_ = g_strndup (((gchar*) self) + _tmp18_, (gsize) (_tmp19_ - _tmp20_));
445 	result = _tmp21_;
446 	return result;
447 }
448 
449 
____lambda4_(Block3Data * _data3_)450 static void ____lambda4_ (Block3Data* _data3_) {
451 	Block2Data* _data2_;
452 	Block1Data* _data1_;
453 	GtkCheckButton* _tmp0_ = NULL;
454 	const gchar* _tmp1_ = NULL;
455 	GtkCheckButton* _tmp2_ = NULL;
456 	gboolean _tmp3_ = FALSE;
457 	_data2_ = _data3_->_data2_;
458 	_data1_ = _data2_->_data1_;
459 	_tmp0_ = _data3_->check;
460 	_tmp1_ = gtk_button_get_label ((GtkButton*) _tmp0_);
461 	g_message ("autostart.vala:113: Label to update : %s", _tmp1_);
462 	_tmp2_ = _data3_->check;
463 	_tmp3_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp2_);
464 	if (_tmp3_) {
465 		GtkCheckButton* _tmp4_ = NULL;
466 		const gchar* _tmp5_ = NULL;
467 		gchar* _tmp6_ = NULL;
468 		gchar* _tmp7_ = NULL;
469 		gboolean _tmp8_ = FALSE;
470 		_tmp4_ = _data3_->check;
471 		_tmp5_ = gtk_button_get_label ((GtkButton*) _tmp4_);
472 		_tmp6_ = string_slice (_tmp5_, (glong) 0, (glong) 1);
473 		_tmp7_ = _tmp6_;
474 		_tmp8_ = g_strcmp0 (_tmp7_, "#") == 0;
475 		_g_free0 (_tmp7_);
476 		if (_tmp8_) {
477 			GtkCheckButton* _tmp9_ = NULL;
478 			const gchar* _tmp10_ = NULL;
479 			GtkBuilder* _tmp11_ = NULL;
480 			GtkCheckButton* _tmp12_ = NULL;
481 			const gchar* _tmp13_ = NULL;
482 			_tmp9_ = _data3_->check;
483 			_tmp10_ = gtk_button_get_label ((GtkButton*) _tmp9_);
484 			_tmp11_ = _data1_->builder;
485 			ldefault_apps_update_autostart_conf (_tmp10_, "activate", _tmp11_);
486 			_tmp12_ = _data3_->check;
487 			_tmp13_ = gtk_button_get_label ((GtkButton*) _tmp12_);
488 			g_message ("autostart.vala:119: Activate : %s", _tmp13_);
489 		}
490 	} else {
491 		GtkCheckButton* _tmp14_ = NULL;
492 		const gchar* _tmp15_ = NULL;
493 		gchar* _tmp16_ = NULL;
494 		gchar* _tmp17_ = NULL;
495 		gboolean _tmp18_ = FALSE;
496 		_tmp14_ = _data3_->check;
497 		_tmp15_ = gtk_button_get_label ((GtkButton*) _tmp14_);
498 		_tmp16_ = string_slice (_tmp15_, (glong) 0, (glong) 1);
499 		_tmp17_ = _tmp16_;
500 		_tmp18_ = g_strcmp0 (_tmp17_, "#") != 0;
501 		_g_free0 (_tmp17_);
502 		if (_tmp18_) {
503 			GtkCheckButton* _tmp19_ = NULL;
504 			const gchar* _tmp20_ = NULL;
505 			GtkBuilder* _tmp21_ = NULL;
506 			GtkCheckButton* _tmp22_ = NULL;
507 			const gchar* _tmp23_ = NULL;
508 			_tmp19_ = _data3_->check;
509 			_tmp20_ = gtk_button_get_label ((GtkButton*) _tmp19_);
510 			_tmp21_ = _data1_->builder;
511 			ldefault_apps_update_autostart_conf (_tmp20_, "desactivate", _tmp21_);
512 			_tmp22_ = _data3_->check;
513 			_tmp23_ = gtk_button_get_label ((GtkButton*) _tmp22_);
514 			g_message ("autostart.vala:127: Deactivate : %s", _tmp23_);
515 		}
516 	}
517 }
518 
519 
_____lambda4__gtk_toggle_button_toggled(GtkToggleButton * _sender,gpointer self)520 static void _____lambda4__gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
521 	____lambda4_ (self);
522 }
523 
524 
____lambda5_(Block3Data * _data3_)525 static void ____lambda5_ (Block3Data* _data3_) {
526 	Block2Data* _data2_;
527 	Block1Data* _data1_;
528 	GtkCheckButton* _tmp0_ = NULL;
529 	const gchar* _tmp1_ = NULL;
530 	GtkBuilder* _tmp2_ = NULL;
531 	GtkCheckButton* _tmp3_ = NULL;
532 	const gchar* _tmp4_ = NULL;
533 	_data2_ = _data3_->_data2_;
534 	_data1_ = _data2_->_data1_;
535 	_tmp0_ = _data3_->check;
536 	_tmp1_ = gtk_button_get_label ((GtkButton*) _tmp0_);
537 	_tmp2_ = _data1_->builder;
538 	ldefault_apps_update_autostart_conf (_tmp1_, "remove", _tmp2_);
539 	_tmp3_ = _data3_->check;
540 	_tmp4_ = gtk_button_get_label ((GtkButton*) _tmp3_);
541 	g_message ("autostart.vala:137: try to remove : %s", _tmp4_);
542 }
543 
544 
_____lambda5__gtk_button_clicked(GtkButton * _sender,gpointer self)545 static void _____lambda5__gtk_button_clicked (GtkButton* _sender, gpointer self) {
546 	____lambda5_ (self);
547 }
548 
549 
___lambda6_(Block2Data * _data2_)550 static void ___lambda6_ (Block2Data* _data2_) {
551 	Block1Data* _data1_;
552 	GtkEntry* _tmp0_ = NULL;
553 	const gchar* _tmp1_ = NULL;
554 	GtkBuilder* _tmp2_ = NULL;
555 	GtkEntry* _tmp3_ = NULL;
556 	_data1_ = _data2_->_data1_;
557 	_tmp0_ = _data2_->add_entry;
558 	_tmp1_ = gtk_entry_get_text (_tmp0_);
559 	_tmp2_ = _data1_->builder;
560 	ldefault_apps_update_autostart_conf (_tmp1_, "add", _tmp2_);
561 	_tmp3_ = _data2_->add_entry;
562 	gtk_entry_set_text (_tmp3_, "");
563 }
564 
565 
____lambda6__gtk_button_clicked(GtkButton * _sender,gpointer self)566 static void ____lambda6__gtk_button_clicked (GtkButton* _sender, gpointer self) {
567 	___lambda6_ (self);
568 }
569 
570 
ldefault_apps_manual_autostart_init(GtkBuilder * builder)571 void ldefault_apps_manual_autostart_init (GtkBuilder* builder) {
572 	Block1Data* _data1_;
573 	GtkBuilder* _tmp0_ = NULL;
574 	GtkBuilder* _tmp1_ = NULL;
575 	gchar* _tmp2_ = NULL;
576 	gchar* _tmp3_ = NULL;
577 	gboolean _tmp4_ = FALSE;
578 	g_return_if_fail (builder != NULL);
579 	_data1_ = g_slice_new0 (Block1Data);
580 	_data1_->_ref_count_ = 1;
581 	_tmp0_ = builder;
582 	_tmp1_ = _g_object_ref0 (_tmp0_);
583 	_g_object_unref0 (_data1_->builder);
584 	_data1_->builder = _tmp1_;
585 	_tmp2_ = ldefault_apps_read_autostart_conf ();
586 	_tmp3_ = _tmp2_;
587 	_tmp4_ = _tmp3_ == NULL;
588 	_g_free0 (_tmp3_);
589 	if (_tmp4_) {
590 		g_message ("autostart.vala:80: Can't find an autostart file, abort");
591 	} else {
592 		Block2Data* _data2_;
593 		FILE* stream = NULL;
594 		gchar* _tmp5_ = NULL;
595 		gchar* _tmp6_ = NULL;
596 		FILE* _tmp7_ = NULL;
597 		FILE* _tmp8_ = NULL;
598 		FILE* _tmp9_ = NULL;
599 		gchar* _tmp10_ = NULL;
600 		gchar* _tmp11_ = NULL;
601 		GtkAlignment* auto_align = NULL;
602 		GtkBuilder* _tmp12_ = NULL;
603 		GObject* _tmp13_ = NULL;
604 		GtkAlignment* _tmp14_ = NULL;
605 		GtkVBox* auto_vbox = NULL;
606 		GtkBuilder* _tmp15_ = NULL;
607 		GObject* _tmp16_ = NULL;
608 		GtkVBox* _tmp17_ = NULL;
609 		GtkVBox* _tmp18_ = NULL;
610 		GList* _tmp19_ = NULL;
611 		gchar* line = NULL;
612 		GtkHBox* add_hbox = NULL;
613 		GtkHBox* _tmp44_ = NULL;
614 		GtkButton* add_button = NULL;
615 		GtkButton* _tmp45_ = NULL;
616 		GtkEntry* _tmp46_ = NULL;
617 		GtkHBox* _tmp47_ = NULL;
618 		GtkButton* _tmp48_ = NULL;
619 		GtkHBox* _tmp49_ = NULL;
620 		GtkEntry* _tmp50_ = NULL;
621 		GtkVBox* _tmp51_ = NULL;
622 		GtkHBox* _tmp52_ = NULL;
623 		GtkAlignment* _tmp53_ = NULL;
624 		GtkVBox* _tmp54_ = NULL;
625 		GtkButton* _tmp55_ = NULL;
626 		GtkVBox* _tmp56_ = NULL;
627 		_data2_ = g_slice_new0 (Block2Data);
628 		_data2_->_ref_count_ = 1;
629 		_data2_->_data1_ = block1_data_ref (_data1_);
630 		_tmp5_ = ldefault_apps_read_autostart_conf ();
631 		_tmp6_ = _tmp5_;
632 		_tmp7_ = g_fopen (_tmp6_, "r");
633 		_tmp8_ = _tmp7_;
634 		_g_free0 (_tmp6_);
635 		stream = _tmp8_;
636 		_tmp9_ = stream;
637 		_vala_assert (_tmp9_ != NULL, "stream != null");
638 		_tmp10_ = ldefault_apps_read_autostart_conf ();
639 		_tmp11_ = _tmp10_;
640 		g_message ("autostart.vala:87: Autostart conf file : %s", _tmp11_);
641 		_g_free0 (_tmp11_);
642 		_tmp12_ = _data1_->builder;
643 		_tmp13_ = gtk_builder_get_object (_tmp12_, "autostart_alignment");
644 		_tmp14_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp13_, GTK_TYPE_ALIGNMENT) ? ((GtkAlignment*) _tmp13_) : NULL);
645 		auto_align = _tmp14_;
646 		_tmp15_ = _data1_->builder;
647 		_tmp16_ = gtk_builder_get_object (_tmp15_, "manual_autostart_vbox");
648 		_tmp17_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp16_, GTK_TYPE_VBOX) ? ((GtkVBox*) _tmp16_) : NULL);
649 		auto_vbox = _tmp17_;
650 		_tmp18_ = auto_vbox;
651 		_tmp19_ = gtk_container_get_children ((GtkContainer*) _tmp18_);
652 		{
653 			GList* widget_collection = NULL;
654 			GList* widget_it = NULL;
655 			widget_collection = _tmp19_;
656 			for (widget_it = widget_collection; widget_it != NULL; widget_it = widget_it->next) {
657 				GtkWidget* widget = NULL;
658 				widget = (GtkWidget*) widget_it->data;
659 				{
660 					GtkVBox* _tmp20_ = NULL;
661 					GtkWidget* _tmp21_ = NULL;
662 					_tmp20_ = auto_vbox;
663 					_tmp21_ = widget;
664 					gtk_container_remove ((GtkContainer*) _tmp20_, _tmp21_);
665 				}
666 			}
667 			_g_list_free0 (widget_collection);
668 		}
669 		line = NULL;
670 		while (TRUE) {
671 			Block3Data* _data3_;
672 			FILE* _tmp22_ = NULL;
673 			gchar* _tmp23_ = NULL;
674 			const gchar* _tmp24_ = NULL;
675 			const gchar* _tmp25_ = NULL;
676 			GtkHBox* hbox = NULL;
677 			GtkHBox* _tmp26_ = NULL;
678 			const gchar* _tmp27_ = NULL;
679 			GtkCheckButton* _tmp28_ = NULL;
680 			const gchar* _tmp29_ = NULL;
681 			gchar* _tmp30_ = NULL;
682 			gchar* _tmp31_ = NULL;
683 			gboolean _tmp32_ = FALSE;
684 			GtkCheckButton* _tmp35_ = NULL;
685 			GtkHBox* _tmp36_ = NULL;
686 			GtkCheckButton* _tmp37_ = NULL;
687 			GtkButton* button = NULL;
688 			GtkButton* _tmp38_ = NULL;
689 			GtkButton* _tmp39_ = NULL;
690 			GtkHBox* _tmp40_ = NULL;
691 			GtkButton* _tmp41_ = NULL;
692 			GtkVBox* _tmp42_ = NULL;
693 			GtkHBox* _tmp43_ = NULL;
694 			_data3_ = g_slice_new0 (Block3Data);
695 			_data3_->_ref_count_ = 1;
696 			_data3_->_data2_ = block2_data_ref (_data2_);
697 			_tmp22_ = stream;
698 			_tmp23_ = g_file_stream_read_line (_tmp22_);
699 			_g_free0 (line);
700 			line = _tmp23_;
701 			_tmp24_ = line;
702 			if (!(_tmp24_ != NULL)) {
703 				block3_data_unref (_data3_);
704 				_data3_ = NULL;
705 				break;
706 			}
707 			_tmp25_ = line;
708 			g_message ("autostart.vala:100: Autostart line : %s", _tmp25_);
709 			_tmp26_ = (GtkHBox*) gtk_hbox_new (FALSE, 0);
710 			g_object_ref_sink (_tmp26_);
711 			hbox = _tmp26_;
712 			_tmp27_ = line;
713 			_tmp28_ = (GtkCheckButton*) gtk_check_button_new_with_label (_tmp27_);
714 			g_object_ref_sink (_tmp28_);
715 			_data3_->check = _tmp28_;
716 			_tmp29_ = line;
717 			_tmp30_ = string_slice (_tmp29_, (glong) 0, (glong) 1);
718 			_tmp31_ = _tmp30_;
719 			_tmp32_ = g_strcmp0 (_tmp31_, "#") == 0;
720 			_g_free0 (_tmp31_);
721 			if (_tmp32_) {
722 				GtkCheckButton* _tmp33_ = NULL;
723 				_tmp33_ = _data3_->check;
724 				gtk_toggle_button_set_active ((GtkToggleButton*) _tmp33_, FALSE);
725 			} else {
726 				GtkCheckButton* _tmp34_ = NULL;
727 				_tmp34_ = _data3_->check;
728 				gtk_toggle_button_set_active ((GtkToggleButton*) _tmp34_, TRUE);
729 			}
730 			_tmp35_ = _data3_->check;
731 			g_signal_connect_data ((GtkToggleButton*) _tmp35_, "toggled", (GCallback) _____lambda4__gtk_toggle_button_toggled, block3_data_ref (_data3_), (GClosureNotify) block3_data_unref, 0);
732 			_tmp36_ = hbox;
733 			_tmp37_ = _data3_->check;
734 			gtk_box_pack_start ((GtkBox*) _tmp36_, (GtkWidget*) _tmp37_, FALSE, FALSE, (guint) 0);
735 			_tmp38_ = (GtkButton*) gtk_button_new_from_stock ("gtk-remove");
736 			g_object_ref_sink (_tmp38_);
737 			button = _tmp38_;
738 			_tmp39_ = button;
739 			g_signal_connect_data (_tmp39_, "clicked", (GCallback) _____lambda5__gtk_button_clicked, block3_data_ref (_data3_), (GClosureNotify) block3_data_unref, 0);
740 			_tmp40_ = hbox;
741 			_tmp41_ = button;
742 			gtk_box_pack_start ((GtkBox*) _tmp40_, (GtkWidget*) _tmp41_, FALSE, FALSE, (guint) 0);
743 			_tmp42_ = auto_vbox;
744 			_tmp43_ = hbox;
745 			gtk_box_pack_start ((GtkBox*) _tmp42_, (GtkWidget*) _tmp43_, FALSE, FALSE, (guint) 0);
746 			_g_object_unref0 (button);
747 			_g_object_unref0 (hbox);
748 			block3_data_unref (_data3_);
749 			_data3_ = NULL;
750 		}
751 		_tmp44_ = (GtkHBox*) gtk_hbox_new (FALSE, 0);
752 		g_object_ref_sink (_tmp44_);
753 		add_hbox = _tmp44_;
754 		_tmp45_ = (GtkButton*) gtk_button_new_from_stock ("gtk-add");
755 		g_object_ref_sink (_tmp45_);
756 		add_button = _tmp45_;
757 		_tmp46_ = (GtkEntry*) gtk_entry_new ();
758 		g_object_ref_sink (_tmp46_);
759 		_data2_->add_entry = _tmp46_;
760 		_tmp47_ = add_hbox;
761 		_tmp48_ = add_button;
762 		gtk_box_pack_start ((GtkBox*) _tmp47_, (GtkWidget*) _tmp48_, FALSE, FALSE, (guint) 0);
763 		_tmp49_ = add_hbox;
764 		_tmp50_ = _data2_->add_entry;
765 		gtk_box_pack_start ((GtkBox*) _tmp49_, (GtkWidget*) _tmp50_, FALSE, FALSE, (guint) 0);
766 		_tmp51_ = auto_vbox;
767 		_tmp52_ = add_hbox;
768 		gtk_box_pack_start ((GtkBox*) _tmp51_, (GtkWidget*) _tmp52_, FALSE, FALSE, (guint) 0);
769 		_tmp53_ = auto_align;
770 		_tmp54_ = auto_vbox;
771 		gtk_container_add ((GtkContainer*) _tmp53_, (GtkWidget*) _tmp54_);
772 		_tmp55_ = add_button;
773 		g_signal_connect_data (_tmp55_, "clicked", (GCallback) ____lambda6__gtk_button_clicked, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0);
774 		_tmp56_ = auto_vbox;
775 		gtk_widget_show_all ((GtkWidget*) _tmp56_);
776 		_g_object_unref0 (add_button);
777 		_g_object_unref0 (add_hbox);
778 		_g_free0 (line);
779 		_g_object_unref0 (auto_vbox);
780 		_g_object_unref0 (auto_align);
781 		_fclose0 (stream);
782 		block2_data_unref (_data2_);
783 		_data2_ = NULL;
784 	}
785 	block1_data_unref (_data1_);
786 	_data1_ = NULL;
787 }
788 
789 
ldefault_apps_update_autostart_conf(const gchar * line,const gchar * action,GtkBuilder * builder)790 void ldefault_apps_update_autostart_conf (const gchar* line, const gchar* action, GtkBuilder* builder) {
791 	GString* new_line = NULL;
792 	GString* _tmp0_ = NULL;
793 	const gchar* _tmp1_ = NULL;
794 	const gchar* _tmp2_ = NULL;
795 	GQuark _tmp4_ = 0U;
796 	static GQuark _tmp3_label0 = 0;
797 	static GQuark _tmp3_label1 = 0;
798 	static GQuark _tmp3_label2 = 0;
799 	static GQuark _tmp3_label3 = 0;
800 	GError * _inner_error_ = NULL;
801 	g_return_if_fail (line != NULL);
802 	g_return_if_fail (action != NULL);
803 	g_return_if_fail (builder != NULL);
804 	_tmp0_ = g_string_new ("");
805 	new_line = _tmp0_;
806 	_tmp1_ = action;
807 	_tmp2_ = _tmp1_;
808 	_tmp4_ = (NULL == _tmp2_) ? 0 : g_quark_from_string (_tmp2_);
809 	if (_tmp4_ == ((0 != _tmp3_label0) ? _tmp3_label0 : (_tmp3_label0 = g_quark_from_static_string ("activate")))) {
810 		switch (0) {
811 			default:
812 			{
813 				GString* _tmp5_ = NULL;
814 				const gchar* _tmp6_ = NULL;
815 				GString* _tmp7_ = NULL;
816 				GString* _tmp8_ = NULL;
817 				_tmp5_ = new_line;
818 				_tmp6_ = line;
819 				g_string_append (_tmp5_, _tmp6_);
820 				_tmp7_ = new_line;
821 				g_string_erase (_tmp7_, (gssize) 0, (gssize) 1);
822 				_tmp8_ = new_line;
823 				g_string_append (_tmp8_, "\n");
824 				break;
825 			}
826 		}
827 	} else if (_tmp4_ == ((0 != _tmp3_label1) ? _tmp3_label1 : (_tmp3_label1 = g_quark_from_static_string ("desactivate")))) {
828 		switch (0) {
829 			default:
830 			{
831 				GString* _tmp9_ = NULL;
832 				GString* _tmp10_ = NULL;
833 				const gchar* _tmp11_ = NULL;
834 				GString* _tmp12_ = NULL;
835 				_tmp9_ = new_line;
836 				g_string_append (_tmp9_, "#");
837 				_tmp10_ = new_line;
838 				_tmp11_ = line;
839 				g_string_append (_tmp10_, _tmp11_);
840 				_tmp12_ = new_line;
841 				g_string_append (_tmp12_, "\n");
842 				break;
843 			}
844 		}
845 	} else if (_tmp4_ == ((0 != _tmp3_label2) ? _tmp3_label2 : (_tmp3_label2 = g_quark_from_static_string ("add")))) {
846 		switch (0) {
847 			default:
848 			{
849 				GString* _tmp13_ = NULL;
850 				const gchar* _tmp14_ = NULL;
851 				GString* _tmp15_ = NULL;
852 				_tmp13_ = new_line;
853 				_tmp14_ = line;
854 				g_string_append (_tmp13_, _tmp14_);
855 				_tmp15_ = new_line;
856 				g_string_append (_tmp15_, "\n");
857 				break;
858 			}
859 		}
860 	} else if (_tmp4_ == ((0 != _tmp3_label3) ? _tmp3_label3 : (_tmp3_label3 = g_quark_from_static_string ("remove")))) {
861 		switch (0) {
862 			default:
863 			{
864 				break;
865 			}
866 		}
867 	}
868 	{
869 		gchar* tmp_path = NULL;
870 		const gchar* _tmp16_ = NULL;
871 		gchar* _tmp17_ = NULL;
872 		GFile* tmp_file = NULL;
873 		const gchar* _tmp18_ = NULL;
874 		GFile* _tmp19_ = NULL;
875 		GFile* dest_file = NULL;
876 		gchar* _tmp20_ = NULL;
877 		gchar* _tmp21_ = NULL;
878 		GFile* _tmp22_ = NULL;
879 		GFile* _tmp23_ = NULL;
880 		FILE* stream = NULL;
881 		gchar* _tmp24_ = NULL;
882 		gchar* _tmp25_ = NULL;
883 		FILE* _tmp26_ = NULL;
884 		FILE* _tmp27_ = NULL;
885 		GFileOutputStream* _tmp28_ = NULL;
886 		GFile* _tmp29_ = NULL;
887 		GFileOutputStream* _tmp30_ = NULL;
888 		GDataOutputStream* tmp_stream = NULL;
889 		GDataOutputStream* _tmp31_ = NULL;
890 		FILE* _tmp32_ = NULL;
891 		gchar* read = NULL;
892 		const gchar* _tmp46_ = NULL;
893 		GFile* _tmp50_ = NULL;
894 		GFile* _tmp51_ = NULL;
895 		GFile* _tmp52_ = NULL;
896 		GtkBuilder* _tmp53_ = NULL;
897 		_tmp16_ = g_get_user_cache_dir ();
898 		_tmp17_ = g_build_filename (_tmp16_, "lxsession-default-apps", "autostart.tmp", NULL);
899 		tmp_path = _tmp17_;
900 		_tmp18_ = tmp_path;
901 		_tmp19_ = g_file_new_for_path (_tmp18_);
902 		tmp_file = _tmp19_;
903 		_tmp20_ = ldefault_apps_read_autostart_conf ();
904 		_tmp21_ = _tmp20_;
905 		_tmp22_ = g_file_new_for_path (_tmp21_);
906 		_tmp23_ = _tmp22_;
907 		_g_free0 (_tmp21_);
908 		dest_file = _tmp23_;
909 		_tmp24_ = ldefault_apps_read_autostart_conf ();
910 		_tmp25_ = _tmp24_;
911 		_tmp26_ = g_fopen (_tmp25_, "r");
912 		_tmp27_ = _tmp26_;
913 		_g_free0 (_tmp25_);
914 		stream = _tmp27_;
915 		_tmp29_ = tmp_file;
916 		_tmp30_ = g_file_create (_tmp29_, G_FILE_CREATE_REPLACE_DESTINATION, NULL, &_inner_error_);
917 		_tmp28_ = _tmp30_;
918 		if (G_UNLIKELY (_inner_error_ != NULL)) {
919 			_fclose0 (stream);
920 			_g_object_unref0 (dest_file);
921 			_g_object_unref0 (tmp_file);
922 			_g_free0 (tmp_path);
923 			goto __catch3_g_error;
924 		}
925 		_tmp31_ = g_data_output_stream_new ((GOutputStream*) _tmp28_);
926 		tmp_stream = _tmp31_;
927 		_tmp32_ = stream;
928 		_vala_assert (_tmp32_ != NULL, "stream != null");
929 		read = NULL;
930 		while (TRUE) {
931 			FILE* _tmp33_ = NULL;
932 			gchar* _tmp34_ = NULL;
933 			const gchar* _tmp35_ = NULL;
934 			const gchar* _tmp36_ = NULL;
935 			const gchar* _tmp37_ = NULL;
936 			const gchar* _tmp38_ = NULL;
937 			const gchar* _tmp39_ = NULL;
938 			_tmp33_ = stream;
939 			_tmp34_ = g_file_stream_read_line (_tmp33_);
940 			_g_free0 (read);
941 			read = _tmp34_;
942 			_tmp35_ = read;
943 			if (!(_tmp35_ != NULL)) {
944 				break;
945 			}
946 			_tmp36_ = read;
947 			g_message ("autostart.vala:196: read : %s", _tmp36_);
948 			_tmp37_ = line;
949 			g_message ("autostart.vala:197: line : %s", _tmp37_);
950 			_tmp38_ = read;
951 			_tmp39_ = line;
952 			if (g_strcmp0 (_tmp38_, _tmp39_) == 0) {
953 				GDataOutputStream* _tmp40_ = NULL;
954 				GString* _tmp41_ = NULL;
955 				const gchar* _tmp42_ = NULL;
956 				_tmp40_ = tmp_stream;
957 				_tmp41_ = new_line;
958 				_tmp42_ = _tmp41_->str;
959 				g_data_output_stream_put_string (_tmp40_, _tmp42_, NULL, &_inner_error_);
960 				if (G_UNLIKELY (_inner_error_ != NULL)) {
961 					_g_free0 (read);
962 					_g_object_unref0 (tmp_stream);
963 					_g_object_unref0 (_tmp28_);
964 					_fclose0 (stream);
965 					_g_object_unref0 (dest_file);
966 					_g_object_unref0 (tmp_file);
967 					_g_free0 (tmp_path);
968 					goto __catch3_g_error;
969 				}
970 			} else {
971 				GDataOutputStream* _tmp43_ = NULL;
972 				const gchar* _tmp44_ = NULL;
973 				GDataOutputStream* _tmp45_ = NULL;
974 				_tmp43_ = tmp_stream;
975 				_tmp44_ = read;
976 				g_data_output_stream_put_string (_tmp43_, _tmp44_, NULL, &_inner_error_);
977 				if (G_UNLIKELY (_inner_error_ != NULL)) {
978 					_g_free0 (read);
979 					_g_object_unref0 (tmp_stream);
980 					_g_object_unref0 (_tmp28_);
981 					_fclose0 (stream);
982 					_g_object_unref0 (dest_file);
983 					_g_object_unref0 (tmp_file);
984 					_g_free0 (tmp_path);
985 					goto __catch3_g_error;
986 				}
987 				_tmp45_ = tmp_stream;
988 				g_data_output_stream_put_string (_tmp45_, "\n", NULL, &_inner_error_);
989 				if (G_UNLIKELY (_inner_error_ != NULL)) {
990 					_g_free0 (read);
991 					_g_object_unref0 (tmp_stream);
992 					_g_object_unref0 (_tmp28_);
993 					_fclose0 (stream);
994 					_g_object_unref0 (dest_file);
995 					_g_object_unref0 (tmp_file);
996 					_g_free0 (tmp_path);
997 					goto __catch3_g_error;
998 				}
999 			}
1000 		}
1001 		_tmp46_ = action;
1002 		if (g_strcmp0 (_tmp46_, "add") == 0) {
1003 			GDataOutputStream* _tmp47_ = NULL;
1004 			GString* _tmp48_ = NULL;
1005 			const gchar* _tmp49_ = NULL;
1006 			_tmp47_ = tmp_stream;
1007 			_tmp48_ = new_line;
1008 			_tmp49_ = _tmp48_->str;
1009 			g_data_output_stream_put_string (_tmp47_, _tmp49_, NULL, &_inner_error_);
1010 			if (G_UNLIKELY (_inner_error_ != NULL)) {
1011 				_g_free0 (read);
1012 				_g_object_unref0 (tmp_stream);
1013 				_g_object_unref0 (_tmp28_);
1014 				_fclose0 (stream);
1015 				_g_object_unref0 (dest_file);
1016 				_g_object_unref0 (tmp_file);
1017 				_g_free0 (tmp_path);
1018 				goto __catch3_g_error;
1019 			}
1020 		}
1021 		_tmp50_ = tmp_file;
1022 		_tmp51_ = dest_file;
1023 		g_file_copy (_tmp50_, _tmp51_, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, &_inner_error_);
1024 		if (G_UNLIKELY (_inner_error_ != NULL)) {
1025 			_g_free0 (read);
1026 			_g_object_unref0 (tmp_stream);
1027 			_g_object_unref0 (_tmp28_);
1028 			_fclose0 (stream);
1029 			_g_object_unref0 (dest_file);
1030 			_g_object_unref0 (tmp_file);
1031 			_g_free0 (tmp_path);
1032 			goto __catch3_g_error;
1033 		}
1034 		_tmp52_ = tmp_file;
1035 		g_file_delete (_tmp52_, NULL, &_inner_error_);
1036 		if (G_UNLIKELY (_inner_error_ != NULL)) {
1037 			_g_free0 (read);
1038 			_g_object_unref0 (tmp_stream);
1039 			_g_object_unref0 (_tmp28_);
1040 			_fclose0 (stream);
1041 			_g_object_unref0 (dest_file);
1042 			_g_object_unref0 (tmp_file);
1043 			_g_free0 (tmp_path);
1044 			goto __catch3_g_error;
1045 		}
1046 		_tmp53_ = builder;
1047 		ldefault_apps_manual_autostart_init (_tmp53_);
1048 		_g_free0 (read);
1049 		_g_object_unref0 (tmp_stream);
1050 		_g_object_unref0 (_tmp28_);
1051 		_fclose0 (stream);
1052 		_g_object_unref0 (dest_file);
1053 		_g_object_unref0 (tmp_file);
1054 		_g_free0 (tmp_path);
1055 	}
1056 	goto __finally3;
1057 	__catch3_g_error:
1058 	{
1059 		GError* e = NULL;
1060 		GError* _tmp54_ = NULL;
1061 		const gchar* _tmp55_ = NULL;
1062 		e = _inner_error_;
1063 		_inner_error_ = NULL;
1064 		_tmp54_ = e;
1065 		_tmp55_ = _tmp54_->message;
1066 		g_message ("autostart.vala:221: %s", _tmp55_);
1067 		_g_error_free0 (e);
1068 	}
1069 	__finally3:
1070 	if (G_UNLIKELY (_inner_error_ != NULL)) {
1071 		_g_string_free0 (new_line);
1072 		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
1073 		g_clear_error (&_inner_error_);
1074 		return;
1075 	}
1076 	_g_string_free0 (new_line);
1077 }
1078 
1079 
ldefault_apps_autostart_core_applications(GtkBuilder * builder,LDefaultAppsDbusBackend * dbus_backend)1080 void ldefault_apps_autostart_core_applications (GtkBuilder* builder, LDefaultAppsDbusBackend* dbus_backend) {
1081 	g_return_if_fail (builder != NULL);
1082 	g_return_if_fail (dbus_backend != NULL);
1083 }
1084 
1085 
ldefault_apps_get_config_home_path(const gchar * conf_file)1086 gchar* ldefault_apps_get_config_home_path (const gchar* conf_file) {
1087 	gchar* result = NULL;
1088 	gchar* user_config_dir = NULL;
1089 	const gchar* _tmp0_ = NULL;
1090 	const gchar* _tmp1_ = NULL;
1091 	const gchar* _tmp2_ = NULL;
1092 	gchar* _tmp3_ = NULL;
1093 	g_return_val_if_fail (conf_file != NULL, NULL);
1094 	_tmp0_ = g_get_user_config_dir ();
1095 	_tmp1_ = g_getenv ("DESKTOP_SESSION");
1096 	_tmp2_ = conf_file;
1097 	_tmp3_ = g_build_filename (_tmp0_, "lxsession", _tmp1_, _tmp2_, NULL);
1098 	user_config_dir = _tmp3_;
1099 	result = user_config_dir;
1100 	return result;
1101 }
1102 
1103 
_vala_array_dup1(gchar ** self,int length)1104 static gchar** _vala_array_dup1 (gchar** self, int length) {
1105 	gchar** result;
1106 	int i;
1107 	result = g_new0 (gchar*, length + 1);
1108 	for (i = 0; i < length; i++) {
1109 		gchar* _tmp0_ = NULL;
1110 		_tmp0_ = g_strdup (self[i]);
1111 		result[i] = _tmp0_;
1112 	}
1113 	return result;
1114 }
1115 
1116 
ldefault_apps_get_config_path(const gchar * conf_file)1117 gchar* ldefault_apps_get_config_path (const gchar* conf_file) {
1118 	gchar* result = NULL;
1119 	gchar* final_config_file = NULL;
1120 	gchar* user_config_dir = NULL;
1121 	const gchar* _tmp0_ = NULL;
1122 	gchar* _tmp1_ = NULL;
1123 	const gchar* _tmp2_ = NULL;
1124 	gboolean _tmp3_ = FALSE;
1125 	const gchar* _tmp24_ = NULL;
1126 	g_return_val_if_fail (conf_file != NULL, NULL);
1127 	_tmp0_ = conf_file;
1128 	_tmp1_ = ldefault_apps_get_config_home_path (_tmp0_);
1129 	user_config_dir = _tmp1_;
1130 	_tmp2_ = user_config_dir;
1131 	_tmp3_ = g_file_test (_tmp2_, G_FILE_TEST_EXISTS);
1132 	if (_tmp3_) {
1133 		const gchar* _tmp4_ = NULL;
1134 		const gchar* _tmp5_ = NULL;
1135 		gchar* _tmp6_ = NULL;
1136 		_tmp4_ = user_config_dir;
1137 		g_message ("autostart.vala:275: User config used : %s", _tmp4_);
1138 		_tmp5_ = user_config_dir;
1139 		_tmp6_ = g_strdup (_tmp5_);
1140 		_g_free0 (final_config_file);
1141 		final_config_file = _tmp6_;
1142 	} else {
1143 		gchar** system_config_dirs = NULL;
1144 		gchar** _tmp7_ = NULL;
1145 		gchar** _tmp8_ = NULL;
1146 		gchar** _tmp9_ = NULL;
1147 		gint _tmp9__length1 = 0;
1148 		gint system_config_dirs_length1 = 0;
1149 		gint _system_config_dirs_size_ = 0;
1150 		gchar* config_system_location = NULL;
1151 		gchar* path_system_config_file = NULL;
1152 		gchar** _tmp10_ = NULL;
1153 		gint _tmp10__length1 = 0;
1154 		const gchar* _tmp21_ = NULL;
1155 		const gchar* _tmp22_ = NULL;
1156 		gchar* _tmp23_ = NULL;
1157 		_tmp8_ = _tmp7_ = g_get_system_config_dirs ();
1158 		_tmp9_ = (_tmp8_ != NULL) ? _vala_array_dup1 (_tmp8_, _vala_array_length (_tmp7_)) : ((gpointer) _tmp8_);
1159 		_tmp9__length1 = _vala_array_length (_tmp7_);
1160 		system_config_dirs = _tmp9_;
1161 		system_config_dirs_length1 = _tmp9__length1;
1162 		_system_config_dirs_size_ = system_config_dirs_length1;
1163 		config_system_location = NULL;
1164 		path_system_config_file = NULL;
1165 		_tmp10_ = system_config_dirs;
1166 		_tmp10__length1 = system_config_dirs_length1;
1167 		{
1168 			gchar** config_collection = NULL;
1169 			gint config_collection_length1 = 0;
1170 			gint _config_collection_size_ = 0;
1171 			gint config_it = 0;
1172 			config_collection = _tmp10_;
1173 			config_collection_length1 = _tmp10__length1;
1174 			for (config_it = 0; config_it < _tmp10__length1; config_it = config_it + 1) {
1175 				gchar* _tmp11_ = NULL;
1176 				gchar* config = NULL;
1177 				_tmp11_ = g_strdup (config_collection[config_it]);
1178 				config = _tmp11_;
1179 				{
1180 					const gchar* _tmp12_ = NULL;
1181 					const gchar* _tmp13_ = NULL;
1182 					gchar* _tmp14_ = NULL;
1183 					const gchar* _tmp15_ = NULL;
1184 					const gchar* _tmp16_ = NULL;
1185 					gboolean _tmp17_ = FALSE;
1186 					_tmp12_ = config;
1187 					_tmp13_ = g_getenv ("DESKTOP_SESSION");
1188 					_tmp14_ = g_build_filename (_tmp12_, "lxsession", _tmp13_, NULL);
1189 					_g_free0 (config_system_location);
1190 					config_system_location = _tmp14_;
1191 					_tmp15_ = config_system_location;
1192 					g_message ("autostart.vala:286: Config system location : %s", _tmp15_);
1193 					_tmp16_ = config_system_location;
1194 					_tmp17_ = g_file_test (_tmp16_, G_FILE_TEST_EXISTS);
1195 					if (_tmp17_) {
1196 						const gchar* _tmp18_ = NULL;
1197 						const gchar* _tmp19_ = NULL;
1198 						gchar* _tmp20_ = NULL;
1199 						_tmp18_ = config_system_location;
1200 						_tmp19_ = conf_file;
1201 						_tmp20_ = g_build_filename (_tmp18_, _tmp19_, NULL);
1202 						_g_free0 (path_system_config_file);
1203 						path_system_config_file = _tmp20_;
1204 						_g_free0 (config);
1205 						break;
1206 					}
1207 					_g_free0 (config);
1208 				}
1209 			}
1210 		}
1211 		_tmp21_ = path_system_config_file;
1212 		g_message ("autostart.vala:292: System system path location : %s", _tmp21_);
1213 		_tmp22_ = path_system_config_file;
1214 		_tmp23_ = g_strdup (_tmp22_);
1215 		_g_free0 (final_config_file);
1216 		final_config_file = _tmp23_;
1217 		_g_free0 (path_system_config_file);
1218 		_g_free0 (config_system_location);
1219 		system_config_dirs = (_vala_array_free (system_config_dirs, system_config_dirs_length1, (GDestroyNotify) g_free), NULL);
1220 	}
1221 	_tmp24_ = final_config_file;
1222 	g_message ("autostart.vala:296: Final file used : %s", _tmp24_);
1223 	result = final_config_file;
1224 	_g_free0 (user_config_dir);
1225 	return result;
1226 }
1227 
1228 
_vala_array_destroy(gpointer array,gint array_length,GDestroyNotify destroy_func)1229 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
1230 	if ((array != NULL) && (destroy_func != NULL)) {
1231 		int i;
1232 		for (i = 0; i < array_length; i = i + 1) {
1233 			if (((gpointer*) array)[i] != NULL) {
1234 				destroy_func (((gpointer*) array)[i]);
1235 			}
1236 		}
1237 	}
1238 }
1239 
1240 
_vala_array_free(gpointer array,gint array_length,GDestroyNotify destroy_func)1241 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
1242 	_vala_array_destroy (array, array_length, destroy_func);
1243 	g_free (array);
1244 }
1245 
1246 
_vala_array_length(gpointer array)1247 static gint _vala_array_length (gpointer array) {
1248 	int length;
1249 	length = 0;
1250 	if (array) {
1251 		while (((gpointer*) array)[length]) {
1252 			length++;
1253 		}
1254 	}
1255 	return length;
1256 }
1257 
1258 
1259 
1260