~jconti/recent-notifications/ppa-gnome3

« back to all changes in this revision

Viewing changes to src/preferences.c

  • Committer: Jason Conti
  • Date: 2012-04-11 20:53:14 UTC
  • Revision ID: jason.conti@gmail.com-20120411205314-j3hgrs6etqa5b64h
Tags: upstream-0.5.2
ImportĀ upstreamĀ versionĀ 0.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* preferences.c generated by valac 0.16.0, the Vala compiler
 
2
 * generated from preferences.vala, do not modify */
 
3
 
 
4
 
 
5
#include <glib.h>
 
6
#include <glib-object.h>
 
7
#include <gio/gio.h>
 
8
#include <stdlib.h>
 
9
#include <string.h>
 
10
#include <gtk/gtk.h>
 
11
#include "config.h"
 
12
#include <glib/gi18n-lib.h>
 
13
 
 
14
 
 
15
#define TYPE_PREFERENCES (preferences_get_type ())
 
16
#define PREFERENCES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PREFERENCES, Preferences))
 
17
#define PREFERENCES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PREFERENCES, PreferencesClass))
 
18
#define IS_PREFERENCES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PREFERENCES))
 
19
#define IS_PREFERENCES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PREFERENCES))
 
20
#define PREFERENCES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PREFERENCES, PreferencesClass))
 
21
 
 
22
typedef struct _Preferences Preferences;
 
23
typedef struct _PreferencesClass PreferencesClass;
 
24
typedef struct _PreferencesPrivate PreferencesPrivate;
 
25
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
 
26
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
 
27
#define _g_free0(var) (var = (g_free (var), NULL))
 
28
 
 
29
#define TYPE_BLACKLIST_PREFERENCE (blacklist_preference_get_type ())
 
30
#define BLACKLIST_PREFERENCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BLACKLIST_PREFERENCE, BlacklistPreference))
 
31
#define BLACKLIST_PREFERENCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BLACKLIST_PREFERENCE, BlacklistPreferenceClass))
 
32
#define IS_BLACKLIST_PREFERENCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BLACKLIST_PREFERENCE))
 
33
#define IS_BLACKLIST_PREFERENCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BLACKLIST_PREFERENCE))
 
34
#define BLACKLIST_PREFERENCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BLACKLIST_PREFERENCE, BlacklistPreferenceClass))
 
35
 
 
36
typedef struct _BlacklistPreference BlacklistPreference;
 
37
typedef struct _BlacklistPreferenceClass BlacklistPreferenceClass;
 
38
typedef struct _BlacklistPreferencePrivate BlacklistPreferencePrivate;
 
39
 
 
40
#define BLACKLIST_PREFERENCE_TYPE_COLUMN (blacklist_preference_column_get_type ())
 
41
 
 
42
struct _Preferences {
 
43
        GObject parent_instance;
 
44
        PreferencesPrivate * priv;
 
45
};
 
46
 
 
47
struct _PreferencesClass {
 
48
        GObjectClass parent_class;
 
49
};
 
50
 
 
51
struct _PreferencesPrivate {
 
52
        GSettings* _settings;
 
53
};
 
54
 
 
55
struct _BlacklistPreference {
 
56
        GObject parent_instance;
 
57
        BlacklistPreferencePrivate * priv;
 
58
};
 
59
 
 
60
struct _BlacklistPreferenceClass {
 
61
        GObjectClass parent_class;
 
62
};
 
63
 
 
64
struct _BlacklistPreferencePrivate {
 
65
        GtkTreeView* _treeview;
 
66
        GtkListStore* _liststore;
 
67
        GStaticRecMutex __lock__liststore;
 
68
        GtkButton* _add_button;
 
69
        GtkButton* _remove_button;
 
70
        GtkEntry* _add_entry;
 
71
        GSettings* _settings;
 
72
};
 
73
 
 
74
typedef enum  {
 
75
        BLACKLIST_PREFERENCE_COLUMN_APP_NAME = 0,
 
76
        BLACKLIST_PREFERENCE_COLUMN_COUNT
 
77
} BlacklistPreferenceColumn;
 
78
 
 
79
 
 
80
static gpointer preferences_parent_class = NULL;
 
81
static gpointer blacklist_preference_parent_class = NULL;
 
82
 
 
83
GType preferences_get_type (void) G_GNUC_CONST;
 
84
#define PREFERENCES_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_PREFERENCES, PreferencesPrivate))
 
85
enum  {
 
86
        PREFERENCES_DUMMY_PROPERTY
 
87
};
 
88
#define PREFERENCES_SCHEMA_ID "net.launchpad.RecentNotifications"
 
89
#define PREFERENCES_SCHEMA_PATH "/net/launchpad/RecentNotifications/"
 
90
#define PREFERENCES_BLACKLIST "blacklist"
 
91
#define PREFERENCES_CONSOLE_LOG "console-log"
 
92
#define PREFERENCES_DEBUG "debug"
 
93
#define PREFERENCES_NOTIFICATION_LIMIT "notification-limit"
 
94
#define PREFERENCES_SHOW_COUNT "show-count"
 
95
Preferences* preferences_new (void);
 
96
Preferences* preferences_construct (GType object_type);
 
97
void preferences_bind (Preferences* self, const gchar* key, GObject* object, const gchar* property);
 
98
void preferences_bind_read_only (Preferences* self, const gchar* key, GObject* object, const gchar* property);
 
99
void preferences_show_dialog (Preferences* self);
 
100
BlacklistPreference* blacklist_preference_new (GSettings* settings, GtkBuilder* builder);
 
101
BlacklistPreference* blacklist_preference_construct (GType object_type, GSettings* settings, GtkBuilder* builder);
 
102
GType blacklist_preference_get_type (void) G_GNUC_CONST;
 
103
void blacklist_preference_connect_handlers (BlacklistPreference* self);
 
104
static void preferences_finalize (GObject* obj);
 
105
#define BLACKLIST_PREFERENCE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_BLACKLIST_PREFERENCE, BlacklistPreferencePrivate))
 
106
enum  {
 
107
        BLACKLIST_PREFERENCE_DUMMY_PROPERTY
 
108
};
 
109
static GType blacklist_preference_column_get_type (void) G_GNUC_UNUSED;
 
110
static void blacklist_preference_set_values (BlacklistPreference* self, gchar** values, int values_length1);
 
