~ubuntu-branches/ubuntu/quantal/zeitgeist/quantal

« back to all changes in this revision

Viewing changes to src/extension-collection.c

  • Committer: Package Import Robot
  • Author(s): Didier Roche
  • Date: 2011-11-15 11:15:56 UTC
  • mto: (6.2.2 experimental) (1.3.1)
  • mto: This revision was merged to the branch mainline in revision 19.
  • Revision ID: package-import@ubuntu.com-20111115111556-so7cmhfbqongw7hf
Tags: upstream-0.8.99~alpha1
Import upstream version 0.8.99~alpha1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* extension-collection.c generated by valac 0.14.0, the Vala compiler
 
2
 * generated from extension-collection.vala, do not modify */
 
3
 
 
4
/* extension-collection.vala
 
5
 *
 
6
 * Copyright © 2011 Michal Hruby <michal.mhr@gmail.com>
 
7
 *
 
8
 * This program is free software: you can redistribute it and/or modify
 
9
 * it under the terms of the GNU Lesser General Public License as published by
 
10
 * the Free Software Foundation, either version 2.1 of the License, or
 
11
 * (at your option) any later version.
 
12
 *
 
13
 * This program is distributed in the hope that it will be useful,
 
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
 * GNU General Public License for more details.
 
17
 *
 
18
 * You should have received a copy of the GNU Lesser General Public License
 
19
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
20
 *
 
21
 */
 
22
 
 
23
#include <glib.h>
 
24
#include <glib-object.h>
 
25
#include <stdlib.h>
 
26
#include <string.h>
 
27
#include <glib/gstdio.h>
 
28
 
 
29
 
 
30
#define ZEITGEIST_TYPE_EXTENSION_COLLECTION (zeitgeist_extension_collection_get_type ())
 
31
#define ZEITGEIST_EXTENSION_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ZEITGEIST_TYPE_EXTENSION_COLLECTION, ZeitgeistExtensionCollection))
 
32
#define ZEITGEIST_EXTENSION_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ZEITGEIST_TYPE_EXTENSION_COLLECTION, ZeitgeistExtensionCollectionClass))
 
33
#define ZEITGEIST_IS_EXTENSION_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ZEITGEIST_TYPE_EXTENSION_COLLECTION))
 
34
#define ZEITGEIST_IS_EXTENSION_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ZEITGEIST_TYPE_EXTENSION_COLLECTION))
 
35
#define ZEITGEIST_EXTENSION_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ZEITGEIST_TYPE_EXTENSION_COLLECTION, ZeitgeistExtensionCollectionClass))
 
36
 
 
37
typedef struct _ZeitgeistExtensionCollection ZeitgeistExtensionCollection;
 
38
typedef struct _ZeitgeistExtensionCollectionClass ZeitgeistExtensionCollectionClass;
 
39
typedef struct _ZeitgeistExtensionCollectionPrivate ZeitgeistExtensionCollectionPrivate;
 
40
 
 
41
#define ZEITGEIST_TYPE_EXTENSION (zeitgeist_extension_get_type ())
 
42
#define ZEITGEIST_EXTENSION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ZEITGEIST_TYPE_EXTENSION, ZeitgeistExtension))
 
43
#define ZEITGEIST_EXTENSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ZEITGEIST_TYPE_EXTENSION, ZeitgeistExtensionClass))
 
44
#define ZEITGEIST_IS_EXTENSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ZEITGEIST_TYPE_EXTENSION))
 
45
#define ZEITGEIST_IS_EXTENSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ZEITGEIST_TYPE_EXTENSION))
 
46
#define ZEITGEIST_EXTENSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ZEITGEIST_TYPE_EXTENSION, ZeitgeistExtensionClass))
 
47
 
 
48
typedef struct _ZeitgeistExtension ZeitgeistExtension;
 
49
typedef struct _ZeitgeistExtensionClass ZeitgeistExtensionClass;
 
50
 
 
51
#define ZEITGEIST_TYPE_ENGINE (zeitgeist_engine_get_type ())
 
52
#define ZEITGEIST_ENGINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ZEITGEIST_TYPE_ENGINE, ZeitgeistEngine))
 
53
#define ZEITGEIST_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ZEITGEIST_TYPE_ENGINE, ZeitgeistEngineClass))
 
54
#define ZEITGEIST_IS_ENGINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ZEITGEIST_TYPE_ENGINE))
 
55
#define ZEITGEIST_IS_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ZEITGEIST_TYPE_ENGINE))
 
56
#define ZEITGEIST_ENGINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ZEITGEIST_TYPE_ENGINE, ZeitgeistEngineClass))
 
57
 
 
58
typedef struct _ZeitgeistEngine ZeitgeistEngine;
 
59
typedef struct _ZeitgeistEngineClass ZeitgeistEngineClass;
 
60
#define _g_ptr_array_unref0(var) ((var == NULL) ? NULL : (var = (g_ptr_array_unref (var), NULL)))
 
61
 
 
62
#define ZEITGEIST_TYPE_EVENT (zeitgeist_event_get_type ())
 
63
#define ZEITGEIST_EVENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ZEITGEIST_TYPE_EVENT, ZeitgeistEvent))
 
64
#define ZEITGEIST_EVENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ZEITGEIST_TYPE_EVENT, ZeitgeistEventClass))
 
65
#define ZEITGEIST_IS_EVENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ZEITGEIST_TYPE_EVENT))
 
66
#define ZEITGEIST_IS_EVENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ZEITGEIST_TYPE_EVENT))
 
67
#define ZEITGEIST_EVENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ZEITGEIST_TYPE_EVENT, ZeitgeistEventClass))
 
68
 
 
69
typedef struct _ZeitgeistEvent ZeitgeistEvent;
 
70
typedef struct _ZeitgeistEventClass ZeitgeistEventClass;
 
71
 
 
72
#define ZEITGEIST_TYPE_EXTENSION_LOADER (zeitgeist_extension_loader_get_type ())
 
73
#define ZEITGEIST_EXTENSION_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ZEITGEIST_TYPE_EXTENSION_LOADER, ZeitgeistExtensionLoader))
 
74
#define ZEITGEIST_EXTENSION_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ZEITGEIST_TYPE_EXTENSION_LOADER, ZeitgeistExtensionLoaderClass))
 
75
#define ZEITGEIST_IS_EXTENSION_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ZEITGEIST_TYPE_EXTENSION_LOADER))
 
76
#define ZEITGEIST_IS_EXTENSION_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ZEITGEIST_TYPE_EXTENSION_LOADER))
 
77
#define ZEITGEIST_EXTENSION_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ZEITGEIST_TYPE_EXTENSION_LOADER, ZeitgeistExtensionLoaderClass))
 
78
 
 
79
typedef struct _ZeitgeistExtensionLoader ZeitgeistExtensionLoader;
 
80
typedef struct _ZeitgeistExtensionLoaderClass ZeitgeistExtensionLoaderClass;
 
81
 
 
82
#define ZEITGEIST_TYPE_BUILTIN_EXTENSION (zeitgeist_builtin_extension_get_type ())
 
83
#define ZEITGEIST_BUILTIN_EXTENSION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ZEITGEIST_TYPE_BUILTIN_EXTENSION, ZeitgeistBuiltinExtension))
 
