summaryrefslogtreecommitdiff
path: root/libzeitgeist/enumerations.vala
blob: 438f91b24b579e0935382f1af5c38c268589972d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
/* enumerations.vala
 *
 * Copyright © 2011-2012 Collabora Ltd.
 *          By Seif Lotfy <seif@lotfy.com>
 *          By Siegfried-Angel Gevatter Pujals <siegfried@gevatter.com>
 * Copyright © 2011 Manish Sinha <manishsinha@ubuntu.com>
 * Copyright © 2011 Michal Hruby <michal.mhr@gmail.com>
 * Copyright © 2012 Canonical Ltd.
 *          By Siegfried-A. Gevatter <siegfried.gevatter@collabora.co.uk>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

using Zeitgeist;

namespace Zeitgeist
{

/**
 * Errors which can be thrown when asynchronously querying for {@link Event}s.
 */
[DBus (name = "org.gnome.zeitgeist.DataModelError")]
public errordomain DataModelError {
    /**
     * Signature sent over DBus is invalid.
     */
    INVALID_SIGNATURE,
    /**
     * {@link Event} is NULL.
     */
    NULL_EVENT,
    /**
     * Query return too many {@link Event}s.
     */
    TOO_MANY_RESULTS
}

/**
 * ZeitgeistResultType
 *
 * Used to control how the query results are grouped and sorted.
 * See zeitgeist_log_find_events(), zeitgeist_log_find_event_ids(), and
 * zeitgeist_index_search().
 */

public enum ResultType
{
    /**
     * All events with the most recent events first
     */
    MOST_RECENT_EVENTS                   = 0,
    /**
     * All events with the oldest
     */
    LEAST_RECENT_EVENTS                  = 1,
    /**
     * One event for each subject only, ordered with the most recent events first
     */
    MOST_RECENT_SUBJECTS                 = 2,
    /**
     * One event for each subject, only, ordered with oldest events first
     */
    LEAST_RECENT_SUBJECTS                = 3,
    /**
     * One event for each subject only, ordered by the popularity of the subject
     */
    MOST_POPULAR_SUBJECTS                = 4,
    /**
     * One event for each subject only, ordered ascendingly by popularity of the subject
     */
    LEAST_POPULAR_SUBJECTS               = 5,
    /**
     * The last event of each different actor ordered by the popularity of the actor
     */
    MOST_POPULAR_ACTOR                   = 6,
    /**
     * The last event of each different actor, ordered ascendingly by the popularity of the actor
     */
    LEAST_POPULAR_ACTOR                  = 7,
    /**
     * The actor that has been used to most recently
     */
    MOST_RECENT_ACTOR                    = 8,
    /**
     * The actor that has been used to least recently
     */
    LEAST_RECENT_ACTOR                   = 9,
    /**
     * The last event of each different subject origin.
     */
    MOST_RECENT_ORIGIN                   = 10,
    /**
     * The last event of each different subject origin, ordered by least recently used first
     */
    LEAST_RECENT_ORIGIN                  = 11,
    /**
     * The last event of each different subject origin, ordered by the popularity of the origins
     */
    MOST_POPULAR_ORIGIN                  = 12,
    /**
     * The last event of each different subject origin, ordered ascendingly by the popularity of the origin
     */
    LEAST_POPULAR_ORIGIN                 = 13,
    /**
     * The first event of each different actor
     */
    OLDEST_ACTOR                         = 14,
    /**
     * One event for each subject interpretation only, ordered with the most recent events first
     */
    MOST_RECENT_SUBJECT_INTERPRETATION   = 15,
    /**
     * One event for each subject interpretation only, ordered with the least recent events first
     */
    LEAST_RECENT_SUBJECT_INTERPRETATION  = 16,
    /**
     * One event for each subject interpretation only, ordered by the popularity of the subject interpretation
     */
    MOST_POPULAR_SUBJECT_INTERPRETATION  = 17,
    /**
     * One event for each subject interpretation only, ordered ascendingly by popularity of the subject interpretation
     */
    LEAST_POPULAR_SUBJECT_INTERPRETATION = 18,
    /**
     * One event for each mimetype only ordered with the most recent events first
     */
    MOST_RECENT_MIMETYPE                 = 19,
    /**
     * One event for each mimetype only ordered with the least recent events first
     */
    LEAST_RECENT_MIMETYPE                = 20,
    /**
     * One event for each mimetype only ordered by the popularity of the mimetype
     */
    MOST_POPULAR_MIMETYPE                = 21,
    /**
     * One event for each mimetype only ordered ascendingly by popularity of the mimetype
     */
    LEAST_POPULAR_MIMETYPE               = 22,
    /**
     * One event for each subject only by current_uri instead of uri ordered with the most recent events first
     */
    MOST_RECENT_CURRENT_URI              = 23,
    /**
     *  One event for each subject only by current_uri instead of uri ordered with oldest events first
     */
    LEAST_RECENT_CURRENT_URI             = 24,
    /**
     * One event for each subject only by current_uri instead of uri ordered by the popularity of the subject
     */
    MOST_POPULAR_CURRENT_URI             = 25,
    /**
     * One event for each subject only by current_uri instead of uri ordered ascendingly by popularity of the subject
     */
    LEAST_POPULAR_CURRENT_URI            = 26,
    /**
     * The last event of each different origin
     */
    MOST_RECENT_EVENT_ORIGIN             = 27,
    /**
     * The last event of each different origin, ordered by least recently used first
     */
    LEAST_RECENT_EVENT_ORIGIN            = 28,
    /**
     * The last event of each different origin ordered by the popularity of the origins
     */
    MOST_POPULAR_EVENT_ORIGIN            = 29,
    /**
     * The last event of each different origin, ordered ascendingly by the popularity of the origin
     */
    LEAST_POPULAR_EVENT_ORIGIN           = 30,
    /**
     * The last event of each different subject origin.
     */
    MOST_RECENT_CURRENT_ORIGIN           = 31,
    /**
     * The last event of each different subject origin, ordered by least recently used first
     */
    LEAST_RECENT_CURRENT_ORIGIN          = 32,
    /**
     * The last event of each different subject origin, ordered by the popularity of the origins
     */
    MOST_POPULAR_CURRENT_ORIGIN          = 33,
    /**
     * The last event of each different subject origin, ordered ascendingly by the popularity of the origin
     */
    LEAST_POPULAR_CURRENT_ORIGIN         = 34,
    /**
     * Only allowed on zeitgeist_index_search(). Events are sorted by query relevancy
     */
    RELEVANCY                            = 100;