111
static void __lambda16_ (BlacklistPreference* self, GtkButton* button);
 
112
static void blacklist_preference_append_item (BlacklistPreference* self, const gchar* item);
 
113
static gchar** blacklist_preference_get_values (BlacklistPreference* self, int* result_length1);
 
114
static void ___lambda16__gtk_button_clicked (GtkButton* _sender, gpointer self);
 
115
static void __lambda17_ (BlacklistPreference* self, GtkButton* button);
 
116
static gboolean blacklist_preference_remove_item (BlacklistPreference* self);
 
117
static void ___lambda17__gtk_button_clicked (GtkButton* _sender, gpointer self);
 
118
static void blacklist_preference_finalize (GObject* obj);
 
119
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
 
120
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
 
121
static gint _vala_array_length (gpointer array);
 
122
 
 
123
 
 
124
Preferences* preferences_construct (GType object_type) {
 
125
        Preferences * self = NULL;
 
126
        GSettings* _tmp0_;
 
127
        self = (Preferences*) g_object_new (object_type, NULL);
 
128
        _tmp0_ = g_settings_new (PREFERENCES_SCHEMA_ID);
 
129
        _g_object_unref0 (self->priv->_settings);
 
130
        self->priv->_settings = _tmp0_;
 
131
        return self;
 
132
}
 
133
 
 
134
 
 
135
Preferences* preferences_new (void) {
 
136
        return preferences_construct (TYPE_PREFERENCES);
 
137
}
 
138
 
 
139
 
 
140
/**
 
141
   * Binds an object's property. When the property is set, the GSettings key is
 
142
   * updated, and when the GSettings key is updated, the property is updated.
 
143
   *
 
144
   * @param key the preference key
 
145
   * @param object the object interested
 
146
   * @param property the object's property to bind
 
147
   */
 
148
void preferences_bind (Preferences* self, const gchar* key, GObject* object, const gchar* property) {
 
149
        GSettings* _tmp0_;
 
150
        const gchar* _tmp1_;
 
151
        GObject* _tmp2_;
 
152
        const gchar* _tmp3_;
 
153
        g_return_if_fail (self != NULL);
 
154
        g_return_if_fail (key != NULL);
 
155
        g_return_if_fail (object != NULL);
 
156
        g_return_if_fail (property != NULL);
 
157
        _tmp0_ = self->priv->_settings;
 
158
        _tmp1_ = key;
 
159
        _tmp2_ = object;
 
160
        _tmp3_ = property;
 
161
        g_settings_bind (_tmp0_, _tmp1_, _tmp2_, _tmp3_, G_SETTINGS_BIND_DEFAULT);
 
162
}
 
163
 
 
164
 
 
165
/**
 
166
   * Binds an object's property. When the GSettings key is updated, the
 
167
   * property is updated.
 
168
   *
 
169
   * @param key the preference key
 
170
   * @param object the object interested
 
171
   * @param property the object's property to bind
 
172
   */
 
173
void preferences_bind_read_only (Preferences* self, const gchar* key, GObject* object, const gchar* property) {
 
174
        GSettings* _tmp0_;
 
175
        const gchar* _tmp1_;
 
176
        GObject* _tmp2_;
 
177
        const gchar* _tmp3_;
 
178
        g_return_if_fail (self != NULL);
 
179
        g_return_if_fail (key != NULL);
 
180
        g_return_if_fail (object != NULL);
 
181
        g_return_if_fail (property != NULL);
 
182
        _tmp0_ = self->priv->_settings;
 
183
        _tmp1_ = key;
 
184
        _tmp2_ = object;
 
185
        _tmp3_ = property;
 
186
        g_settings_bind (_tmp0_, _tmp1_, _tmp2_, _tmp3_, G_SETTINGS_BIND_GET);
 
187
}
 
188
 
 
189
 
 
190
/**
 
191
   * Shows the preferences dialog.
 
192
   */
 
193
static gpointer _g_object_ref0 (gpointer self) {
 
194
        return self ? g_object_ref (self) : NULL;
 
195
}
 
196
 
 
197
 
 
198
void preferences_show_dialog (Preferences* self) {
 
199
        GtkBuilder* _tmp0_;
 
200
        GtkBuilder* builder;
 
201
        gchar* _tmp1_;
 
202
        gchar* filename;
 
203
        GtkBuilder* _tmp7_;
 
204
        GObject* _tmp8_ = NULL;
 
205
        GtkDialog* _tmp9_;
 
206
        GtkDialog* dialog;
 
207
        GtkBuilder* _tmp10_;
 
208
        GObject* _tmp11_ = NULL;
 
209
        GtkCheckButton* _tmp12_;
 
210
        GtkCheckButton* debug_button;
 
211
        GtkCheckButton* _tmp13_;
 
212
        GtkBuilder* _tmp14_;
 
213
        GObject* _tmp15_ = NULL;
 
214
        GtkCheckButton* _tmp16_;
 
215
        GtkCheckButton* console_log_button;
 
216
        GtkCheckButton* _tmp17_;
 
217
        GtkBuilder* _tmp18_;
 
218
        GObject* _tmp19_ = NULL;
 
219
        GtkCheckButton* _tmp20_;
 
220
        GtkCheckButton* show_count_button;
 
221
        GtkCheckButton* _tmp21_;
 
222
        GtkBuilder* _tmp22_;
 
223
        GObject* _tmp23_ = NULL;
 
224
        GtkSpinButton* _tmp24_;
 
225
        GtkSpinButton* notification_limit_button;
 
226
        GtkSpinButton* _tmp25_;
 
227
        GSettings* _tmp26_;
 
228
        GtkBuilder* _tmp27_;
 
229
        BlacklistPreference* _tmp28_;
 
230
        BlacklistPreference* blacklist_preferences;
 
231
        BlacklistPreference* _tmp29_;
 
232
        GtkDialog* _tmp30_;
 
233
        GtkDialog* _tmp31_;
 
234
        GError * _inner_error_ = NULL;
 
235
        g_return_if_fail (self != NULL);
 
236
        _tmp0_ = gtk_builder_new ();
 
237
        builder = _tmp0_;
 
238
        _tmp1_ = g_strdup (UI_DATA_DIR "/preferences-dialog.ui");
 
239
        filename = _tmp1_;
 
240
        {
 
241
                GtkBuilder* _tmp2_;
 
242
                const gchar* _tmp3_;
 
243
                _tmp2_ = builder;
 
244
                _tmp3_ = filename;
 
245
                gtk_builder_add_from_file (_tmp2_, _tmp3_, &_inner_error_);
 
246
                if (_inner_error_ != NULL) {
 
247
                        goto __catch9_g_error;
 
248
                }
 
249
        }
 
250
        goto __finally9;
 
251
        __catch9_g_error:
 
252
        {
 
253
                GError* e = NULL;
 
254
                const gchar* _tmp4_;
 
255
                GError* _tmp5_;
 
256
                const gchar* _tmp6_;
 
257
                e = _inner_error_;
 
258
                _inner_error_ = NULL;
 
259
                _tmp4_ = filename;
 
260
                _tmp5_ = e;
 
261
                _tmp6_ = _tmp5_->message;
 
262
                g_warning ("preferences.vala:61: Failed to load preferences dialog from '%s': %s", _tmp4_, _tmp6_);
 
263
                _g_error_free0 (e);
 
264
                _g_free0 (filename);
 
265
                _g_object_unref0 (builder);
 
266
                return;
 
267
        }
 
268
        __finally9:
 
269
        if (_inner_error_ != NULL) {
 
270
                _g_free0 (filename);
 
271
                _g_object_unref0 (builder);
 
272
                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);
 
273
                g_clear_error (&_inner_error_);
 
274
                return;
 
275
        }
 