84
#define ZEITGEIST_BUILTIN_EXTENSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ZEITGEIST_TYPE_BUILTIN_EXTENSION, ZeitgeistBuiltinExtensionClass))
 
85
#define ZEITGEIST_IS_BUILTIN_EXTENSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ZEITGEIST_TYPE_BUILTIN_EXTENSION))
 
86
#define ZEITGEIST_IS_BUILTIN_EXTENSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ZEITGEIST_TYPE_BUILTIN_EXTENSION))
 
87
#define ZEITGEIST_BUILTIN_EXTENSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ZEITGEIST_TYPE_BUILTIN_EXTENSION, ZeitgeistBuiltinExtensionClass))
 
88
 
 
89
typedef struct _ZeitgeistBuiltinExtension ZeitgeistBuiltinExtension;
 
90
typedef struct _ZeitgeistBuiltinExtensionClass ZeitgeistBuiltinExtensionClass;
 
91
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
 
92
#define _g_dir_close0(var) ((var == NULL) ? NULL : (var = (g_dir_close (var), NULL)))
 
93
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
 
94
 
 
95
#define ZEITGEIST_TYPE_MODULE_LOADER (zeitgeist_module_loader_get_type ())
 
96
#define ZEITGEIST_MODULE_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ZEITGEIST_TYPE_MODULE_LOADER, ZeitgeistModuleLoader))
 
97
#define ZEITGEIST_MODULE_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ZEITGEIST_TYPE_MODULE_LOADER, ZeitgeistModuleLoaderClass))
 
98
#define ZEITGEIST_IS_MODULE_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ZEITGEIST_TYPE_MODULE_LOADER))
 
99
#define ZEITGEIST_IS_MODULE_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ZEITGEIST_TYPE_MODULE_LOADER))
 
100
#define ZEITGEIST_MODULE_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ZEITGEIST_TYPE_MODULE_LOADER, ZeitgeistModuleLoaderClass))
 
101
 
 
102
typedef struct _ZeitgeistModuleLoader ZeitgeistModuleLoader;
 
103
typedef struct _ZeitgeistModuleLoaderClass ZeitgeistModuleLoaderClass;
 
104
#define _g_free0(var) (var = (g_free (var), NULL))
 
105
 
 
106
struct _ZeitgeistExtensionCollection {
 
107
        GObject parent_instance;
 
108
        ZeitgeistExtensionCollectionPrivate * priv;
 
109
};
 
110
 
 
111
struct _ZeitgeistExtensionCollectionClass {
 
112
        GObjectClass parent_class;
 
113
};
 
114
 
 
115
struct _ZeitgeistExtensionCollectionPrivate {
 
116
        GPtrArray* extensions;
 
117
        ZeitgeistEngine* _engine;
 
118
};
 
119
 
 
120
typedef GType (*ZeitgeistRegisterExtensionFunc) (GTypeModule* module);
 
121
 
 
122
static gpointer zeitgeist_extension_collection_parent_class = NULL;
 
123
 
 
124
GType zeitgeist_extension_collection_get_type (void) G_GNUC_CONST;
 
125
GType zeitgeist_extension_get_type (void) G_GNUC_CONST;
 
126
GType zeitgeist_engine_get_type (void) G_GNUC_CONST;
 
127
#define ZEITGEIST_EXTENSION_COLLECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ZEITGEIST_TYPE_EXTENSION_COLLECTION, ZeitgeistExtensionCollectionPrivate))
 
128
enum  {
 
129
        ZEITGEIST_EXTENSION_COLLECTION_DUMMY_PROPERTY,
 
130
        ZEITGEIST_EXTENSION_COLLECTION_ENGINE
 
131
};
 
132
static void _zeitgeist_extension_collection___lambda3_ (ZeitgeistExtensionCollection* self, ZeitgeistExtension* ext);
 
133
void zeitgeist_extension_unload (ZeitgeistExtension* self);
 
134
static void __zeitgeist_extension_collection___lambda3__gfunc (gconstpointer data, gpointer self);
 
135
ZeitgeistExtensionCollection* zeitgeist_extension_collection_new (ZeitgeistEngine* engine);
 
136
ZeitgeistExtensionCollection* zeitgeist_extension_collection_construct (GType object_type, ZeitgeistEngine* engine);
 
137
gchar** zeitgeist_extension_collection_get_extension_names (ZeitgeistExtensionCollection* self, int* result_length1);
 
138
static void _vala_array_add2 (gchar*** array, int* length, int* size, gchar* value);
 
139
static void _vala_array_add3 (gchar*** array, int* length, int* size, gchar* value);
 
140
GType zeitgeist_event_get_type (void) G_GNUC_CONST;
 
141
void zeitgeist_extension_collection_call_pre_insert_events (ZeitgeistExtensionCollection* self, GPtrArray* events, const char* sender);
 
142
void zeitgeist_extension_pre_insert_events (ZeitgeistExtension* self, GPtrArray* events, const char* sender);
 
143
void zeitgeist_extension_collection_call_post_insert_events (ZeitgeistExtensionCollection* self, GPtrArray* events, const char* sender);
 
144
void zeitgeist_extension_post_insert_events (ZeitgeistExtension* self, GPtrArray* events, const char* sender);
 
145
guint32* zeitgeist_extension_collection_call_pre_delete_events (ZeitgeistExtensionCollection* self, guint32* event_ids, int event_ids_length1, const char* sender, int* result_length1);
 
146
guint32* zeitgeist_extension_pre_delete_events (ZeitgeistExtension* self, guint32* ids, int ids_length1, const char* sender, int* result_length1);
 
147
void zeitgeist_extension_collection_call_post_delete_events (ZeitgeistExtensionCollection* self, guint32* event_ids, int event_ids_length1, const char* sender);
 
148
void zeitgeist_extension_post_delete_events (ZeitgeistExtension* self, guint32* ids, int ids_length1, const char* sender);
 
149
ZeitgeistEngine* zeitgeist_extension_collection_get_engine (ZeitgeistExtensionCollection* self);
 
150
static void zeitgeist_extension_collection_set_engine (ZeitgeistExtensionCollection* self, ZeitgeistEngine* value);
 
151
static GObject * zeitgeist_extension_collection_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
 
152
static void _g_object_unref0_ (gpointer var);
 
153
GType zeitgeist_data_source_registry_init (GTypeModule* mod);
 
154
static GType _zeitgeist_data_source_registry_init_zeitgeist_register_extension_func (GTypeModule* module);
 
155
GType zeitgeist_blacklist_init (GTypeModule* mod);
 
156
static GType _zeitgeist_blacklist_init_zeitgeist_register_extension_func (GTypeModule* module);
 
157
GType zeitgeist_histogram_init (GTypeModule* mod);
 
158
static GType _zeitgeist_histogram_init_zeitgeist_register_extension_func (GTypeModule* module);
 
159
GType zeitgeist_storage_monitor_init (GTypeModule* mod);
 
160
static GType _zeitgeist_storage_monitor_init_zeitgeist_register_extension_func (GTypeModule* module);
 
161
GType zeitgeist_fts_init (GTypeModule* mod);
 
162
static GType _zeitgeist_fts_init_zeitgeist_register_extension_func (GTypeModule* module);
 
163
ZeitgeistBuiltinExtension* zeitgeist_builtin_extension_new (ZeitgeistRegisterExtensionFunc func);
 