    /**
     * @param result_type A {@link ResultType}
     *
     * @return true if the results for the given result_type will be sorted
     * ascendantly by date, false if they'll be sorted descendingly.
     */
    public static bool is_sort_order_asc (ResultType result_type)
    {
        switch (result_type)
        {
            // FIXME: Why are LEAST_POPULAR_* using ASC?
            case ResultType.LEAST_RECENT_EVENTS:
            case ResultType.LEAST_RECENT_EVENT_ORIGIN:
            case ResultType.LEAST_POPULAR_EVENT_ORIGIN:
            case ResultType.LEAST_RECENT_SUBJECTS:
            case ResultType.LEAST_POPULAR_SUBJECTS:
            case ResultType.LEAST_RECENT_CURRENT_URI:
            case ResultType.LEAST_POPULAR_CURRENT_URI:
            case ResultType.LEAST_RECENT_ACTOR:
            case ResultType.LEAST_POPULAR_ACTOR:
            case ResultType.OLDEST_ACTOR:
            case ResultType.LEAST_RECENT_ORIGIN:
            case ResultType.LEAST_POPULAR_ORIGIN:
            case ResultType.LEAST_RECENT_CURRENT_ORIGIN:
            case ResultType.LEAST_POPULAR_CURRENT_ORIGIN:
            case ResultType.LEAST_RECENT_SUBJECT_INTERPRETATION:
            case ResultType.LEAST_POPULAR_SUBJECT_INTERPRETATION:
            case ResultType.LEAST_RECENT_MIMETYPE:
            case ResultType.LEAST_POPULAR_MIMETYPE:
                return true;

            case ResultType.MOST_RECENT_EVENTS:
            case ResultType.MOST_RECENT_EVENT_ORIGIN:
            case ResultType.MOST_POPULAR_EVENT_ORIGIN:
            case ResultType.MOST_RECENT_SUBJECTS:
            case ResultType.MOST_POPULAR_SUBJECTS:
            case ResultType.MOST_RECENT_CURRENT_URI:
            case ResultType.MOST_POPULAR_CURRENT_URI:
            case ResultType.MOST_RECENT_ACTOR:
            case ResultType.MOST_POPULAR_ACTOR:
            case ResultType.MOST_RECENT_ORIGIN:
            case ResultType.MOST_POPULAR_ORIGIN:
            case ResultType.MOST_RECENT_CURRENT_ORIGIN:
            case ResultType.MOST_POPULAR_CURRENT_ORIGIN:
            case ResultType.MOST_RECENT_SUBJECT_INTERPRETATION:
            case ResultType.MOST_POPULAR_SUBJECT_INTERPRETATION:
            case ResultType.MOST_RECENT_MIMETYPE:
            case ResultType.MOST_POPULAR_MIMETYPE:
            case ResultType.RELEVANCY:
                return false;

            default:
                warning ("Unrecognized ResultType: %u", (uint) result_type);
                return true;
        }
    }
}

/*
 * An enumeration class used to define how query results should
 * be returned from the Zeitgeist engine.
 */
public enum RelevantResultType
{
    /**
     * All uris with the most recent uri first
     */
    RECENT  = 0,
    /**
     * All uris with the most related one first
     */
    RELATED = 1,
}

/**
 * Enumeration class defining the possible values for the storage
 * state of an event subject.
 *
 * The StorageState enumeration can be used to control whether or
 * not matched events must have their subjects available to the user.
 * Fx. not including deleted files, files on unplugged USB drives,
 * files available only when a network is available etc.
 */
public enum StorageState
{
    /**
     * The storage medium of the events subjects must not be available to the user
     */
    NOT_AVAILABLE   = 0,
    /**
     * The storage medium of all event subjects must be immediately available to the user
     */
    AVAILABLE       = 1,
    /**
     * The event subjects may or may not be available
     */
    ANY             = 2
}

}

// vim:expandtab:ts=4:sw=4