276
        _tmp7_ = builder;
 
277
        _tmp8_ = gtk_builder_get_object (_tmp7_, "preferences_dialog");
 
278
        _tmp9_ = _g_object_ref0 (GTK_IS_DIALOG (_tmp8_) ? ((GtkDialog*) _tmp8_) : NULL);
 
279
        dialog = _tmp9_;
 
280
        _tmp10_ = builder;
 
281
        _tmp11_ = gtk_builder_get_object (_tmp10_, "debug_button");
 
282
        _tmp12_ = _g_object_ref0 (GTK_IS_CHECK_BUTTON (_tmp11_) ? ((GtkCheckButton*) _tmp11_) : NULL);
 
283
        debug_button = _tmp12_;
 
284
        _tmp13_ = debug_button;
 
285
        preferences_bind (self, PREFERENCES_DEBUG, (GObject*) _tmp13_, "active");
 
286
        _tmp14_ = builder;
 
287
        _tmp15_ = gtk_builder_get_object (_tmp14_, "console_log_button");
 
288
        _tmp16_ = _g_object_ref0 (GTK_IS_CHECK_BUTTON (_tmp15_) ? ((GtkCheckButton*) _tmp15_) : NULL);
 
289
        console_log_button = _tmp16_;
 
290
        _tmp17_ = console_log_button;
 
291
        preferences_bind (self, PREFERENCES_CONSOLE_LOG, (GObject*) _tmp17_, "active");
 
292
        _tmp18_ = builder;
 
293
        _tmp19_ = gtk_builder_get_object (_tmp18_, "show_count_button");
 
294
        _tmp20_ = _g_object_ref0 (GTK_IS_CHECK_BUTTON (_tmp19_) ? ((GtkCheckButton*) _tmp19_) : NULL);
 
295
        show_count_button = _tmp20_;
 
296
        _tmp21_ = show_count_button;
 
297
        preferences_bind (self, PREFERENCES_SHOW_COUNT, (GObject*) _tmp21_, "active");
 
298
        _tmp22_ = builder;
 
299
        _tmp23_ = gtk_builder_get_object (_tmp22_, "notification_limit_button");
 
300
        _tmp24_ = _g_object_ref0 (GTK_IS_SPIN_BUTTON (_tmp23_) ? ((GtkSpinButton*) _tmp23_) : NULL);
 
301
        notification_limit_button = _tmp24_;
 
302
        _tmp25_ = notification_limit_button;
 
303
        preferences_bind (self, PREFERENCES_NOTIFICATION_LIMIT, (GObject*) _tmp25_, "value");
 
304
        _tmp26_ = self->priv->_settings;
 
305
        _tmp27_ = builder;
 
306
        _tmp28_ = blacklist_preference_new (_tmp26_, _tmp27_);
 
307
        blacklist_preferences = _tmp28_;
 
308
        _tmp29_ = blacklist_preferences;
 
309
        blacklist_preference_connect_handlers (_tmp29_);
 
310
        _tmp30_ = dialog;
 
311
        gtk_dialog_run (_tmp30_);
 
312
        _tmp31_ = dialog;
 
313
        gtk_widget_destroy ((GtkWidget*) _tmp31_);
 
314
        _g_object_unref0 (blacklist_preferences);
 
315
        _g_object_unref0 (notification_limit_button);
 
316
        _g_object_unref0 (show_count_button);
 
317
        _g_object_unref0 (console_log_button);
 
318
        _g_object_unref0 (debug_button);
 
319
        _g_object_unref0 (dialog);
 
320
        _g_free0 (filename);
 
321
        _g_object_unref0 (builder);
 
322
}
 
323
 
 
324
 
 
325
static void preferences_class_init (PreferencesClass * klass) {
 
326
        preferences_parent_class = g_type_class_peek_parent (klass);
 
327
        g_type_class_add_private (klass, sizeof (PreferencesPrivate));
 
328
        G_OBJECT_CLASS (klass)->finalize = preferences_finalize;
 
329
}
 
330
 
 
331
 
 
332
static void preferences_instance_init (Preferences * self) {
 
333
        self->priv = PREFERENCES_GET_PRIVATE (self);
 
334
}
 
335
 
 
336
 
 
337
static void preferences_finalize (GObject* obj) {
 
338
        Preferences * self;
 
339
        self = PREFERENCES (obj);
 
340
        _g_object_unref0 (self->priv->_settings);
 
341
        G_OBJECT_CLASS (preferences_parent_class)->finalize (obj);
 
342
}
 
343
 
 
344
 
 
345
/**
 
346
 * Wrap GLib.Settings to provide preferences for the applet.
 
347
 */
 