164
ZeitgeistBuiltinExtension* zeitgeist_builtin_extension_construct (GType object_type, ZeitgeistRegisterExtensionFunc func);
 
165
GType zeitgeist_extension_loader_get_type (void) G_GNUC_CONST;
 
166
GType zeitgeist_builtin_extension_get_type (void) G_GNUC_CONST;
 
167
ZeitgeistExtension* zeitgeist_extension_loader_create_instance (ZeitgeistExtensionLoader* self, ZeitgeistEngine* engine);
 
168
const gchar* zeitgeist_utils_get_local_extensions_path (void);
 
169
ZeitgeistModuleLoader* zeitgeist_module_loader_new (const gchar* module_path);
 
170
ZeitgeistModuleLoader* zeitgeist_module_loader_construct (GType object_type, const gchar* module_path);
 
171
GType zeitgeist_module_loader_get_type (void) G_GNUC_CONST;
 
172
static void zeitgeist_extension_collection_finalize (GObject* obj);
 
173
static void _vala_zeitgeist_extension_collection_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
 
174
static void _vala_zeitgeist_extension_collection_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
 
175
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
 
176
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
 
177
 
 
178
 
 
179
static void _zeitgeist_extension_collection___lambda3_ (ZeitgeistExtensionCollection* self, ZeitgeistExtension* ext) {
 
180
        ZeitgeistExtension* _tmp0_;
 
181
        g_return_if_fail (ext != NULL);
 
182
        _tmp0_ = ext;
 
183
        zeitgeist_extension_unload (_tmp0_);
 
184
}
 
185
 
 
186
 
 
187
static void __zeitgeist_extension_collection___lambda3__gfunc (gconstpointer data, gpointer self) {
 
188
        _zeitgeist_extension_collection___lambda3_ (self, data);
 
189
}
 
190
 
 
191
 
 
192
ZeitgeistExtensionCollection* zeitgeist_extension_collection_construct (GType object_type, ZeitgeistEngine* engine) {
 
193
        ZeitgeistExtensionCollection * self = NULL;
 
194
        ZeitgeistEngine* _tmp0_;
 
195
        g_return_val_if_fail (engine != NULL, NULL);
 
196
        _tmp0_ = engine;
 
197
        self = (ZeitgeistExtensionCollection*) g_object_new (object_type, "engine", _tmp0_, NULL);
 
198
        return self;
 
199
}
 
200
 
 
201
 
 
202
ZeitgeistExtensionCollection* zeitgeist_extension_collection_new (ZeitgeistEngine* engine) {
 
203
        return zeitgeist_extension_collection_construct (ZEITGEIST_TYPE_EXTENSION_COLLECTION, engine);
 
204
}
 
205
 
 
206
 
 
207
static gint g_ptr_array_get_length (GPtrArray* self) {
 
208
        gint result;
 
209
        guint _tmp0_;
 
210
        g_return_val_if_fail (self != NULL, 0);
 
211
        _tmp0_ = self->len;
 
212
        result = (gint) _tmp0_;
 
213
        return result;
 
214
}
 
215
 
 
216
 
 
217
static void g_ptr_array_set_length (GPtrArray* self, gint value) {
 
218
        gint _tmp0_;
 
219
        g_return_if_fail (self != NULL);
 
220
        _tmp0_ = value;
 
221
        g_ptr_array_set_size (self, _tmp0_);
 
222
}
 
223
 
 
224
 
 
225
static glong string_strnlen (gchar* str, glong maxlen) {
 
226
        glong result = 0L;
 
227
        gchar* _tmp0_;
 
228
        glong _tmp1_;
 
229
        gchar* _tmp2_ = NULL;
 
230
        gchar* end;
 
231
        gchar* _tmp3_;
 
232
        _tmp0_ = str;
 
233
        _tmp1_ = maxlen;
 
234
        _tmp2_ = memchr (_tmp0_, 0, (gsize) _tmp1_);
 
235
        end = _tmp2_;
 
236
        _tmp3_ = end;
 
237
        if (_tmp3_ == NULL) {
 
238
                glong _tmp4_;
 
239
                _tmp4_ = maxlen;
 
240
                result = _tmp4_;
 
241
                return result;
 
242
        } else {
 
243
                gchar* _tmp5_;
 
244
                gchar* _tmp6_;
 
245
                _tmp5_ = end;
 
246
                _tmp6_ = str;
 
247
                result = (glong) (_tmp5_ - _tmp6_);
 
248
                return result;
 
249
        }
 
250
}
 
251
 
 
252
 
 
253
static gchar* string_substring (const gchar* self, glong offset, glong len) {
 
254
        gchar* result = NULL;
 
255
        glong string_length = 0L;
 
256
        gboolean _tmp0_ = FALSE;
 
257
        glong _tmp1_;
 
258
        gboolean _tmp3_;
 
259
        glong _tmp9_;
 
260
        glong _tmp15_;
 
261
        glong _tmp18_;
 
262
        glong _tmp19_;
 
263
        glong _tmp20_;
 
264
        glong _tmp21_;
 
265
        glong _tmp22_;
 
266
        gchar* _tmp23_ = NULL;
 
267
        g_return_val_if_fail (self != NULL, NULL);
 
268
        _tmp1_ = offset;
 
269
        if (_tmp1_ >= ((glong) 0)) {
 
270
                glong _tmp2_;
 
271
                _tmp2_ = len;
 
272
                _tmp0_ = _tmp2_ >= ((glong) 0);
 
273
        } else {
 
274
                _tmp0_ = FALSE;
 
275
        }
 
276
        _tmp3_ = _tmp0_;
 
277
        if (_tmp3_) {
 
278
                glong _tmp4_;
 
279
                glong _tmp5_;
 
280
                glong _tmp6_ = 0L;
 
281
                _tmp4_ = offset;
 
282
                _tmp5_ = len;
 
283
                _tmp6_ = string_strnlen ((gchar*) self, _tmp4_ + _tmp5_);
 
284
                string_length = _tmp6_;
 
285
        } else {
 
286
                gint _tmp7_;
 
287
                gint _tmp8_;
 
288
                _tmp7_ = strlen (self);
 
289
                _tmp8_ = _tmp7_;
 
290
                string_length = (glong) _tmp8_;
 
291
        }
 
292
        _tmp9_ = offset;
 
293
        if (_tmp9_ < ((glong) 0)) {
 
294
                glong _tmp10_;
 
295
                glong _tmp11_;
 
296
                glong _tmp12_;
 
297
                _tmp10_ = string_length;
 
298
                _tmp11_ = offset;
 
299
                offset = _tmp10_ + _tmp11_;
 
300
                _tmp12_ = offset;
 
301
                g_return_val_if_fail (_tmp12_ >= ((glong) 0), NULL);
 
302
        } else {
 
303
                glong _tmp13_;
 
304
                glong _tmp14_;
 
305
                _tmp13_ = offset;
 
306
                _tmp14_ = string_length;
 
307
                g_return_val_if_fail (_tmp13_ <= _tmp14_, NULL);
 
308
        }
 
309
        _tmp15_ = len;
 
310
        if (_tmp15_ < ((glong) 0)) {
 
311
                glong _tmp16_;
 
312
                glong _tmp17_;
 
313
                _tmp16_ = string_length;
 
314
                _tmp17_ = offset;
 
315
                len = _tmp16_ - _tmp17_;
 
316
        }
 
317
        _tmp18_ = offset;
 
318
        _tmp19_ = len;
 
319
        _tmp20_ = string_length;
 
320
        g_return_val_if_fail ((_tmp18_ + _tmp19_) <= _tmp20_, NULL);
 
321
        _tmp21_ = offset;
 
322
        _tmp22_ = len;
 
323
        _tmp23_ = g_strndup (((gchar*) self) + _tmp21_, (gsize) _tmp22_);
 
324
        result = _tmp23_;
 
325
        return result;
 
326
}
 
