aboutsummaryrefslogtreecommitdiff
path: root/src/settings-manager.c
blob: 52d187ceaeecc04d0e1d5fd686be7650ee8988f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
/* settings-manager.c generated by valac 0.16.1, the Vala compiler
 * generated from settings-manager.vala, do not modify */

/*
Copyright 2010 Canonical Ltd.

Authors:
    Conor Curran <conor.curran@canonical.com>

This program is free software: you can redistribute it and/or modify it 
under the terms of the GNU General Public License version 3, as published 
by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but 
WITHOUT ANY WARRANTY; without even the implied warranties of 
MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR 
PURPOSE.  See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along 
with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <gee.h>


#define TYPE_SETTINGS_MANAGER (settings_manager_get_type ())
#define SETTINGS_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SETTINGS_MANAGER, SettingsManager))
#define SETTINGS_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SETTINGS_MANAGER, SettingsManagerClass))
#define IS_SETTINGS_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SETTINGS_MANAGER))
#define IS_SETTINGS_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SETTINGS_MANAGER))
#define SETTINGS_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SETTINGS_MANAGER, SettingsManagerClass))

typedef struct _SettingsManager SettingsManager;
typedef struct _SettingsManagerClass SettingsManagerClass;
typedef struct _SettingsManagerPrivate SettingsManagerPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_variant_type_free0(var) ((var == NULL) ? NULL : (var = (g_variant_type_free (var), NULL)))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
#define _g_variant_builder_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_builder_unref (var), NULL)))

struct _SettingsManager {
	GObject parent_instance;
	SettingsManagerPrivate * priv;
};

struct _SettingsManagerClass {
	GObjectClass parent_class;
};

struct _SettingsManagerPrivate {
	GSettings* settings;
};


static gpointer settings_manager_parent_class = NULL;

GType settings_manager_get_type (void) G_GNUC_CONST;
#define SETTINGS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_SETTINGS_MANAGER, SettingsManagerPrivate))
enum  {
	SETTINGS_MANAGER_DUMMY_PROPERTY
};
SettingsManager* settings_manager_new (void);
SettingsManager* settings_manager_construct (GType object_type);
gchar** settings_manager_fetch_blacklist (SettingsManager* self, int* result_length1);
GeeArrayList* settings_manager_fetch_preferred (SettingsManager* self);
GeeArrayList* settings_manager_fetch_interested (SettingsManager* self);
static gboolean _vala_string_array_contains (gchar** stack, int stack_length, gchar* needle);
void settings_manager_clear_list (SettingsManager* self);
void settings_manager_remove_interested (SettingsManager* self, const gchar* app_desktop_name);
void settings_manager_add_interested (SettingsManager* self, const gchar* app_desktop_name);
static void settings_manager_on_blacklist_event (SettingsManager* self);
static void settings_manager_on_preferred_event (SettingsManager* self);
static void g_cclosure_user_marshal_VOID__BOXED_INT (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data);
static GObject * settings_manager_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void _settings_manager_on_blacklist_event_g_settings_changed (GSettings* _sender, const gchar* key, gpointer self);
static void _settings_manager_on_preferred_event_g_settings_changed (GSettings* _sender, const gchar* key, gpointer self);
static void settings_manager_finalize (GObject* obj);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static gint _vala_array_length (gpointer array);


SettingsManager* settings_manager_construct (GType object_type) {
	SettingsManager * self = NULL;
	self = (SettingsManager*) g_object_new (object_type, NULL);
	return self;
}


SettingsManager* settings_manager_new (void) {
	return settings_manager_construct (TYPE_SETTINGS_MANAGER);
}


gchar** settings_manager_fetch_blacklist (SettingsManager* self, int* result_length1) {
	gchar** result = NULL;
	GSettings* _tmp0_;
	gchar** _tmp1_;
	gchar** _tmp2_ = NULL;
	gchar** _tmp3_;
	gint _tmp3__length1;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->settings;
	_tmp2_ = _tmp1_ = g_settings_get_strv (_tmp0_, "blacklisted-media-players");
	_tmp3_ = _tmp2_;
	_tmp3__length1 = _vala_array_length (_tmp1_);
	if (result_length1) {
		*result_length1 = _tmp3__length1;
	}
	result = _tmp3_;
	return result;
}


GeeArrayList* settings_manager_fetch_preferred (SettingsManager* self) {
	GeeArrayList* result = NULL;
	GeeArrayList* _tmp0_;
	GeeArrayList* list;
	GSettings* _tmp1_;
	gchar** _tmp2_;
	gchar** _tmp3_ = NULL;
	gchar** preferred;
	gint preferred_length1;
	gint _preferred_size_;
	GeeArrayList* _tmp4_ = NULL;
	GeeArrayList* interested;
	gchar** _tmp5_;
	gint _tmp5__length1;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL);
	list = _tmp0_;
	_tmp1_ = self->priv->settings;
	_tmp3_ = _tmp2_ = g_settings_get_strv (_tmp1_, "preferred-media-players");
	preferred = _tmp3_;
	preferred_length1 = _vala_array_length (_tmp2_);
	_preferred_size_ = preferred_length1;
	_tmp4_ = settings_manager_fetch_interested (self);
	interested = _tmp4_;
	_tmp5_ = preferred;
	_tmp5__length1 = preferred_length1;
	{
		gchar** s_collection = NULL;
		gint s_collection_length1 = 0;
		gint _s_collection_size_ = 0;
		gint s_it = 0;
		s_collection = _tmp5_;
		s_collection_length1 = _tmp5__length1;
		for (s_it = 0; s_it < _tmp5__length1; s_it = s_it + 1) {
			gchar* _tmp6_;
			gchar* s = NULL;
			_tmp6_ = g_strdup (s_collection[s_it]);
			s = _tmp6_;
			{
				gboolean _tmp7_ = FALSE;
				GeeArrayList* _tmp8_;
				const gchar* _tmp9_;
				gboolean _tmp10_ = FALSE;
				gboolean _tmp14_;
				_tmp8_ = list;
				_tmp9_ = s;
				_tmp10_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp8_, _tmp9_);
				if (!_tmp10_) {
					GeeArrayList* _tmp11_;
					const gchar* _tmp12_;
					gboolean _tmp13_ = FALSE;
					_tmp11_ = interested;
					_tmp12_ = s;
					_tmp13_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp11_, _tmp12_);
					_tmp7_ = _tmp13_;
				} else {
					_tmp7_ = FALSE;
				}
				_tmp14_ = _tmp7_;
				if (_tmp14_) {
					GeeArrayList* _tmp15_;
					const gchar* _tmp16_;
					_tmp15_ = list;
					_tmp16_ = s;
					gee_abstract_collection_add ((GeeAbstractCollection*) _tmp15_, _tmp16_);
				}
				_g_free0 (s);
			}
		}
	}
	result = list;
	_g_object_unref0 (interested);
	preferred = (_vala_array_free (preferred, preferred_length1, (GDestroyNotify) g_free), NULL);
	return result;
}


static gboolean _vala_string_array_contains (gchar** stack, int stack_length, gchar* needle) {
	int i;
	for (i = 0; i < stack_length; i++) {
		if (g_strcmp0 (stack[i], needle) == 0) {
			return TRUE;
		}
	}
	return FALSE;
}


GeeArrayList* settings_manager_fetch_interested (SettingsManager* self) {
	GeeArrayList* result = NULL;
	gint _tmp0_ = 0;
	gchar** _tmp1_ = NULL;
	gchar** blacklisted;
	gint blacklisted_length1;
	gint _blacklisted_size_;
	GSettings* _tmp2_;
	gchar** _tmp3_;
	gchar** _tmp4_ = NULL;
	gchar** interested;
	gint interested_length1;
	gint _interested_size_;
	GeeArrayList* _tmp5_;
	GeeArrayList* list;
	gchar** _tmp6_;
	gint _tmp6__length1;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp1_ = settings_manager_fetch_blacklist (self, &_tmp0_);
	blacklisted = _tmp1_;
	blacklisted_length1 = _tmp0_;
	_blacklisted_size_ = blacklisted_length1;
	_tmp2_ = self->priv->settings;
	_tmp4_ = _tmp3_ = g_settings_get_strv (_tmp2_, "interested-media-players");
	interested = _tmp4_;
	interested_length1 = _vala_array_length (_tmp3_);
	_interested_size_ = interested_length1;
	_tmp5_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL);
	list = _tmp5_;
	_tmp6_ = interested;
	_tmp6__length1 = interested_length1;
	{
		gchar** s_collection = NULL;
		gint s_collection_length1 = 0;
		gint _s_collection_size_ = 0;
		gint s_it = 0;
		s_collection = _tmp6_;
		s_collection_length1 = _tmp6__length1;
		for (s_it = 0; s_it < _tmp6__length1; s_it = s_it + 1) {
			gchar* _tmp7_;
			gchar* s = NULL;
			_tmp7_ = g_strdup (s_collection[s_it]);
			s = _tmp7_;
			{
				const gchar* _tmp8_;
				GeeArrayList* _tmp10_;
				const gchar* _tmp11_;
				gboolean _tmp12_ = FALSE;
				const gchar* _tmp13_;
				gchar** _tmp14_;
				gint _tmp14__length1;
				GeeArrayList* _tmp15_;
				const gchar* _tmp16_;
				_tmp8_ = s;
				if (g_strcmp0 (_tmp8_, "banshee-1") == 0) {
					gchar* _tmp9_;
					_tmp9_ = g_strdup ("banshee");
					_g_free0 (s);
					s = _tmp9_;
				}
				_tmp10_ = list;
				_tmp11_ = s;
				_tmp12_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp10_, _tmp11_);
				if (_tmp12_) {
					_g_free0 (s);
					continue;
				}
				_tmp13_ = s;
				_tmp14_ = blacklisted;
				_tmp14__length1 = blacklisted_length1;
				if (_vala_string_array_contains (_tmp14_, _tmp14__length1, _tmp13_)) {
					_g_free0 (s);
					continue;
				}
				_tmp15_ = list;
				_tmp16_ = s;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp15_, _tmp16_);
				_g_free0 (s);
			}
		}
	}
	result = list;
	interested = (_vala_array_free (interested, interested_length1, (GDestroyNotify) g_free), NULL);
	blacklisted = (_vala_array_free (blacklisted, blacklisted_length1, (GDestroyNotify) g_free), NULL);
	return result;
}


void settings_manager_clear_list (SettingsManager* self) {
	GSettings* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->settings;
	g_settings_reset (_tmp0_, "interested-media-players");
}


void settings_manager_remove_interested (SettingsManager* self, const gchar* app_desktop_name) {
	static const char key[] = "interested-media-players";
	GVariantType* _tmp0_;
	GVariantType* _tmp1_;
	GVariantBuilder* _tmp2_;
	GVariantBuilder* _tmp3_;
	GVariantBuilder* players;
	GSettings* _tmp4_;
	gchar** _tmp5_;
	gchar** _tmp6_ = NULL;
	GSettings* _tmp12_;
	GVariantBuilder* _tmp13_;
	GVariant* _tmp14_ = NULL;
	GVariant* _tmp15_;
	GSettings* _tmp16_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (app_desktop_name != NULL);
	_tmp0_ = g_variant_type_new ("as");
	_tmp1_ = _tmp0_;
	_tmp2_ = g_variant_builder_new (_tmp1_);
	_tmp3_ = _tmp2_;
	_g_variant_type_free0 (_tmp1_);
	players = _tmp3_;
	_tmp4_ = self->priv->settings;
	_tmp6_ = _tmp5_ = g_settings_get_strv (_tmp4_, key);
	{
		gchar** player_collection = NULL;
		gint player_collection_length1 = 0;
		gint _player_collection_size_ = 0;
		gint player_it = 0;
		player_collection = _tmp6_;
		player_collection_length1 = _vala_array_length (_tmp5_);
		for (player_it = 0; player_it < _vala_array_length (_tmp5_); player_it = player_it + 1) {
			gchar* _tmp7_;
			gchar* player = NULL;
			_tmp7_ = g_strdup (player_collection[player_it]);
			player = _tmp7_;
			{
				const gchar* _tmp8_;
				const gchar* _tmp9_;
				_tmp8_ = player;
				_tmp9_ = app_desktop_name;
				if (g_strcmp0 (_tmp8_, _tmp9_) != 0) {
					GVariantBuilder* _tmp10_;
					const gchar* _tmp11_;
					_tmp10_ = players;
					_tmp11_ = player;
					g_variant_builder_add (_tmp10_, "s", _tmp11_, NULL);
				}
				_g_free0 (player);
			}
		}
		player_collection = (_vala_array_free (player_collection, player_collection_length1, (GDestroyNotify) g_free), NULL);
	}
	_tmp12_ = self->priv->settings;
	_tmp13_ = players;
	_tmp14_ = g_variant_builder_end (_tmp13_);
	_tmp15_ = g_variant_ref_sink (_tmp14_);
	g_settings_set_value (_tmp12_, key, _tmp15_);
	_g_variant_unref0 (_tmp15_);
	_tmp16_ = self->priv->settings;
	g_settings_apply (_tmp16_);
	_g_variant_builder_unref0 (players);
}


void settings_manager_add_interested (SettingsManager* self, const gchar* app_desktop_name) {
	static const char key[] = "interested-media-players";
	GVariantType* _tmp0_;
	GVariantType* _tmp1_;
	GVariantBuilder* _tmp2_;
	GVariantBuilder* _tmp3_;
	GVariantBuilder* players;
	GSettings* _tmp4_;
	gchar** _tmp5_;
	gchar** _tmp6_ = NULL;
	GVariantBuilder* _tmp12_;
	const gchar* _tmp13_;
	GSettings* _tmp14_;
	GVariantBuilder* _tmp15_;
	GVariant* _tmp16_ = NULL;
	GVariant* _tmp17_;
	GSettings* _tmp18_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (app_desktop_name != NULL);
	_tmp0_ = g_variant_type_new ("as");
	_tmp1_ = _tmp0_;
	_tmp2_ = g_variant_builder_new (_tmp1_);
	_tmp3_ = _tmp2_;
	_g_variant_type_free0 (_tmp1_);
	players = _tmp3_;
	_tmp4_ = self->priv->settings;
	_tmp6_ = _tmp5_ = g_settings_get_strv (_tmp4_, key);
	{
		gchar** player_collection = NULL;
		gint player_collection_length1 = 0;
		gint _player_collection_size_ = 0;
		gint player_it = 0;
		player_collection = _tmp6_;
		player_collection_length1 = _vala_array_length (_tmp5_);
		for (player_it = 0; player_it < _vala_array_length (_tmp5_); player_it = player_it + 1) {
			gchar* _tmp7_;
			gchar* player = NULL;
			_tmp7_ = g_strdup (player_collection[player_it]);
			player = _tmp7_;
			{
				const gchar* _tmp8_;
				const gchar* _tmp9_;
				GVariantBuilder* _tmp10_;
				const gchar* _tmp11_;
				_tmp8_ = player;
				_tmp9_ = app_desktop_name;
				if (g_strcmp0 (_tmp8_, _tmp9_) == 0) {
					_g_free0 (player);
					player_collection = (_vala_array_free (player_collection, player_collection_length1, (GDestroyNotify) g_free), NULL);
					_g_variant_builder_unref0 (players);
					return;
				}
				_tmp10_ = players;
				_tmp11_ = player;
				g_variant_builder_add (_tmp10_, "s", _tmp11_, NULL);
				_g_free0 (player);
			}
		}
		player_collection = (_vala_array_free (player_collection, player_collection_length1, (GDestroyNotify) g_free), NULL);
	}
	_tmp12_ = players;
	_tmp13_ = app_desktop_name;
	g_variant_builder_add (_tmp12_, "s", _tmp13_, NULL);
	_tmp14_ = self->priv->settings;
	_tmp15_ = players;
	_tmp16_ = g_variant_builder_end (_tmp15_);
	_tmp17_ = g_variant_ref_sink (_tmp16_);
	g_settings_set_value (_tmp14_, key, _tmp17_);
	_g_variant_unref0 (_tmp17_);
	_tmp18_ = self->priv->settings;
	g_settings_apply (_tmp18_);
	_g_variant_builder_unref0 (players);
}


static void settings_manager_on_blacklist_event (SettingsManager* self) {
	GSettings* _tmp0_;
	gchar** _tmp1_;
	gchar** _tmp2_ = NULL;
	gchar** _tmp3_;
	gint _tmp3__length1;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->settings;
	_tmp2_ = _tmp1_ = g_settings_get_strv (_tmp0_, "blacklisted-media-players");
	_tmp3_ = _tmp2_;
	_tmp3__length1 = _vala_array_length (_tmp1_);
	g_signal_emit_by_name (self, "blacklist-updates", _tmp3_, _vala_array_length (_tmp1_));
	_tmp3_ = (_vala_array_free (_tmp3_, _tmp3__length1, (GDestroyNotify) g_free), NULL);
}


static void settings_manager_on_preferred_event (SettingsManager* self) {
	GeeArrayList* _tmp0_ = NULL;
	GeeArrayList* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = settings_manager_fetch_preferred (self);
	_tmp1_ = _tmp0_;
	g_signal_emit_by_name (self, "preferred-updates", _tmp1_);
	_g_object_unref0 (_tmp1_);
}


static void g_cclosure_user_marshal_VOID__BOXED_INT (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) {
	typedef void (*GMarshalFunc_VOID__BOXED_INT) (gpointer data1, gpointer arg_1, gint arg_2, gpointer data2);
	register GMarshalFunc_VOID__BOXED_INT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__BOXED_INT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_boxed (param_values + 1), g_value_get_int (param_values + 2), data2);
}


static void _settings_manager_on_blacklist_event_g_settings_changed (GSettings* _sender, const gchar* key, gpointer self) {
	settings_manager_on_blacklist_event (self);
}


static void _settings_manager_on_preferred_event_g_settings_changed (GSettings* _sender, const gchar* key, gpointer self) {
	settings_manager_on_preferred_event (self);
}


static GObject * settings_manager_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	SettingsManager * self;
	GSettings* _tmp0_;
	GSettings* _tmp1_;
	GSettings* _tmp2_;
	parent_class = G_OBJECT_CLASS (settings_manager_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = SETTINGS_MANAGER (obj);
	_tmp0_ = g_settings_new ("com.canonical.indicator.sound");
	_g_object_unref0 (self->priv->settings);
	self->priv->settings = _tmp0_;
	_tmp1_ = self->priv->settings;
	g_signal_connect_object (_tmp1_, "changed::blacklisted-media-players", (GCallback) _settings_manager_on_blacklist_event_g_settings_changed, self, 0);
	_tmp2_ = self->priv->settings;
	g_signal_connect_object (_tmp2_, "changed::preferred-media-players", (GCallback) _settings_manager_on_preferred_event_g_settings_changed, self, 0);
	return obj;
}


static void settings_manager_class_init (SettingsManagerClass * klass) {
	settings_manager_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (SettingsManagerPrivate));
	G_OBJECT_CLASS (klass)->constructor = settings_manager_constructor;
	G_OBJECT_CLASS (klass)->finalize = settings_manager_finalize;
	g_signal_new ("blacklist_updates", TYPE_SETTINGS_MANAGER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__BOXED_INT, G_TYPE_NONE, 2, G_TYPE_STRV, G_TYPE_INT);
	g_signal_new ("preferred_updates", TYPE_SETTINGS_MANAGER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GEE_TYPE_ARRAY_LIST);
}


static void settings_manager_instance_init (SettingsManager * self) {
	self->priv = SETTINGS_MANAGER_GET_PRIVATE (self);
}


static void settings_manager_finalize (GObject* obj) {
	SettingsManager * self;
	self = SETTINGS_MANAGER (obj);
	_g_object_unref0 (self->priv->settings);
	G_OBJECT_CLASS (settings_manager_parent_class)->finalize (obj);
}


GType settings_manager_get_type (void) {
	static volatile gsize settings_manager_type_id__volatile = 0;
	if (g_once_init_enter (&settings_manager_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (SettingsManagerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) settings_manager_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SettingsManager), 0, (GInstanceInitFunc) settings_manager_instance_init, NULL };
		GType settings_manager_type_id;
		settings_manager_type_id = g_type_register_static (G_TYPE_OBJECT, "SettingsManager", &g_define_type_info, 0);
		g_once_init_leave (&settings_manager_type_id__volatile, settings_manager_type_id);
	}
	return settings_manager_type_id__volatile;
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}


static gint _vala_array_length (gpointer array) {
	int length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}