348
GType preferences_get_type (void) {
 
349
        static volatile gsize preferences_type_id__volatile = 0;
 
350
        if (g_once_init_enter (&preferences_type_id__volatile)) {
 
351
                static const GTypeInfo g_define_type_info = { sizeof (PreferencesClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) preferences_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Preferences), 0, (GInstanceInitFunc) preferences_instance_init, NULL };
 
352
                GType preferences_type_id;
 
353
                preferences_type_id = g_type_register_static (G_TYPE_OBJECT, "Preferences", &g_define_type_info, 0);
 
354
                g_once_init_leave (&preferences_type_id__volatile, preferences_type_id);
 
355
        }
 
356
        return preferences_type_id__volatile;
 
357
}
 
358
 
 
359
 
 
360
static GType blacklist_preference_column_get_type (void) {
 
361
        static volatile gsize blacklist_preference_column_type_id__volatile = 0;
 
362
        if (g_once_init_enter (&blacklist_preference_column_type_id__volatile)) {
 
363
                static const GEnumValue values[] = {{BLACKLIST_PREFERENCE_COLUMN_APP_NAME, "BLACKLIST_PREFERENCE_COLUMN_APP_NAME", "app-name"}, {BLACKLIST_PREFERENCE_COLUMN_COUNT, "BLACKLIST_PREFERENCE_COLUMN_COUNT", "count"}, {0, NULL, NULL}};
 
364
                GType blacklist_preference_column_type_id;
 
365
                blacklist_preference_column_type_id = g_enum_register_static ("BlacklistPreferenceColumn", values);
 
366
                g_once_init_leave (&blacklist_preference_column_type_id__volatile, blacklist_preference_column_type_id);
 
367
        }
 
368
        return blacklist_preference_column_type_id__volatile;
 
369
}
 
370
 
 
371
 
 
372
/**
 
373
   * Creates a new blacklist preference object and binds the blacklist setting.
 
374
   *
 
375
   * @param settings the GLib.Settings object to bind
 
376
   */
 
377
BlacklistPreference* blacklist_preference_construct (GType object_type, GSettings* settings, GtkBuilder* builder) {
 
378
        BlacklistPreference * self = NULL;
 
379
        GtkListStore* _tmp0_;
 
380
        GtkTreeViewColumn* _tmp1_;
 
381
        GtkTreeViewColumn* _tmp2_;
 
382
        GtkTreeViewColumn* column;
 
383
        const gchar* _tmp3_ = NULL;
 
384
        GtkBuilder* _tmp4_;
 
385
        GObject* _tmp5_ = NULL;
 
386
        GtkTreeView* _tmp6_;
 
387
        GtkTreeView* _tmp7_;
 
388
        GtkListStore* _tmp8_;
 
389
        GtkTreeView* _tmp9_;
 
390
        GtkCellRendererText* _tmp10_;
 
391
        GtkCellRendererText* _tmp11_;
 
392
        GtkCellRendererText* cell;
 
393
        GtkBuilder* _tmp12_;
 
394
        GObject* _tmp13_ = NULL;
 
395
        GtkEntry* _tmp14_;
 
396
        GtkBuilder* _tmp15_;
 
397
        GObject* _tmp16_ = NULL;
 
398
        GtkButton* _tmp17_;
 
399
        GtkBuilder* _tmp18_;
 
400
        GObject* _tmp19_ = NULL;
 
401
        GtkButton* _tmp20_;
 
402
        GSettings* _tmp21_;
 
403
        GSettings* _tmp22_;
 
404
        GSettings* _tmp23_;
 
405
        gchar** _tmp24_;
 
406
        gchar** _tmp25_ = NULL;
 
407
        gchar** _tmp26_;
 
408
        gint _tmp26__length1;
 
409
        g_return_val_if_fail (settings != NULL, NULL);
 
410
        g_return_val_if_fail (builder != NULL, NULL);
 
411
        self = (BlacklistPreference*) g_object_new (object_type, NULL);
 
412
        _tmp0_ = gtk_list_store_new ((gint) BLACKLIST_PREFERENCE_COLUMN_COUNT, G_TYPE_STRING);
 
413
        _g_object_unref0 (self->priv->_liststore);
 
414
        self->priv->_liststore = _tmp0_;
 
415
        _tmp1_ = gtk_tree_view_column_new ();
 
416
        _tmp2_ = g_object_ref_sink (_tmp1_);
 
417
        column = _tmp2_;
 
418
        _tmp3_ = _ ("Application Name");
 
419
        gtk_tree_view_column_set_title (column, _tmp3_);
 
420
        _tmp4_ = builder;
 
421
        _tmp5_ = gtk_builder_get_object (_tmp4_, "blacklist_treeview");
 
422
        _tmp6_ = _g_object_ref0 (GTK_IS_TREE_VIEW (_tmp5_) ? ((GtkTreeView*) _tmp5_) : NULL);
 
423
        _g_object_unref0 (self->priv->_treeview);
 
424
        self->priv->_treeview = _tmp6_;
 
425
        _tmp7_ = self->priv->_treeview;
 
426
        _tmp8_ = self->priv->_liststore;
 
427
        gtk_tree_view_set_model (_tmp7_, (GtkTreeModel*) _tmp8_);
 
428
        _tmp9_ = self->priv->_treeview;
 
429
        gtk_tree_view_append_column (_tmp9_, column);
 
430
        _tmp10_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
 
431
        _tmp11_ = g_object_ref_sink (_tmp10_);
 
432
        cell = _tmp11_;
 
433
        gtk_cell_layout_pack_start ((GtkCellLayout*) column, (GtkCellRenderer*) cell, TRUE);
 
434
        gtk_cell_layout_add_attribute ((GtkCellLayout*) column, (GtkCellRenderer*) cell, "text", (gint) BLACKLIST_PREFERENCE_COLUMN_APP_NAME);
 
435
        _tmp12_ = builder;
 
436
        _tmp13_ = gtk_builder_get_object (_tmp12_, "blacklist_add_entry");
 
437
        _tmp14_ = _g_object_ref0 (GTK_IS_ENTRY (_tmp13_) ? ((GtkEntry*) _tmp13_) : NULL);
 
438
        _g_object_unref0 (self->priv->_add_entry);
 
439
        self->priv->_add_entry = _tmp14_;
 
440
        _tmp15_ = builder;
 
441
        _tmp16_ = gtk_builder_get_object (_tmp15_, "blacklist_add_button");
 
442
        _tmp17_ = _g_object_ref0 (GTK_IS_BUTTON (_tmp16_) ? ((GtkButton*) _tmp16_) : NULL);
 
443
        _g_object_unref0 (self->priv->_add_button);
 
444
        self->priv->_add_button = _tmp17_;
 
445
        _tmp18_ = builder;
 
446
        _tmp19_ = gtk_builder_get_object (_tmp18_, "blacklist_remove_button");
 
447
        _tmp20_ = _g_object_ref0 (GTK_IS_BUTTON (_tmp19_) ? ((GtkButton*) _tmp19_) : NULL);
 
448
        _g_object_unref0 (self->priv->_remove_button);
 
449
        self->priv->_remove_button = _tmp20_;
 
450
        _tmp21_ = settings;
 
451
        _tmp22_ = _g_object_ref0 (_tmp21_);
 
452
        _g_object_unref0 (self->priv->_settings);
 
453
        self->priv->_settings = _tmp22_;
 
454
        _tmp23_ = settings;
 
455
        _tmp25_ = _tmp24_ = g_settings_get_strv (_tmp23_, PREFERENCES_BLACKLIST);
 
456
        _tmp26_ = _tmp25_;
 
457
        _tmp26__length1 = _vala_array_length (_tmp24_);
 
458
        blacklist_preference_set_values (self, _tmp26_, _vala_array_length (_tmp24_));
 
459
        _tmp26_ = (_vala_array_free (_tmp26_, _tmp26__length1, (GDestroyNotify) g_free), NULL);
 
460
        _g_object_unref0 (cell);
 
461
        _g_object_unref0 (column);
 
462
        return self;
 
463
}
 