327
 
 
328
 
 
329
static void _vala_array_add2 (gchar*** array, int* length, int* size, gchar* value) {
 
330
        if ((*length) == (*size)) {
 
331
                *size = (*size) ? (2 * (*size)) : 4;
 
332
                *array = g_renew (gchar*, *array, (*size) + 1);
 
333
        }
 
334
        (*array)[(*length)++] = value;
 
335
        (*array)[*length] = NULL;
 
336
}
 
337
 
 
338
 
 
339
static void _vala_array_add3 (gchar*** array, int* length, int* size, gchar* value) {
 
340
        if ((*length) == (*size)) {
 
341
                *size = (*size) ? (2 * (*size)) : 4;
 
342
                *array = g_renew (gchar*, *array, (*size) + 1);
 
343
        }
 
344
        (*array)[(*length)++] = value;
 
345
        (*array)[*length] = NULL;
 
346
}
 
347
 
 
348
 
 
349
gchar** zeitgeist_extension_collection_get_extension_names (ZeitgeistExtensionCollection* self, int* result_length1) {
 
350
        gchar** result = NULL;
 
351
        gchar** _tmp0_ = NULL;
 
352
        gchar** _result_;
 
353
        gint _result__length1;
 
354
        gint __result__size_;
 
355
        gchar** _tmp21_;
 
356
        gint _tmp21__length1;
 
357
        g_return_val_if_fail (self != NULL, NULL);
 
358
        _tmp0_ = g_new0 (gchar*, 0 + 1);
 
359
        _result_ = _tmp0_;
 
360
        _result__length1 = 0;
 
361
        __result__size_ = _result__length1;
 
362
        {
 
363
                gint i;
 
364
                i = 0;
 
365
                {
 
366
                        gboolean _tmp1_;
 
367
                        _tmp1_ = TRUE;
 
368
                        while (TRUE) {
 
369
                                gboolean _tmp2_;
 
370
                                gint _tmp4_;
 
371
                                GPtrArray* _tmp5_;
 
372
                                gint _tmp6_;
 
373
                                gint _tmp7_;
 
374
                                GPtrArray* _tmp8_;
 
375
                                gint _tmp9_;
 
376
                                gconstpointer _tmp10_ = NULL;
 
377
                                GType _tmp11_ = 0UL;
 
378
                                const gchar* _tmp12_ = NULL;
 
379
                                const gchar* ext_name;
 
380
                                const gchar* _tmp13_;
 
381
                                gboolean _tmp14_ = FALSE;
 
382
                                _tmp2_ = _tmp1_;
 
383
                                if (!_tmp2_) {
 
384
                                        gint _tmp3_;
 
385
                                        _tmp3_ = i;
 
386
                                        i = _tmp3_ + 1;
 
387
                                }
 
388
                                _tmp1_ = FALSE;
 
389
                                _tmp4_ = i;
 
390
                                _tmp5_ = self->priv->extensions;
 
391
                                _tmp6_ = g_ptr_array_get_length (_tmp5_);
 
392
                                _tmp7_ = _tmp6_;
 
393
                                if (!(_tmp4_ < _tmp7_)) {
 
394
                                        break;
 
395
                                }
 
396
                                _tmp8_ = self->priv->extensions;
 
397
                                _tmp9_ = i;
 
398
                                _tmp10_ = g_ptr_array_index (_tmp8_, (guint) _tmp9_);
 
399
                                _tmp11_ = G_TYPE_FROM_INSTANCE ((GObject*) ((ZeitgeistExtension*) _tmp10_));
 
400
                                _tmp12_ = g_type_name (_tmp11_);
 
401
                                ext_name = _tmp12_;
 
402
                                _tmp13_ = ext_name;
 
403
                                _tmp14_ = g_str_has_prefix (_tmp13_, "Zeitgeist");
 
404
                                if (_tmp14_) {
 
405
                                        gchar** _tmp15_;
 
406
                                        gint _tmp15__length1;
 
407
                                        const gchar* _tmp16_;
 
408
                                        gchar* _tmp17_ = NULL;
 
409
                                        _tmp15_ = _result_;
 
410
                                        _tmp15__length1 = _result__length1;
 
411
                                        _tmp16_ = ext_name;
 
412
                                        _tmp17_ = string_substring (_tmp16_, (glong) 9, (glong) (-1));
 
413
                                        _vala_array_add2 (&_result_, &_result__length1, &__result__size_, _tmp17_);
 
414
                                } else {
 
415
                                        gchar** _tmp18_;
 
416
                                        gint _tmp18__length1;
 
417
                                        const gchar* _tmp19_;
 
418
                                        gchar* _tmp20_;
 
419
                                        _tmp18_ = _result_;
 
420
                                        _tmp18__length1 = _result__length1;
 
421
                                        _tmp19_ = ext_name;
 
422
                                        _tmp20_ = g_strdup (_tmp19_);
 
423
                                        _vala_array_add3 (&_result_, &_result__length1, &__result__size_, _tmp20_);
 
424
                                }
 
425
                        }
 
426
                }
 
427
        }
 
428
        _tmp21_ = _result_;
 
429
        _tmp21__length1 = _result__length1;
 
430
        if (result_length1) {
 
431
                *result_length1 = _tmp21__length1;
 
432
        }
 
433
        result = _tmp21_;
 
434
        return result;
 
435
}
 
