1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
|
/* SourceInterfaces.c generated by valac 0.40.4, the Vala compiler
* generated from SourceInterfaces.vala, do not modify */
/* Copyright 2016 Software Freedom Conservancy Inc.
*
* This software is licensed under the GNU Lesser General Public License
* (version 2.1 or later). See the COPYING file in this distribution.
*/
/* See the note in MediaInterfaces.vala for some thoughts on the theory of expanding Shotwell's*/
/* features via interfaces rather than class hierarchies.*/
/* Indexable DataSources provide raw strings that may be searched against (and, in the future,*/
/* indexed) for free-text search queries. DataSources implementing Indexable must prepare and*/
/* store (i.e. cache) these strings using prepare_indexable_string(s), as preparing the strings*/
/* for each call is expensive.*/
/**/
/* When the indexable string has changed, the object should fire an alteration of*/
/* "indexable:keywords". The prepare methods will not do this.*/
#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#define TYPE_DATA_OBJECT (data_object_get_type ())
#define DATA_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATA_OBJECT, DataObject))
#define DATA_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATA_OBJECT, DataObjectClass))
#define IS_DATA_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATA_OBJECT))
#define IS_DATA_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATA_OBJECT))
#define DATA_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATA_OBJECT, DataObjectClass))
typedef struct _DataObject DataObject;
typedef struct _DataObjectClass DataObjectClass;
#define TYPE_DATA_SOURCE (data_source_get_type ())
#define DATA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATA_SOURCE, DataSource))
#define DATA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATA_SOURCE, DataSourceClass))
#define IS_DATA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATA_SOURCE))
#define IS_DATA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATA_SOURCE))
#define DATA_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATA_SOURCE, DataSourceClass))
typedef struct _DataSource DataSource;
typedef struct _DataSourceClass DataSourceClass;
#define TYPE_INDEXABLE (indexable_get_type ())
#define INDEXABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_INDEXABLE, Indexable))
#define IS_INDEXABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_INDEXABLE))
#define INDEXABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_INDEXABLE, IndexableIface))
typedef struct _Indexable Indexable;
typedef struct _IndexableIface IndexableIface;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
struct _IndexableIface {
GTypeInterface parent_iface;
const gchar* (*get_indexable_keywords) (Indexable* self);
};
GType data_object_get_type (void) G_GNUC_CONST;
GType data_source_get_type (void) G_GNUC_CONST;
GType indexable_get_type (void) G_GNUC_CONST;
const gchar* indexable_get_indexable_keywords (Indexable* self);
gchar* indexable_prepare_indexable_string (const gchar* str);
gboolean is_string_empty (const gchar* s);
gchar* string_remove_diacritics (const gchar* istring);
gchar* indexable_prepare_indexable_strings (gchar** strs,
int strs_length1);
const gchar*
indexable_get_indexable_keywords (Indexable* self)
{
#line 19 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
g_return_val_if_fail (IS_INDEXABLE (self), NULL);
#line 19 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
return INDEXABLE_GET_INTERFACE (self)->get_indexable_keywords (self);
#line 82 "SourceInterfaces.c"
}
gchar*
indexable_prepare_indexable_string (const gchar* str)
{
gchar* result = NULL;
gchar* _tmp0_;
gchar* _tmp1_;
gchar* _tmp2_;
gchar* _tmp3_;
#line 22 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
if (is_string_empty (str)) {
#line 23 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
result = NULL;
#line 23 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
return result;
#line 100 "SourceInterfaces.c"
}
#line 24 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_tmp0_ = g_utf8_strdown (str, (gssize) -1);
#line 24 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_tmp1_ = _tmp0_;
#line 24 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_tmp2_ = string_remove_diacritics (_tmp1_);
#line 24 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_tmp3_ = _tmp2_;
#line 24 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_g_free0 (_tmp1_);
#line 24 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
result = _tmp3_;
#line 24 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
return result;
#line 116 "SourceInterfaces.c"
}
gchar*
indexable_prepare_indexable_strings (gchar** strs,
int strs_length1)
{
gchar* result = NULL;
gboolean _tmp0_ = FALSE;
GString* builder = NULL;
GString* _tmp1_;
gint ctr = 0;
const gchar* _tmp14_ = NULL;
GString* _tmp15_;
const gchar* _tmp16_;
gchar* _tmp19_;
#line 28 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
if (strs == NULL) {
#line 28 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_tmp0_ = TRUE;
#line 137 "SourceInterfaces.c"
} else {
#line 28 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_tmp0_ = strs_length1 == 0;
#line 141 "SourceInterfaces.c"
}
#line 28 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
if (_tmp0_) {
#line 29 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
result = NULL;
#line 29 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
return result;
#line 149 "SourceInterfaces.c"
}
#line 31 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_tmp1_ = g_string_new ("");
#line 31 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
builder = _tmp1_;
#line 32 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
ctr = 0;
#line 157 "SourceInterfaces.c"
{
gboolean _tmp2_ = FALSE;
#line 33 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_tmp2_ = TRUE;
#line 33 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
while (TRUE) {
#line 164 "SourceInterfaces.c"
gint _tmp5_;
const gchar* _tmp6_;
#line 33 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
if (!_tmp2_) {
#line 169 "SourceInterfaces.c"
gint _tmp3_;
gint _tmp4_;
#line 39 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_tmp3_ = ctr;
#line 39 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
ctr = _tmp3_ + 1;
#line 39 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_tmp4_ = ctr;
#line 39 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
if (!(_tmp4_ < strs_length1)) {
#line 39 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
break;
#line 182 "SourceInterfaces.c"
}
}
#line 33 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_tmp2_ = FALSE;
#line 34 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_tmp5_ = ctr;
#line 34 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_tmp6_ = strs[_tmp5_];
#line 34 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
if (!is_string_empty (_tmp6_)) {
#line 193 "SourceInterfaces.c"
GString* _tmp7_;
gint _tmp8_;
const gchar* _tmp9_;
gchar* _tmp10_;
gchar* _tmp11_;
gint _tmp12_;
#line 35 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_tmp7_ = builder;
#line 35 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_tmp8_ = ctr;
#line 35 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_tmp9_ = strs[_tmp8_];
#line 35 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_tmp10_ = g_utf8_strdown (_tmp9_, (gssize) -1);
#line 35 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_tmp11_ = _tmp10_;
#line 35 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
g_string_append (_tmp7_, _tmp11_);
#line 35 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_g_free0 (_tmp11_);
#line 36 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_tmp12_ = ctr;
#line 36 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
if (_tmp12_ < (strs_length1 - 1)) {
#line 218 "SourceInterfaces.c"
GString* _tmp13_;
#line 37 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_tmp13_ = builder;
#line 37 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
g_string_append_c (_tmp13_, ' ');
#line 224 "SourceInterfaces.c"
}
}
}
}
#line 41 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_tmp15_ = builder;
#line 41 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_tmp16_ = _tmp15_->str;
#line 41 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
if (!is_string_empty (_tmp16_)) {
#line 235 "SourceInterfaces.c"
GString* _tmp17_;
const gchar* _tmp18_;
#line 41 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_tmp17_ = builder;
#line 41 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_tmp18_ = _tmp17_->str;
#line 41 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_tmp14_ = _tmp18_;
#line 244 "SourceInterfaces.c"
} else {
#line 41 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_tmp14_ = NULL;
#line 248 "SourceInterfaces.c"
}
#line 41 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_tmp19_ = g_strdup (_tmp14_);
#line 41 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
result = _tmp19_;
#line 41 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
_g_string_free0 (builder);
#line 41 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
return result;
#line 258 "SourceInterfaces.c"
}
static void
indexable_base_init (IndexableIface * iface)
{
#line 18 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
static gboolean initialized = FALSE;
#line 18 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
if (!initialized) {
#line 18 "/home/jens/Source/shotwell/src/core/SourceInterfaces.vala"
initialized = TRUE;
#line 271 "SourceInterfaces.c"
}
}
GType
indexable_get_type (void)
{
static volatile gsize indexable_type_id__volatile = 0;
if (g_once_init_enter (&indexable_type_id__volatile)) {
static const GTypeInfo g_define_type_info = { sizeof (IndexableIface), (GBaseInitFunc) indexable_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
GType indexable_type_id;
indexable_type_id = g_type_register_static (G_TYPE_INTERFACE, "Indexable", &g_define_type_info, 0);
g_type_interface_add_prerequisite (indexable_type_id, TYPE_DATA_SOURCE);
g_once_init_leave (&indexable_type_id__volatile, indexable_type_id);
}
return indexable_type_id__volatile;
}
|