464
 
 
465
 
 
466
BlacklistPreference* blacklist_preference_new (GSettings* settings, GtkBuilder* builder) {
 
467
        return blacklist_preference_construct (TYPE_BLACKLIST_PREFERENCE, settings, builder);
 
468
}
 
469
 
 
470
 
 
471
/**
 
472
   * Connects the signal handlers and binds the properties. Using a separate
 
473
   * method so vala doesn't complain BlacklistPreferences is unused.
 
474
   */
 
475
static gchar* string_strip (const gchar* self) {
 
476
        gchar* result = NULL;
 
477
        gchar* _tmp0_ = NULL;
 
478
        gchar* _result_;
 
479
        const gchar* _tmp1_;
 
480
        g_return_val_if_fail (self != NULL, NULL);
 
481
        _tmp0_ = g_strdup (self);
 
482
        _result_ = _tmp0_;
 
483
        _tmp1_ = _result_;
 
484
        g_strstrip (_tmp1_);
 
485
        result = _result_;
 
486
        return result;
 
487
}
 
488
 
 
489
 
 
490
static void __lambda16_ (BlacklistPreference* self, GtkButton* button) {
 
491
        GtkButton* _tmp0_;
 
492
        GtkEntry* _tmp1_;
 
493
        const gchar* _tmp2_ = NULL;
 
494
        gchar* _tmp3_;
 
495
        gchar* text;
 
496
        GtkEntry* _tmp4_;
 
497
        const gchar* _tmp5_;
 
498
        gchar* _tmp6_ = NULL;
 
499
        const gchar* _tmp7_;
 
500
        gint _tmp8_;
 
501
        gint _tmp9_;
 
502
        GtkButton* _tmp15_;
 
503
        g_return_if_fail (button != NULL);
 
504
        _tmp0_ = button;
 
505
        gtk_widget_set_sensitive ((GtkWidget*) _tmp0_, FALSE);
 
506
        _tmp1_ = self->priv->_add_entry;
 
507
        _tmp2_ = gtk_entry_get_text (_tmp1_);
 
508
        _tmp3_ = g_strdup (_tmp2_);
 
509
        text = _tmp3_;
 
510
        _tmp4_ = self->priv->_add_entry;
 
511
        gtk_entry_set_text (_tmp4_, "");
 
512
        _tmp5_ = text;
 
513
        _tmp6_ = string_strip (_tmp5_);
 
514
        _g_free0 (text);
 
515
        text = _tmp6_;
 
516
        _tmp7_ = text;
 
517
        _tmp8_ = strlen (_tmp7_);
 
518
        _tmp9_ = _tmp8_;
 
519
        if (_tmp9_ > 0) {
 
520
                const gchar* _tmp10_;
 
521
                GSettings* _tmp11_;
 
522
                gint _tmp12_ = 0;
 
523
                gchar** _tmp13_ = NULL;
 
524
                gchar** _tmp14_;
 
525
                gint _tmp14__length1;
 
526
                _tmp10_ = text;
 
527
                blacklist_preference_append_item (self, _tmp10_);
 
528
                _tmp11_ = self->priv->_settings;
 
529
                _tmp13_ = blacklist_preference_get_values (self, &_tmp12_);
 
530
                _tmp14_ = _tmp13_;
 
531
                _tmp14__length1 = _tmp12_;
 
532
                g_settings_set_strv (_tmp11_, PREFERENCES_BLACKLIST, _tmp14_);
 
533
                _tmp14_ = (_vala_array_free (_tmp14_, _tmp14__length1, (GDestroyNotify) g_free), NULL);
 
534
        }
 
535
        _tmp15_ = button;
 
536
        gtk_widget_set_sensitive ((GtkWidget*) _tmp15_, TRUE);
 
537
        _g_free0 (text);
 
538
}
 
539
 
 
540
 
 
541
static void ___lambda16__gtk_button_clicked (GtkButton* _sender, gpointer self) {
 
542
        __lambda16_ (self, _sender);
 
543
}
 