436
 
 
437
 
 
438
void zeitgeist_extension_collection_call_pre_insert_events (ZeitgeistExtensionCollection* self, GPtrArray* events, const char* sender) {
 
439
        GPtrArray* _tmp0_;
 
440
        gint _tmp1_;
 
441
        gint _tmp2_;
 
442
        gint num_events;
 
443
        gint _tmp15_;
 
444
        GPtrArray* _tmp16_;
 
445
        gint _tmp17_;
 
446
        gint _tmp18_;
 
447
        g_return_if_fail (self != NULL);
 
448
        g_return_if_fail (events != NULL);
 
449
        _tmp0_ = events;
 
450
        _tmp1_ = g_ptr_array_get_length (_tmp0_);
 
451
        _tmp2_ = _tmp1_;
 
452
        num_events = _tmp2_;
 
453
        {
 
454
                gint i;
 
455
                i = 0;
 
456
                {
 
457
                        gboolean _tmp3_;
 
458
                        _tmp3_ = TRUE;
 
459
                        while (TRUE) {
 
460
                                gboolean _tmp4_;
 
461
                                gint _tmp6_;
 
462
                                GPtrArray* _tmp7_;
 
463
                                gint _tmp8_;
 
464
                                gint _tmp9_;
 
465
                                GPtrArray* _tmp10_;
 
466
                                gint _tmp11_;
 
467
                                gconstpointer _tmp12_ = NULL;
 
468
                                GPtrArray* _tmp13_;
 
469
                                const char* _tmp14_;
 
470
                                _tmp4_ = _tmp3_;
 
471
                                if (!_tmp4_) {
 
472
                                        gint _tmp5_;
 
473
                                        _tmp5_ = i;
 
474
                                        i = _tmp5_ + 1;
 
475
                                }
 
476
                                _tmp3_ = FALSE;
 
477
                                _tmp6_ = i;
 
478
                                _tmp7_ = self->priv->extensions;
 
479
                                _tmp8_ = g_ptr_array_get_length (_tmp7_);
 
480
                                _tmp9_ = _tmp8_;
 
481
                                if (!(_tmp6_ < _tmp9_)) {
 
482
                                        break;
 
483
                                }
 
484
                                _tmp10_ = self->priv->extensions;
 
485
                                _tmp11_ = i;
 
486
                                _tmp12_ = g_ptr_array_index (_tmp10_, (guint) _tmp11_);
 
487
                                _tmp13_ = events;
 
488
                                _tmp14_ = sender;
 
489
                                zeitgeist_extension_pre_insert_events ((ZeitgeistExtension*) _tmp12_, _tmp13_, _tmp14_);
 
490
                        }
 
491
                }
 
492
        }
 
493
        _tmp15_ = num_events;
 
494
        _tmp16_ = events;
 
495
        _tmp17_ = g_ptr_array_get_length (_tmp16_);
 
496
        _tmp18_ = _tmp17_;
 
497
        g_assert (_tmp15_ == _tmp18_);
 
498
}
 
499
 
 
500
 
 
501
void zeitgeist_extension_collection_call_post_insert_events (ZeitgeistExtensionCollection* self, GPtrArray* events, const char* sender) {
 
502
        GPtrArray* _tmp0_;
 
503
        gint _tmp1_;
 
504
        gint _tmp2_;
 
505
        gint num_events;
 
506
        gint _tmp15_;
 
507
        GPtrArray* _tmp16_;
 
508
        gint _tmp17_;
 
509
        gint _tmp18_;
 
510
        g_return_if_fail (self != NULL);
 
511
        g_return_if_fail (events != NULL);
 
512
        _tmp0_ = events;
 
513
        _tmp1_ = g_ptr_array_get_length (_tmp0_);
 
514
        _tmp2_ = _tmp1_;
 
515
        num_events = _tmp2_;
 
516
        {
 
517
                gint i;
 
518
                i = 0;
 
519
                {
 
520
                        gboolean _tmp3_;
 
521
                        _tmp3_ = TRUE;
 
522
                        while (TRUE) {
 
523
                                gboolean _tmp4_;
 
524
                                gint _tmp6_;
 
525
                                GPtrArray* _tmp7_;
 
526
                                gint _tmp8_;
 
527
                                gint _tmp9_;
 
528
                                GPtrArray* _tmp10_;
 
529
                                gint _tmp11_;
 
530
                                gconstpointer _tmp12_ = NULL;
 
531
                                GPtrArray* _tmp13_;
 
532
                                const char* _tmp14_;
 
533
                                _tmp4_ = _tmp3_;
 
534
                                if (!_tmp4_) {
 
535
                                        gint _tmp5_;
 
536
                                        _tmp5_ = i;
 
537
                                        i = _tmp5_ + 1;
 
538
                                }
 
539
                                _tmp3_ = FALSE;
 
540
                                _tmp6_ = i;
 
541
                                _tmp7_ = self->priv->extensions;
 
542
                                _tmp8_ = g_ptr_array_get_length (_tmp7_);
 
543
                                _tmp9_ = _tmp8_;
 
544
                                if (!(_tmp6_ < _tmp9_)) {
 
545
                                        break;
 
546
                                }
 
547
                                _tmp10_ = self->priv->extensions;
 
548
                                _tmp11_ = i;
 
549
                                _tmp12_ = g_ptr_array_index (_tmp10_, (guint) _tmp11_);
 
550
                                _tmp13_ = events;
 
551
                                _tmp14_ = sender;
 
552
                                zeitgeist_extension_post_insert_events ((ZeitgeistExtension*) _tmp12_, _tmp13_, _tmp14_);
 
553
                        }
 
554
                }
 
555
        }
 
556
        _tmp15_ = num_events;
 
557
        _tmp16_ = events;
 
558
        _tmp17_ = g_ptr_array_get_length (_tmp16_);
 
559
        _tmp18_ = _tmp17_;
 
560
        g_assert (_tmp15_ == _tmp18_);
 
561
}
 
562
 
 
563
 
 
564
guint32* zeitgeist_extension_collection_call_pre_delete_events (ZeitgeistExtensionCollection* self, guint32* event_ids, int event_ids_length1, const char* sender, int* result_length1) {
 
565
        guint32* result = NULL;
 
566
        guint32* _tmp16_;
 
567
        gint _tmp16__length1;
 
568
        guint32* _tmp17_;
 
569
        gint _tmp17__length1;
 
570
        g_return_val_if_fail (self != NULL, NULL);
 
571
        {
 
572
                gint i;
 
573
                i = 0;
 
574
                {
 
575
                        gboolean _tmp0_;
 
576
                        _tmp0_ = TRUE;
 
577
                        while (TRUE) {
 
578
                                gboolean _tmp1_;
 
579
                                gint _tmp3_;
 
580
                                GPtrArray* _tmp4_;
 
581
                                gint _tmp5_;
 
582
                                gint _tmp6_;
 
583
                                GPtrArray* _tmp7_;
 
584
                                gint _tmp8_;
 
585
                                gconstpointer _tmp9_ = NULL;
 
586
                                guint32* _tmp10_;
 
587
                                gint _tmp10__length1;
 
588
                                const char* _tmp11_;
 
589
                                gint _tmp12_ = 0;
 
590
                                guint32* _tmp13_ = NULL;
 
591
                                guint32* filtered_ids;
 
592
                                gint filtered_ids_length1;
 
593
                                gint _filtered_ids_size_;
 
594
                                guint32* _tmp14_;
 
595
                                gint _tmp14__length1;
 
596
                                _tmp1_ = _tmp0_;
 
597
                                if (!_tmp1_) {
 
598
                                        gint _tmp2_;
 
599
                                        _tmp2_ = i;
 
600
                                        i = _tmp2_ + 1;
 
601
                                }
 
602
                                _tmp0_ = FALSE;
 
603
                                _tmp3_ = i;
 
604
                                _tmp4_ = self->priv->extensions;
 
605
                                _tmp5_ = g_ptr_array_get_length (_tmp4_);
 
606
                                _tmp6_ = _tmp5_;
 
607
                                if (!(_tmp3_ < _tmp6_)) {
 
608
                                        break;
 
609
                                }
 
610
                                _tmp7_ = self->priv->extensions;
 
611
                                _tmp8_ = i;
 
612
                                _tmp9_ = g_ptr_array_index (_tmp7_, (guint) _tmp8_);
 
613
                                _tmp10_ = event_ids;
 
614
                                _tmp10__length1 = event_ids_length1;
 
615
                                _tmp11_ = sender;
 
616
                                _tmp13_ = zeitgeist_extension_pre_delete_events ((ZeitgeistExtension*) _tmp9_, _tmp10_, _tmp10__length1, _tmp11_, &_tmp12_);
 
617
                                filtered_ids = _tmp13_;
 
618
                                filtered_ids_length1 = _tmp12_;
 
619
                                _filtered_ids_size_ = filtered_ids_length1;
 
620
                                _tmp14_ = filtered_ids;
 
621
                                _tmp14__length1 = filtered_ids_length1;
 
622
                                if (_tmp14_ != NULL) {
 
623
                                        guint32* _tmp15_;
 
624
                                        gint _tmp15__length1;
 
625
                                        _tmp15_ = filtered_ids;
 
626
                                        _tmp15__length1 = filtered_ids_length1;
 
627
                                        event_ids = _tmp15_;
 
628
                                        event_ids_length1 = _tmp15__length1;
 
629
                                }
 
630
                                filtered_ids = (g_free (filtered_ids), NULL);
 
631
                        }
 
632
                }
 
633
        }
 
634
        _tmp16_ = event_ids;
 
635
        _tmp16__length1 = event_ids_length1;
 
636
        _tmp17_ = _tmp16_;
 
637
        _tmp17__length1 = _tmp16__length1;
 
638
        if (result_length1) {
 
639
                *result_length1 = _tmp17__length1;
 
640
        }
 
641
        result = _tmp17_;
 
642
        return result;
 
643
}
 