544
 
 
545
 
 
546
static void __lambda17_ (BlacklistPreference* self, GtkButton* button) {
 
547
        GtkButton* _tmp0_;
 
548
        gboolean _tmp1_ = FALSE;
 
549
        GtkButton* _tmp6_;
 
550
        g_return_if_fail (button != NULL);
 
551
        _tmp0_ = button;
 
552
        gtk_widget_set_sensitive ((GtkWidget*) _tmp0_, FALSE);
 
553
        _tmp1_ = blacklist_preference_remove_item (self);
 
554
        if (_tmp1_) {
 
555
                GSettings* _tmp2_;
 
556
                gint _tmp3_ = 0;
 
557
                gchar** _tmp4_ = NULL;
 
558
                gchar** _tmp5_;
 
559
                gint _tmp5__length1;
 
560
                _tmp2_ = self->priv->_settings;
 
561
                _tmp4_ = blacklist_preference_get_values (self, &_tmp3_);
 
562
                _tmp5_ = _tmp4_;
 
563
                _tmp5__length1 = _tmp3_;
 
564
                g_settings_set_strv (_tmp2_, PREFERENCES_BLACKLIST, _tmp5_);
 
565
                _tmp5_ = (_vala_array_free (_tmp5_, _tmp5__length1, (GDestroyNotify) g_free), NULL);
 
566
        }
 
567
        _tmp6_ = button;
 
568
        gtk_widget_set_sensitive ((GtkWidget*) _tmp6_, TRUE);
 
569
}
 
570
 
 
571
 
 
572
static void ___lambda17__gtk_button_clicked (GtkButton* _sender, gpointer self) {
 
573
        __lambda17_ (self, _sender);
 
574
}
 
575
 
 
576
 
 
577
void blacklist_preference_connect_handlers (BlacklistPreference* self) {
 
578
        GtkButton* _tmp0_;
 
579
        GtkButton* _tmp1_;
 
580
        g_return_if_fail (self != NULL);
 
581
        _tmp0_ = self->priv->_add_button;
 
582
        g_signal_connect_object (_tmp0_, "clicked", (GCallback) ___lambda16__gtk_button_clicked, self, 0);
 
583
        _tmp1_ = self->priv->_remove_button;
 
584
        g_signal_connect_object (_tmp1_, "clicked", (GCallback) ___lambda17__gtk_button_clicked, self, 0);
 
585
}
 
586
 
 
587
 
 
588
/**
 
589
   * Appends an item to the blacklist.
 
590
   *
 
591
   * @param item the string to append
 
592
   */
 
593
static void blacklist_preference_append_item (BlacklistPreference* self, const gchar* item) {
 
594
        GError * _inner_error_ = NULL;
 
595
        g_return_if_fail (self != NULL);
 
596
        g_return_if_fail (item != NULL);
 
597
        {
 
598
                GtkListStore* _tmp0_;
 
599
                _tmp0_ = self->priv->_liststore;
 
600
                g_static_rec_mutex_lock (&self->priv->__lock__liststore);
 
601
                {
 
602
                        GtkListStore* _tmp1_;
 
603
                        gint _tmp2_ = 0;
 
604
                        gint i;
 
605
                        GtkListStore* _tmp3_;
 
606
                        const gchar* _tmp4_;
 
607
                        _tmp1_ = self->priv->_liststore;
 
608
                        _tmp2_ = gtk_tree_model_iter_n_children ((GtkTreeModel*) _tmp1_, NULL);
 
609
                        i = _tmp2_;
 
610
                        _tmp3_ = self->priv->_liststore;
 
611
                        _tmp4_ = item;
 
612
                        gtk_list_store_insert_with_values (_tmp3_, NULL, i, BLACKLIST_PREFERENCE_COLUMN_APP_NAME, _tmp4_, -1);
 
613
                }
 
614
                __finally10:
 
615
                {
 
616
                        GtkListStore* _tmp5_;
 
617
                        _tmp5_ = self->priv->_liststore;
 
618
                        g_static_rec_mutex_unlock (&self->priv->__lock__liststore);
 
619
                }
 
620
                if (_inner_error_ != NULL) {
 
621
                        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);
 
622
                        g_clear_error (&_inner_error_);
 
623
                        return;
 
624
                }
 
625
        }
 
626
}
 
627
 
 
628
 
 
629
/**
 
630
   * Removes the selected item from the blacklist.
 
631
   *
 
632
   * @return true if an item was removed
 
633
   */
 
634
static gboolean blacklist_preference_remove_item (BlacklistPreference* self) {
 
635
        gboolean result = FALSE;
 
636
        GError * _inner_error_ = NULL;
 
637
        g_return_val_if_fail (self != NULL, FALSE);
 
638
        {
 
639
                GtkListStore* _tmp0_;
 
640
                _tmp0_ = self->priv->_liststore;
 
641
                g_static_rec_mutex_lock (&self->priv->__lock__liststore);
 
642
                {
 
643
                        GtkTreeView* _tmp1_;
 
644
                        GtkTreeSelection* _tmp2_ = NULL;
 
645
                        GtkTreeSelection* _tmp3_;
 
646
                        GtkTreeSelection* selection;
 
647
                        GtkTreeIter iter = {0};
 
648
                        GtkTreeSelection* _tmp4_;
 
649
                        GtkTreeIter _tmp5_ = {0};
 
650
                        gboolean _tmp6_ = FALSE;
 
651
                        _tmp1_ = self->priv->_treeview;
 
652
                        _tmp2_ = gtk_tree_view_get_selection (_tmp1_);
 
653
                        _tmp3_ = _g_object_ref0 (_tmp2_);
 
654
                        selection = _tmp3_;
 
655
                        _tmp4_ = selection;
 
656
                        _tmp6_ = gtk_tree_selection_get_selected (_tmp4_, NULL, &_tmp5_);
 
657
                        iter = _tmp5_;
 
658
                        if (_tmp6_) {
 
659
                                GtkListStore* _tmp7_;
 
660
                                GtkTreeIter _tmp8_;
 
661
                                _tmp7_ = self->priv->_liststore;
 
662
                                _tmp8_ = iter;
 
663
                                gtk_list_store_remove (_tmp7_, &_tmp8_);
 
664
                                result = TRUE;
 
665
                                _g_object_unref0 (selection);
 
666
                                {
 
667
                                        GtkListStore* _tmp9_;
 
668
                                        _tmp9_ = self->priv->_liststore;
 
669
                                        g_static_rec_mutex_unlock (&self->priv->__lock__liststore);
 
670
                                }
 
671
                                return result;
 
672
                        } else {
 
673
                                result = FALSE;
 
674
                                _g_object_unref0 (selection);
 
675
                                {
 
676
                                        GtkListStore* _tmp10_;
 
677
                                        _tmp10_ = self->priv->_liststore;
 
678
                                        g_static_rec_mutex_unlock (&self->priv->__lock__liststore);
 
679
                                }
 
680
                                return result;
 
681
                        }
 
682
                        _g_object_unref0 (selection);
 
683
                }
 
684
                __finally11:
 
685
                {
 
686
                        GtkListStore* _tmp11_;
 
687
                        _tmp11_ = self->priv->_liststore;
 
688
                        g_static_rec_mutex_unlock (&self->priv->__lock__liststore);
 
689
                }
 
690
                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);
 
691
                g_clear_error (&_inner_error_);
 
692
                return FALSE;
 
693
        }
 