644
 
 
645
 
 
646
void zeitgeist_extension_collection_call_post_delete_events (ZeitgeistExtensionCollection* self, guint32* event_ids, int event_ids_length1, const char* sender) {
 
647
        g_return_if_fail (self != NULL);
 
648
        {
 
649
                gint i;
 
650
                i = 0;
 
651
                {
 
652
                        gboolean _tmp0_;
 
653
                        _tmp0_ = TRUE;
 
654
                        while (TRUE) {
 
655
                                gboolean _tmp1_;
 
656
                                gint _tmp3_;
 
657
                                GPtrArray* _tmp4_;
 
658
                                gint _tmp5_;
 
659
                                gint _tmp6_;
 
660
                                GPtrArray* _tmp7_;
 
661
                                gint _tmp8_;
 
662
                                gconstpointer _tmp9_ = NULL;
 
663
                                guint32* _tmp10_;
 
664
                                gint _tmp10__length1;
 
665
                                const char* _tmp11_;
 
666
                                _tmp1_ = _tmp0_;
 
667
                                if (!_tmp1_) {
 
668
                                        gint _tmp2_;
 
669
                                        _tmp2_ = i;
 
670
                                        i = _tmp2_ + 1;
 
671
                                }
 
672
                                _tmp0_ = FALSE;
 
673
                                _tmp3_ = i;
 
674
                                _tmp4_ = self->priv->extensions;
 
675
                                _tmp5_ = g_ptr_array_get_length (_tmp4_);
 
676
                                _tmp6_ = _tmp5_;
 
677
                                if (!(_tmp3_ < _tmp6_)) {
 
678
                                        break;
 
679
                                }
 
680
                                _tmp7_ = self->priv->extensions;
 
681
                                _tmp8_ = i;
 
682
                                _tmp9_ = g_ptr_array_index (_tmp7_, (guint) _tmp8_);
 
683
                                _tmp10_ = event_ids;
 
684
                                _tmp10__length1 = event_ids_length1;
 
685
                                _tmp11_ = sender;
 
686
                                zeitgeist_extension_post_delete_events ((ZeitgeistExtension*) _tmp9_, _tmp10_, _tmp10__length1, _tmp11_);
 
687
                        }
 
688
                }
 
689
        }
 
690
}
 
691
 
 
692
 
 
693
ZeitgeistEngine* zeitgeist_extension_collection_get_engine (ZeitgeistExtensionCollection* self) {
 
694
        ZeitgeistEngine* result;
 
695
        ZeitgeistEngine* _tmp0_;
 
696
        g_return_val_if_fail (self != NULL, NULL);
 
697
        _tmp0_ = self->priv->_engine;
 
698
        result = _tmp0_;
 
699
        return result;
 
700
}
 
701
 
 
702
 
 
703
static void zeitgeist_extension_collection_set_engine (ZeitgeistExtensionCollection* self, ZeitgeistEngine* value) {
 
704
        ZeitgeistEngine* _tmp0_;
 
705
        g_return_if_fail (self != NULL);
 
706
        _tmp0_ = value;
 
707
        self->priv->_engine = _tmp0_;
 
708
        g_object_notify ((GObject *) self, "engine");
 
709
}
 