694
}
 
695
 
 
696
 
 
697
/**
 
698
   * Updates a Gtk.ListStore of a single string column with the values from an
 
699
   * array of strings.
 
700
   *
 
701
   * @param values the values to insert
 
702
   */
 
703
static void blacklist_preference_set_values (BlacklistPreference* self, gchar** values, int values_length1) {
 
704
        GError * _inner_error_ = NULL;
 
705
        g_return_if_fail (self != NULL);
 
706
        {
 
707
                GtkListStore* _tmp0_;
 
708
                _tmp0_ = self->priv->_liststore;
 
709
                g_static_rec_mutex_lock (&self->priv->__lock__liststore);
 
710
                {
 
711
                        GtkListStore* _tmp1_;
 
712
                        _tmp1_ = self->priv->_liststore;
 
713
                        gtk_list_store_clear (_tmp1_);
 
714
                        {
 
715
                                gint i;
 
716
                                i = 0;
 
717
                                {
 
718
                                        gboolean _tmp2_;
 
719
                                        _tmp2_ = TRUE;
 
720
                                        while (TRUE) {
 
721
                                                gboolean _tmp3_;
 
722
                                                gint _tmp5_;
 
723
                                                gchar** _tmp6_;
 
724
                                                gint _tmp6__length1;
 
725
                                                GtkListStore* _tmp7_;
 
726
                                                gint _tmp8_;
 
727
                                                gchar** _tmp9_;
 
728
                                                gint _tmp9__length1;
 
729
                                                gint _tmp10_;
 
730
                                                const gchar* _tmp11_;
 
731
                                                _tmp3_ = _tmp2_;
 
732
                                                if (!_tmp3_) {
 
733
                                                        gint _tmp4_;
 
734
                                                        _tmp4_ = i;
 
735
                                                        i = _tmp4_ + 1;
 
736
                                                }
 
737
                                                _tmp2_ = FALSE;
 
738
                                                _tmp5_ = i;
 
739
                                                _tmp6_ = values;
 
740
                                                _tmp6__length1 = values_length1;
 
741
                                                if (!(_tmp5_ < _tmp6__length1)) {
 
742
                                                        break;
 
743
                                                }
 
744
                                                _tmp7_ = self->priv->_liststore;
 
745
                                                _tmp8_ = i;
 
746
                                                _tmp9_ = values;
 
747
                                                _tmp9__length1 = values_length1;
 
748
                                                _tmp10_ = i;
 
749
                                                _tmp11_ = _tmp9_[_tmp10_];
 
750
                                                gtk_list_store_insert_with_values (_tmp7_, NULL, _tmp8_, BLACKLIST_PREFERENCE_COLUMN_APP_NAME, _tmp11_, -1);
 
751
                                        }
 
752
                                }
 
753
                        }
 
754
                }
 
755
                __finally12:
 
756
                {
 
757
                        GtkListStore* _tmp12_;
 
758
                        _tmp12_ = self->priv->_liststore;
 
759
                        g_static_rec_mutex_unlock (&self->priv->__lock__liststore);
 
760
                }
 
761
                if (_inner_error_ != NULL) {
 
762
                        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);
 
763
                        g_clear_error (&_inner_error_);
 
764
                        return;
 
765
                }
 
766
        }
 
767
}
 
768
 
 
769
 
 
770
/**
 
771
   * Converts the values of a Gtk.ListStore of a single string column to an
 
772
   * array of strings.
 
773
   * 
 
774
   * @return a new array of strings
 
775
   */
 