710
 
 
711
 
 
712
static void _g_object_unref0_ (gpointer var) {
 
713
        (var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
 
714
}
 
715
 
 
716
 
 
717
static GType _zeitgeist_data_source_registry_init_zeitgeist_register_extension_func (GTypeModule* module) {
 
718
        GType result;
 
719
        result = zeitgeist_data_source_registry_init (module);
 
720
        return result;
 
721
}
 
722
 
 
723
 
 
724
static GType _zeitgeist_blacklist_init_zeitgeist_register_extension_func (GTypeModule* module) {
 
725
        GType result;
 
726
        result = zeitgeist_blacklist_init (module);
 
727
        return result;
 
728
}
 
729
 
 
730
 
 
731
static GType _zeitgeist_histogram_init_zeitgeist_register_extension_func (GTypeModule* module) {
 
732
        GType result;
 
733
        result = zeitgeist_histogram_init (module);
 
734
        return result;
 
735
}
 
736
 
 
737
 
 
738
static GType _zeitgeist_storage_monitor_init_zeitgeist_register_extension_func (GTypeModule* module) {
 
739
        GType result;
 
740
        result = zeitgeist_storage_monitor_init (module);
 
741
        return result;
 
742
}
 
743
 
 
744
 
 
745
static GType _zeitgeist_fts_init_zeitgeist_register_extension_func (GTypeModule* module) {
 
746
        GType result;
 
747
        result = zeitgeist_fts_init (module);
 
748
        return result;
 
749
}
 
750
 
 
751
 
 
752
static gpointer _g_object_ref0 (gpointer self) {
 
753
        return self ? g_object_ref (self) : NULL;
 
754
}
 
755
 
 
756
 
 
757
static GObject * zeitgeist_extension_collection_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
 
758
        GObject * obj;
 
759
        GObjectClass * parent_class;
 
760
        ZeitgeistExtensionCollection * self;
 
761
        ZeitgeistExtension* extension = NULL;
 
762
        GPtrArray* _tmp0_;
 
763
        ZeitgeistRegisterExtensionFunc* _tmp1_ = NULL;
 
764
        ZeitgeistRegisterExtensionFunc* builtins;
 
765
        gint builtins_length1;
 
766
        gint _builtins_size_;
 
767
        ZeitgeistRegisterExtensionFunc* _tmp2_;
 
768
        gint _tmp2__length1;
 
769
        const gchar* _tmp12_ = NULL;
 
770
        const gchar* ext_dir1;
 
771
        const gchar* _tmp13_;
 
772
        gboolean _tmp14_ = FALSE;
 
773
        GDir* user_ext_dir = NULL;
 
774
        GDir* _tmp20_;
 
775
        GError * _inner_error_ = NULL;
 
776
        parent_class = G_OBJECT_CLASS (zeitgeist_extension_collection_parent_class);
 
777
        obj = parent_class->constructor (type, n_construct_properties, construct_properties);
 
778
        self = ZEITGEIST_EXTENSION_COLLECTION (obj);
 
779
        _tmp0_ = g_ptr_array_new_with_free_func (_g_object_unref0_);
 
780
        _g_ptr_array_unref0 (self->priv->extensions);
 
781
        self->priv->extensions = _tmp0_;
 
782
        _tmp1_ = g_new0 (ZeitgeistRegisterExtensionFunc, 5);
 
783
        _tmp1_[0] = _zeitgeist_data_source_registry_init_zeitgeist_register_extension_func;
 
784
        _tmp1_[1] = _zeitgeist_blacklist_init_zeitgeist_register_extension_func;
 
785
        _tmp1_[2] = _zeitgeist_histogram_init_zeitgeist_register_extension_func;
 
786
        _tmp1_[3] = _zeitgeist_storage_monitor_init_zeitgeist_register_extension_func;
 
787
        _tmp1_[4] = _zeitgeist_fts_init_zeitgeist_register_extension_func;
 
788
        builtins = _tmp1_;
 
789
        builtins_length1 = 5;
 
790
        _builtins_size_ = builtins_length1;
 
791
        _tmp2_ = builtins;
 
792
        _tmp2__length1 = builtins_length1;
 
793
        {
 
794
                ZeitgeistRegisterExtensionFunc* func_collection = NULL;
 
795
                gint func_collection_length1 = 0;
 
796
                gint _func_collection_size_ = 0;
 
797
                gint func_it = 0;
 
798
                func_collection = _tmp2_;
 
799
                func_collection_length1 = _tmp2__length1;
 
800
                for (func_it = 0; func_it < _tmp2__length1; func_it = func_it + 1) {
 
801
                        ZeitgeistRegisterExtensionFunc func = NULL;
 
802
                        func = func_collection[func_it];
 
803
                        {
 
804
                                ZeitgeistRegisterExtensionFunc _tmp3_;
 
805
                                ZeitgeistBuiltinExtension* _tmp4_;
 
806
                                ZeitgeistExtensionLoader* builtin;
 
807
                                ZeitgeistExtensionLoader* _tmp5_;
 
808
                                ZeitgeistEngine* _tmp6_;
 
809
                                ZeitgeistExtension* _tmp7_ = NULL;
 
810
                                ZeitgeistExtension* _tmp8_;
 
811
                                _tmp3_ = func;
 
812
                                _tmp4_ = zeitgeist_builtin_extension_new (_tmp3_);
 
813
                                builtin = (ZeitgeistExtensionLoader*) _tmp4_;
 
814
                                _tmp5_ = builtin;
 
815
                                _tmp6_ = self->priv->_engine;
 
816
                                _tmp7_ = zeitgeist_extension_loader_create_instance (_tmp5_, _tmp6_);
 
817
                                _g_object_unref0 (extension);
 
818
                                extension = _tmp7_;
 
819
                                _tmp8_ = extension;
 
820
                                if (_tmp8_ != NULL) {
 
821
                                        GPtrArray* _tmp9_;
 
822
                                        ZeitgeistExtension* _tmp10_;
 
823
                                        ZeitgeistExtension* _tmp11_;
 
824
                                        _tmp9_ = self->priv->extensions;
 
825
                                        _tmp10_ = extension;
 
826
                                        _tmp11_ = _g_object_ref0 (_tmp10_);
 
827
                                        g_ptr_array_add (_tmp9_, _tmp11_);
 
828
                                }
 
829
                                _g_object_unref0 (builtin);
 
830
                        }
 
831
                }
 
832
        }
 
833
        _tmp12_ = zeitgeist_utils_get_local_extensions_path ();
 
834
        ext_dir1 = _tmp12_;
 
835
        _tmp13_ = ext_dir1;
 
836
        _tmp14_ = g_file_test (_tmp13_, G_FILE_TEST_IS_DIR | G_FILE_TEST_EXISTS);
 
837
        if (!_tmp14_) {
 
838
                builtins = (g_free (builtins), NULL);
 
839
                _g_object_unref0 (extension);
 
840
                return obj;
 
841
        }
 
842
        {
 
843
                const gchar* _tmp15_;
 
844
                GDir* _tmp16_ = NULL;
 
845
                GDir* _tmp17_;
 
846
                _tmp15_ = ext_dir1;
 
847
                _tmp16_ = g_dir_open (_tmp15_, (guint) 0, &_inner_error_);
 
848
                _tmp17_ = _tmp16_;
 
849
                if (_inner_error_ != NULL) {
 
850
                        goto __catch7_g_error;
 
851
                }
 
852
                _g_dir_close0 (user_ext_dir);
 
853
                user_ext_dir = _tmp17_;
 
854
        }
 
855
        goto __finally7;
 
856
        __catch7_g_error:
 
857
        {
 
858
                GError* e = NULL;
 
859
                GError* _tmp18_;
 
860
                const gchar* _tmp19_;
 
861
                e = _inner_error_;
 
862
                _inner_error_ = NULL;
 
863
                _tmp18_ = e;
 
864
                _tmp19_ = _tmp18_->message;
 
865
                g_warning ("extension-collection.vala:74: Couldn't open local extensions directory" \
 
866
": %s", _tmp19_);
 
867
                _g_error_free0 (e);
 
868
        }
 
869
        __finally7:
 
870
        if (_inner_error_ != NULL) {
 
871
                _g_dir_close0 (user_ext_dir);
 
872
                builtins = (g_free (builtins), NULL);
 
873
                _g_object_unref0 (extension);
 
874
                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);
 
875
                g_clear_error (&_inner_error_);
 
876
        }
 
877
        _tmp20_ = user_ext_dir;
 