776
static gchar** blacklist_preference_get_values (BlacklistPreference* self, int* result_length1) {
 
777
        gchar** result = NULL;
 
778
        GError * _inner_error_ = NULL;
 
779
        g_return_val_if_fail (self != NULL, NULL);
 
780
        {
 
781
                GtkListStore* _tmp0_;
 
782
                _tmp0_ = self->priv->_liststore;
 
783
                g_static_rec_mutex_lock (&self->priv->__lock__liststore);
 
784
                {
 
785
                        GtkListStore* _tmp1_;
 
786
                        gint _tmp2_ = 0;
 
787
                        gint rows;
 
788
                        gint _tmp3_;
 
789
                        gchar** _tmp4_ = NULL;
 
790
                        gchar** values;
 
791
                        gint values_length1;
 
792
                        gint _values_size_;
 
793
                        GtkTreeIter iter = {0};
 
794
                        GtkListStore* _tmp5_;
 
795
                        GtkTreeIter _tmp6_ = {0};
 
796
                        gboolean _tmp7_ = FALSE;
 
797
                        gchar** _tmp19_;
 
798
                        gint _tmp19__length1;
 
799
                        _tmp1_ = self->priv->_liststore;
 
800
                        _tmp2_ = gtk_tree_model_iter_n_children ((GtkTreeModel*) _tmp1_, NULL);
 
801
                        rows = _tmp2_;
 
802
                        _tmp3_ = rows;
 
803
                        _tmp4_ = g_new0 (gchar*, _tmp3_ + 1);
 
804
                        values = _tmp4_;
 
805
                        values_length1 = _tmp3_;
 
806
                        _values_size_ = values_length1;
 
807
                        _tmp5_ = self->priv->_liststore;
 
808
                        _tmp7_ = gtk_tree_model_get_iter_first ((GtkTreeModel*) _tmp5_, &_tmp6_);
 
809
                        iter = _tmp6_;
 
810
                        if (_tmp7_) {
 
811
                                gint i;
 
812
                                i = 0;
 
813
                                {
 
814
                                        gboolean _tmp8_;
 
815
                                        _tmp8_ = TRUE;
 
816
                                        while (TRUE) {
 
817
                                                gboolean _tmp9_;
 
818
                                                gchar* column_value = NULL;
 
819
                                                GtkListStore* _tmp12_;
 
820
                                                GtkTreeIter _tmp13_;
 
821
                                                gchar** _tmp14_;
 
822
                                                gint _tmp14__length1;
 
823
                                                gint _tmp15_;
 
824
                                                const gchar* _tmp16_;
 
825
                                                gchar* _tmp17_;
 
826
                                                gchar* _tmp18_;
 
827
                                                _tmp9_ = _tmp8_;
 
828
                                                if (!_tmp9_) {
 
829
                                                        GtkListStore* _tmp10_;
 
830
                                                        gboolean _tmp11_ = FALSE;
 
831
                                                        _tmp10_ = self->priv->_liststore;
 
832
                                                        _tmp11_ = gtk_tree_model_iter_next ((GtkTreeModel*) _tmp10_, &iter);
 
833
                                                        if (!_tmp11_) {
 
834
                                                                break;
 
835
                                                        }
 
836
                                                }
 
837
                                                _tmp8_ = FALSE;
 
838
                                                _tmp12_ = self->priv->_liststore;
 
839
                                                _tmp13_ = iter;
 
840
                                                gtk_tree_model_get ((GtkTreeModel*) _tmp12_, &_tmp13_, BLACKLIST_PREFERENCE_COLUMN_APP_NAME, &column_value, -1);
 
841
                                                _tmp14_ = values;
 
842
                                                _tmp14__length1 = values_length1;
 
843
                                                _tmp15_ = i;
 
844
                                                i = _tmp15_ + 1;
 
845
                                                _tmp16_ = column_value;
 
846
                                                _tmp17_ = g_strdup (_tmp16_);
 
847
                                                _g_free0 (_tmp14_[_tmp15_]);
 
848
                                                _tmp14_[_tmp15_] = _tmp17_;
 
849
                                                _tmp18_ = _tmp14_[_tmp15_];
 
850
                                                _g_free0 (column_value);
 
851
                                        }
 
852
                                }
 
853
                        }
 
854
                        _tmp19_ = values;
 
855
                        _tmp19__length1 = values_length1;
 
856
                        if (result_length1) {
 
857
                                *result_length1 = _tmp19__length1;
 
858
                        }
 
859
                        result = _tmp19_;
 
860
                        {
 
861
                                GtkListStore* _tmp20_;
 
862
                                _tmp20_ = self->priv->_liststore;
 
863
                                g_static_rec_mutex_unlock (&self->priv->__lock__liststore);
 
864
                        }
 
865
                        return result;
 
866
                }
 
867
                __finally13:
 
868
                {
 
869
                        GtkListStore* _tmp21_;
 
870
                        _tmp21_ = self->priv->_liststore;
 
871
                        g_static_rec_mutex_unlock (&self->priv->__lock__liststore);
 
872
                }
 
873
                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);
 
874
                g_clear_error (&_inner_error_);
 
875
                return NULL;
 
876
        }
 
877
}
 
878
 
 
879
 
 
880
static void blacklist_preference_class_init (BlacklistPreferenceClass * klass) {
 
881
        blacklist_preference_parent_class = g_type_class_peek_parent (klass);
 
882
        g_type_class_add_private (klass, sizeof (BlacklistPreferencePrivate));
 
883
        G_OBJECT_CLASS (klass)->finalize = blacklist_preference_finalize;
 
884
}
 
885
 
 
886
 
 
887
static void blacklist_preference_instance_init (BlacklistPreference * self) {
 
888
        self->priv = BLACKLIST_PREFERENCE_GET_PRIVATE (self);
 
889
        g_static_rec_mutex_init (&self->priv->__lock__liststore);
 
890
}
 
891
 
 
892
 
 
893
static void blacklist_preference_finalize (GObject* obj) {
 
894
        BlacklistPreference * self;
 
895
        self = BLACKLIST_PREFERENCE (obj);
 
896
        _g_object_unref0 (self->priv->_treeview);
 
897
        g_static_rec_mutex_free (&self->priv->__lock__liststore);
 
898
        _g_object_unref0 (self->priv->_liststore);
 
899
        _g_object_unref0 (self->priv->_add_button);
 
900
        _g_object_unref0 (self->priv->_remove_button);
 
901
        _g_object_unref0 (self->priv->_add_entry);
 
902
        _g_object_unref0 (self->priv->_settings);
 
903
        G_OBJECT_CLASS (blacklist_preference_parent_class)->finalize (obj);
 
904
}
 
905
 
 
906
 
 
907
/**
 
908
 * Maintain synchronization between the Gtk.ListStore and the GLib.Settings key
 
909
 * for the blacklist.
 
910
 */
 
911
GType blacklist_preference_get_type (void) {
 
912
        static volatile gsize blacklist_preference_type_id__volatile = 0;
 
913
        if (g_once_init_enter (&blacklist_preference_type_id__volatile)) {
 
914
                static const GTypeInfo g_define_type_info = { sizeof (BlacklistPreferenceClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) blacklist_preference_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BlacklistPreference), 0, (GInstanceInitFunc) blacklist_preference_instance_init, NULL };
 
915
                GType blacklist_preference_type_id;
 
916
                blacklist_preference_type_id = g_type_register_static (G_TYPE_OBJECT, "BlacklistPreference", &g_define_type_info, 0);
 
917
                g_once_init_leave (&blacklist_preference_type_id__volatile, blacklist_preference_type_id);
 
918
        }
 
919
        return blacklist_preference_type_id__volatile;
 
920
}
 
921
 
 
922
 
 
923
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
 
924
        if ((array != NULL) && (destroy_func != NULL)) {
 
925
                int i;
 
926
                for (i = 0; i < array_length; i = i + 1) {
 
927
                        if (((gpointer*) array)[i] != NULL) {
 
928
                                destroy_func (((gpointer*) array)[i]);
 
929
                        }
 
930
                }
 
931
        }
 
932
}
 
933
 
 
934
 
 
935
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
 
936
        _vala_array_destroy (array, array_length, destroy_func);
 
937
        g_free (array);
 
938
}
 
939
 
 
940
 
 
941
static gint _vala_array_length (gpointer array) {
 
942
        int length;
 
943
        length = 0;
 
944
        if (array) {
 
945
                while (((gpointer*) array)[length]) {
 
946
                        length++;
 
947
                }
 
948
        }
 
949
        return length;
 
950
}
 
951
 
 
952
 
 
953