878
        if (_tmp20_ != NULL) {
 
879
                GDir* _tmp21_;
 
880
                const gchar* _tmp22_ = NULL;
 
881
                const gchar* file_name;
 
882
                _tmp21_ = user_ext_dir;
 
883
                _tmp22_ = g_dir_read_name (_tmp21_);
 
884
                file_name = _tmp22_;
 
885
                while (TRUE) {
 
886
                        const gchar* _tmp23_;
 
887
                        const gchar* _tmp24_;
 
888
                        gboolean _tmp25_ = FALSE;
 
889
                        GDir* _tmp41_;
 
890
                        const gchar* _tmp42_ = NULL;
 
891
                        _tmp23_ = file_name;
 
892
                        if (!(_tmp23_ != NULL)) {
 
893
                                break;
 
894
                        }
 
895
                        _tmp24_ = file_name;
 
896
                        _tmp25_ = g_str_has_suffix (_tmp24_, ".so");
 
897
                        if (_tmp25_) {
 
898
                                const gchar* _tmp26_;
 
899
                                const gchar* _tmp27_;
 
900
                                gchar* _tmp28_ = NULL;
 
901
                                gchar* path;
 
902
                                const gchar* _tmp29_;
 
903
                                const gchar* _tmp30_;
 
904
                                ZeitgeistModuleLoader* _tmp31_;
 
905
                                ZeitgeistModuleLoader* loader;
 
906
                                ZeitgeistModuleLoader* _tmp32_;
 
907
                                ZeitgeistEngine* _tmp33_;
 
908
                                ZeitgeistExtension* _tmp34_ = NULL;
 
909
                                ZeitgeistExtension* _tmp35_;
 
910
                                _tmp26_ = ext_dir1;
 
911
                                _tmp27_ = file_name;
 
912
                                _tmp28_ = g_build_filename (_tmp26_, _tmp27_, NULL);
 
913
                                path = _tmp28_;
 
914
                                _tmp29_ = path;
 
915
                                g_debug ("extension-collection.vala:85: Loading extension: \"%s\"", _tmp29_);
 
916
                                _tmp30_ = path;
 
917
                                _tmp31_ = zeitgeist_module_loader_new (_tmp30_);
 
918
                                loader = _tmp31_;
 
919
                                _tmp32_ = loader;
 
920
                                _tmp33_ = self->priv->_engine;
 
921
                                _tmp34_ = zeitgeist_extension_loader_create_instance ((ZeitgeistExtensionLoader*) _tmp32_, _tmp33_);
 
922
                                _g_object_unref0 (extension);
 
923
                                extension = _tmp34_;
 
924
                                _tmp35_ = extension;
 
925
                                if (_tmp35_ != NULL) {
 
926
                                        GPtrArray* _tmp36_;
 
927
                                        ZeitgeistExtension* _tmp37_;
 
928
                                        ZeitgeistExtension* _tmp38_;
 
929
                                        _tmp36_ = self->priv->extensions;
 
930
                                        _tmp37_ = extension;
 
931
                                        _tmp38_ = _g_object_ref0 (_tmp37_);
 
932
                                        g_ptr_array_add (_tmp36_, _tmp38_);
 
933
                                }
 
934
                                _g_object_unref0 (loader);
 
935
                                _g_free0 (path);
 
936
                        } else {
 
937
                                const gchar* _tmp39_;
 
938
                                const gchar* _tmp40_;
 
939
                                _tmp39_ = ext_dir1;
 
940
                                _tmp40_ = file_name;
 
941
                                g_debug ("extension-collection.vala:93: Ignored file \"%s/%s\"", _tmp39_, _tmp40_);
 
942
                        }
 
943
                        _tmp41_ = user_ext_dir;
 
944
                        _tmp42_ = g_dir_read_name (_tmp41_);
 
945
                        file_name = _tmp42_;
 
946
                }
 
947
        }
 
948
        _g_dir_close0 (user_ext_dir);
 
949
        builtins = (g_free (builtins), NULL);
 
950
        _g_object_unref0 (extension);
 
951
        return obj;
 
952
}
 
953
 
 
954
 
 
955
static void zeitgeist_extension_collection_class_init (ZeitgeistExtensionCollectionClass * klass) {
 
956
        zeitgeist_extension_collection_parent_class = g_type_class_peek_parent (klass);
 
957
        g_type_class_add_private (klass, sizeof (ZeitgeistExtensionCollectionPrivate));
 
958
        G_OBJECT_CLASS (klass)->get_property = _vala_zeitgeist_extension_collection_get_property;
 
959
        G_OBJECT_CLASS (klass)->set_property = _vala_zeitgeist_extension_collection_set_property;
 
960
        G_OBJECT_CLASS (klass)->constructor = zeitgeist_extension_collection_constructor;
 
961
        G_OBJECT_CLASS (klass)->finalize = zeitgeist_extension_collection_finalize;
 
962
        g_object_class_install_property (G_OBJECT_CLASS (klass), ZEITGEIST_EXTENSION_COLLECTION_ENGINE, g_param_spec_object ("engine", "engine", "engine", ZEITGEIST_TYPE_ENGINE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
 
963
}
 
964
 
 
965
 
 
966
static void zeitgeist_extension_collection_instance_init (ZeitgeistExtensionCollection * self) {
 
967
        self->priv = ZEITGEIST_EXTENSION_COLLECTION_GET_PRIVATE (self);
 
968
}
 
969
 
 
970
 
 
971
static void zeitgeist_extension_collection_finalize (GObject* obj) {
 
972
        ZeitgeistExtensionCollection * self;
 
973
        GPtrArray* _tmp0_;
 
974
        self = ZEITGEIST_EXTENSION_COLLECTION (obj);
 
975
        _tmp0_ = self->priv->extensions;
 
976
        g_ptr_array_foreach (_tmp0_, __zeitgeist_extension_collection___lambda3__gfunc, self);
 
977
        _g_ptr_array_unref0 (self->priv->extensions);
 
978
        G_OBJECT_CLASS (zeitgeist_extension_collection_parent_class)->finalize (obj);
 
979
}
 
980
 
 
981
 
 
982
GType zeitgeist_extension_collection_get_type (void) {
 
983
        static volatile gsize zeitgeist_extension_collection_type_id__volatile = 0;
 
984
        if (g_once_init_enter (&zeitgeist_extension_collection_type_id__volatile)) {
 
985
                static const GTypeInfo g_define_type_info = { sizeof (ZeitgeistExtensionCollectionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) zeitgeist_extension_collection_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ZeitgeistExtensionCollection), 0, (GInstanceInitFunc) zeitgeist_extension_collection_instance_init, NULL };
 
986
                GType zeitgeist_extension_collection_type_id;
 
987
                zeitgeist_extension_collection_type_id = g_type_register_static (G_TYPE_OBJECT, "ZeitgeistExtensionCollection", &g_define_type_info, 0);
 
988
                g_once_init_leave (&zeitgeist_extension_collection_type_id__volatile, zeitgeist_extension_collection_type_id);
 
989
        }
 
990
        return zeitgeist_extension_collection_type_id__volatile;
 
991
}
 
992
 
 
993
 
 
994
static void _vala_zeitgeist_extension_collection_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
 
995
        ZeitgeistExtensionCollection * self;
 
996
        self = ZEITGEIST_EXTENSION_COLLECTION (object);
 
997
        switch (property_id) {
 
998
                case ZEITGEIST_EXTENSION_COLLECTION_ENGINE:
 
999
                g_value_set_object (value, zeitgeist_extension_collection_get_engine (self));
 
1000
                break;
 
1001
                default:
 
1002
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
1003
                break;
 
1004
        }
 
1005
}
 
1006
 
 
1007
 
 
1008
static void _vala_zeitgeist_extension_collection_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
 
1009
        ZeitgeistExtensionCollection * self;
 
1010
        self = ZEITGEIST_EXTENSION_COLLECTION (object);
 
1011
        switch (property_id) {
 
1012
                case ZEITGEIST_EXTENSION_COLLECTION_ENGINE:
 
1013
                zeitgeist_extension_collection_set_engine (self, g_value_get_object (value));
 
1014
                break;
 
1015
                default:
 
1016
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
1017
                break;
 
1018
        }
 
1019
}
 
1020
 
 
1021
 
 
1022
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
 
1023
        if ((array != NULL) && (destroy_func != NULL)) {
 
1024
                int i;
 
1025
                for (i = 0; i < array_length; i = i + 1) {
 
1026
                        if (((gpointer*) array)[i] != NULL) {
 
1027
                                destroy_func (((gpointer*) array)[i]);
 
1028
                        }
 
1029
                }
 
1030
        }
 
1031
}
 
1032
 
 
1033
 
 
1034
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
 
1035
        _vala_array_destroy (array, array_length, destroy_func);
 
1036
        g_free (array);
 
1037
}
 
1038
 
 
1039
 
 
1040