Debian Codegraph @

lib/packagekit-glib2/pk-enum.c

raw
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
2 *
3 * Copyright (C) 2007-2014 Richard Hughes <[email protected]>
4 *
5 * Licensed under the GNU Lesser General Public License Version 2.1
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 /**
23 * SECTION:pk-enum
24 * @title: Enumerations
25 * @short_description: Enumerations used in packagekit-glib2
26 *
27 * Enumerated values used in packagekit-glib2 and functions for using these.
28 */
29
30 #include "config.h"
31
32 #include <string.h>
33 #include <glib.h>
34 #include <glib/gi18n.h>
35
36 #include <packagekit-glib2/pk-common.h>
37 #include <packagekit-glib2/pk-enum.h>
38
39 static const PkEnumMatch enum_exit[] = {
40 {PK_EXIT_ENUM_UNKNOWN, "unknown"}, /* fall though value */
41 {PK_EXIT_ENUM_SUCCESS, "success"},
42 {PK_EXIT_ENUM_FAILED, "failed"},
43 {PK_EXIT_ENUM_CANCELLED, "cancelled"},
44 {PK_EXIT_ENUM_KEY_REQUIRED, "key-required"},
45 {PK_EXIT_ENUM_EULA_REQUIRED, "eula-required"},
46 {PK_EXIT_ENUM_MEDIA_CHANGE_REQUIRED, "media-change-required"},
47 {PK_EXIT_ENUM_KILLED, "killed"},
48 {PK_EXIT_ENUM_NEED_UNTRUSTED, "need-untrusted"},
49 {PK_EXIT_ENUM_CANCELLED_PRIORITY, "cancelled-priority"},
50 {PK_EXIT_ENUM_SKIP_TRANSACTION, "skip-transaction"},
51 {PK_EXIT_ENUM_REPAIR_REQUIRED, "repair-required"},
52 {0, NULL}
53 };
54
55 static const PkEnumMatch enum_status[] = {
56 {PK_STATUS_ENUM_UNKNOWN, "unknown"}, /* fall though value */
57 {PK_STATUS_ENUM_WAIT, "wait"},
58 {PK_STATUS_ENUM_SETUP, "setup"},
59 {PK_STATUS_ENUM_RUNNING, "running"},
60 {PK_STATUS_ENUM_QUERY, "query"},
61 {PK_STATUS_ENUM_INFO, "info"},
62 {PK_STATUS_ENUM_REFRESH_CACHE, "refresh-cache"},
63 {PK_STATUS_ENUM_REMOVE, "remove"},
64 {PK_STATUS_ENUM_DOWNLOAD, "download"},
65 {PK_STATUS_ENUM_INSTALL, "install"},
66 {PK_STATUS_ENUM_UPDATE, "update"},
67 {PK_STATUS_ENUM_CLEANUP, "cleanup"},
68 {PK_STATUS_ENUM_OBSOLETE, "obsolete"},
69 {PK_STATUS_ENUM_DEP_RESOLVE, "dep-resolve"},
70 {PK_STATUS_ENUM_SIG_CHECK, "sig-check"},
71 {PK_STATUS_ENUM_TEST_COMMIT, "test-commit"},
72 {PK_STATUS_ENUM_COMMIT, "commit"},
73 {PK_STATUS_ENUM_REQUEST, "request"},
74 {PK_STATUS_ENUM_FINISHED, "finished"},
75 {PK_STATUS_ENUM_CANCEL, "cancel"},
76 {PK_STATUS_ENUM_DOWNLOAD_REPOSITORY, "download-repository"},
77 {PK_STATUS_ENUM_DOWNLOAD_PACKAGELIST, "download-packagelist"},
78 {PK_STATUS_ENUM_DOWNLOAD_FILELIST, "download-filelist"},
79 {PK_STATUS_ENUM_DOWNLOAD_CHANGELOG, "download-changelog"},
80 {PK_STATUS_ENUM_DOWNLOAD_GROUP, "download-group"},
81 {PK_STATUS_ENUM_DOWNLOAD_UPDATEINFO, "download-updateinfo"},
82 {PK_STATUS_ENUM_REPACKAGING, "repackaging"},
83 {PK_STATUS_ENUM_LOADING_CACHE, "loading-cache"},
84 {PK_STATUS_ENUM_SCAN_APPLICATIONS, "scan-applications"},
85 {PK_STATUS_ENUM_GENERATE_PACKAGE_LIST, "generate-package-list"},
86 {PK_STATUS_ENUM_WAITING_FOR_LOCK, "waiting-for-lock"},
87 {PK_STATUS_ENUM_WAITING_FOR_AUTH, "waiting-for-auth"},
88 {PK_STATUS_ENUM_SCAN_PROCESS_LIST, "scan-process-list"},
89 {PK_STATUS_ENUM_CHECK_EXECUTABLE_FILES, "check-executable-files"},
90 {PK_STATUS_ENUM_CHECK_LIBRARIES, "check-libraries"},
91 {PK_STATUS_ENUM_COPY_FILES, "copy-files"},
92 {PK_STATUS_ENUM_RUN_HOOK, "run-hook"},
93 {0, NULL}
94 };
95
96 static const PkEnumMatch enum_role[] = {
97 {PK_ROLE_ENUM_UNKNOWN, "unknown"}, /* fall though value */
98 {PK_ROLE_ENUM_CANCEL, "cancel"},
99 {PK_ROLE_ENUM_DEPENDS_ON, "depends-on"},
100 {PK_ROLE_ENUM_GET_DETAILS, "get-details"},
101 {PK_ROLE_ENUM_GET_DETAILS_LOCAL, "get-details-local"},
102 {PK_ROLE_ENUM_GET_FILES_LOCAL, "get-files-local"},
103 {PK_ROLE_ENUM_GET_FILES, "get-files"},
104 {PK_ROLE_ENUM_GET_PACKAGES, "get-packages"},
105 {PK_ROLE_ENUM_GET_REPO_LIST, "get-repo-list"},
106 {PK_ROLE_ENUM_REQUIRED_BY, "required-by"},
107 {PK_ROLE_ENUM_GET_UPDATE_DETAIL, "get-update-detail"},
108 {PK_ROLE_ENUM_GET_UPDATES, "get-updates"},
109 {PK_ROLE_ENUM_INSTALL_FILES, "install-files"},
110 {PK_ROLE_ENUM_INSTALL_PACKAGES, "install-packages"},
111 {PK_ROLE_ENUM_INSTALL_SIGNATURE, "install-signature"},
112 {PK_ROLE_ENUM_REFRESH_CACHE, "refresh-cache"},
113 {PK_ROLE_ENUM_REMOVE_PACKAGES, "remove-packages"},
114 {PK_ROLE_ENUM_REPO_ENABLE, "repo-enable"},
115 {PK_ROLE_ENUM_REPO_SET_DATA, "repo-set-data"},
116 {PK_ROLE_ENUM_REPO_REMOVE, "repo-remove"},
117 {PK_ROLE_ENUM_RESOLVE, "resolve"},
118 {PK_ROLE_ENUM_SEARCH_DETAILS, "search-details"},
119 {PK_ROLE_ENUM_SEARCH_FILE, "search-file"},
120 {PK_ROLE_ENUM_SEARCH_GROUP, "search-group"},
121 {PK_ROLE_ENUM_SEARCH_NAME, "search-name"},
122 {PK_ROLE_ENUM_UPDATE_PACKAGES, "update-packages"},
123 {PK_ROLE_ENUM_WHAT_PROVIDES, "what-provides"},
124 {PK_ROLE_ENUM_ACCEPT_EULA, "accept-eula"},
125 {PK_ROLE_ENUM_DOWNLOAD_PACKAGES, "download-packages"},
126 {PK_ROLE_ENUM_GET_DISTRO_UPGRADES, "get-distro-upgrades"},
127 {PK_ROLE_ENUM_GET_CATEGORIES, "get-categories"},
128 {PK_ROLE_ENUM_GET_OLD_TRANSACTIONS, "get-old-transactions"},
129 {PK_ROLE_ENUM_REPAIR_SYSTEM, "repair-system"},
130 {PK_ROLE_ENUM_UPGRADE_SYSTEM, "upgrade-system"},
131 {0, NULL}
132 };
133
134 static const PkEnumMatch enum_error[] = {
135 {PK_ERROR_ENUM_UNKNOWN, "unknown"}, /* fall though value */
136 {PK_ERROR_ENUM_OOM, "out-of-memory"},
137 {PK_ERROR_ENUM_NO_CACHE, "no-cache"},
138 {PK_ERROR_ENUM_NO_NETWORK, "no-network"},
139 {PK_ERROR_ENUM_NOT_SUPPORTED, "not-supported"},
140 {PK_ERROR_ENUM_INTERNAL_ERROR, "internal-error"},
141 {PK_ERROR_ENUM_GPG_FAILURE, "gpg-failure"},
142 {PK_ERROR_ENUM_FILTER_INVALID, "filter-invalid"},
143 {PK_ERROR_ENUM_PACKAGE_ID_INVALID, "package-id-invalid"},
144 {PK_ERROR_ENUM_TRANSACTION_ERROR, "transaction-error"},
145 {PK_ERROR_ENUM_TRANSACTION_CANCELLED, "transaction-cancelled"},
146 {PK_ERROR_ENUM_PACKAGE_NOT_INSTALLED, "package-not-installed"},
147 {PK_ERROR_ENUM_PACKAGE_NOT_FOUND, "package-not-found"},
148 {PK_ERROR_ENUM_PACKAGE_ALREADY_INSTALLED, "package-already-installed"},
149 {PK_ERROR_ENUM_PACKAGE_DOWNLOAD_FAILED, "package-download-failed"},
150 {PK_ERROR_ENUM_GROUP_NOT_FOUND, "group-not-found"},
151 {PK_ERROR_ENUM_GROUP_LIST_INVALID, "group-list-invalid"},
152 {PK_ERROR_ENUM_DEP_RESOLUTION_FAILED, "dep-resolution-failed"},
153 {PK_ERROR_ENUM_CREATE_THREAD_FAILED, "create-thread-failed"},
154 {PK_ERROR_ENUM_REPO_NOT_FOUND, "repo-not-found"},
155 {PK_ERROR_ENUM_CANNOT_REMOVE_SYSTEM_PACKAGE, "cannot-remove-system-package"},
156 {PK_ERROR_ENUM_PROCESS_KILL, "process-kill"},
157 {PK_ERROR_ENUM_FAILED_INITIALIZATION, "failed-initialization"},
158 {PK_ERROR_ENUM_FAILED_FINALISE, "failed-finalise"},
159 {PK_ERROR_ENUM_FAILED_CONFIG_PARSING, "failed-config-parsing"},
160 {PK_ERROR_ENUM_CANNOT_CANCEL, "cannot-cancel"},
161 {PK_ERROR_ENUM_CANNOT_GET_LOCK, "cannot-get-lock"},
162 {PK_ERROR_ENUM_NO_PACKAGES_TO_UPDATE, "no-packages-to-update"},
163 {PK_ERROR_ENUM_CANNOT_WRITE_REPO_CONFIG, "cannot-write-repo-config"},
164 {PK_ERROR_ENUM_LOCAL_INSTALL_FAILED, "local-install-failed"},
165 {PK_ERROR_ENUM_BAD_GPG_SIGNATURE, "bad-gpg-signature"},
166 {PK_ERROR_ENUM_MISSING_GPG_SIGNATURE, "missing-gpg-signature"},
167 {PK_ERROR_ENUM_CANNOT_INSTALL_SOURCE_PACKAGE, "cannot-install-source-package"},
168 {PK_ERROR_ENUM_REPO_CONFIGURATION_ERROR, "repo-configuration-error"},
169 {PK_ERROR_ENUM_NO_LICENSE_AGREEMENT, "no-license-agreement"},
170 {PK_ERROR_ENUM_FILE_CONFLICTS, "file-conflicts"},
171 {PK_ERROR_ENUM_PACKAGE_CONFLICTS, "package-conflicts"},
172 {PK_ERROR_ENUM_REPO_NOT_AVAILABLE, "repo-not-available"},
173 {PK_ERROR_ENUM_INVALID_PACKAGE_FILE, "invalid-package-file"},
174 {PK_ERROR_ENUM_PACKAGE_INSTALL_BLOCKED, "package-install-blocked"},
175 {PK_ERROR_ENUM_PACKAGE_CORRUPT, "package-corrupt"},
176 {PK_ERROR_ENUM_ALL_PACKAGES_ALREADY_INSTALLED, "all-packages-already-installed"},
177 {PK_ERROR_ENUM_FILE_NOT_FOUND, "file-not-found"},
178 {PK_ERROR_ENUM_NO_MORE_MIRRORS_TO_TRY, "no-more-mirrors-to-try"},
179 {PK_ERROR_ENUM_NO_DISTRO_UPGRADE_DATA, "no-distro-upgrade-data"},
180 {PK_ERROR_ENUM_INCOMPATIBLE_ARCHITECTURE, "incompatible-architecture"},
181 {PK_ERROR_ENUM_NO_SPACE_ON_DEVICE, "no-space-on-device"},
182 {PK_ERROR_ENUM_MEDIA_CHANGE_REQUIRED, "media-change-required"},
183 {PK_ERROR_ENUM_NOT_AUTHORIZED, "not-authorized"},
184 {PK_ERROR_ENUM_UPDATE_NOT_FOUND, "update-not-found"},
185 {PK_ERROR_ENUM_CANNOT_INSTALL_REPO_UNSIGNED, "cannot-install-repo-unsigned"},
186 {PK_ERROR_ENUM_CANNOT_UPDATE_REPO_UNSIGNED, "cannot-update-repo-unsigned"},
187 {PK_ERROR_ENUM_CANNOT_GET_FILELIST, "cannot-get-filelist"},
188 {PK_ERROR_ENUM_CANNOT_GET_REQUIRES, "cannot-get-requires"},
189 {PK_ERROR_ENUM_CANNOT_DISABLE_REPOSITORY, "cannot-disable-repository"},
190 {PK_ERROR_ENUM_RESTRICTED_DOWNLOAD, "restricted-download"},
191 {PK_ERROR_ENUM_PACKAGE_FAILED_TO_CONFIGURE, "package-failed-to-configure"},
192 {PK_ERROR_ENUM_PACKAGE_FAILED_TO_BUILD, "package-failed-to-build"},
193 {PK_ERROR_ENUM_PACKAGE_FAILED_TO_INSTALL, "package-failed-to-install"},
194 {PK_ERROR_ENUM_PACKAGE_FAILED_TO_REMOVE, "package-failed-to-remove"},
195 {PK_ERROR_ENUM_UPDATE_FAILED_DUE_TO_RUNNING_PROCESS, "failed-due-to-running-process"},
196 {PK_ERROR_ENUM_PACKAGE_DATABASE_CHANGED, "package-database-changed"},
197 {PK_ERROR_ENUM_PROVIDE_TYPE_NOT_SUPPORTED, "provide-type-not-supported"},
198 {PK_ERROR_ENUM_INSTALL_ROOT_INVALID, "install-root-invalid"},
199 {PK_ERROR_ENUM_CANNOT_FETCH_SOURCES, "cannot-fetch-sources"},
200 {PK_ERROR_ENUM_CANCELLED_PRIORITY, "cancelled-priority"},
201 {PK_ERROR_ENUM_UNFINISHED_TRANSACTION, "unfinished-transaction"},
202 {PK_ERROR_ENUM_LOCK_REQUIRED, "lock-required"},
203 {PK_ERROR_ENUM_REPO_ALREADY_SET, "repo-already-set"},
204 {0, NULL}
205 };
206
207 static const PkEnumMatch enum_restart[] = {
208 {PK_RESTART_ENUM_UNKNOWN, "unknown"}, /* fall though value */
209 {PK_RESTART_ENUM_NONE, "none"},
210 {PK_RESTART_ENUM_SYSTEM, "system"},
211 {PK_RESTART_ENUM_SESSION, "session"},
212 {PK_RESTART_ENUM_APPLICATION, "application"},
213 {PK_RESTART_ENUM_SECURITY_SYSTEM, "security-system"},
214 {PK_RESTART_ENUM_SECURITY_SESSION, "security-session"},
215 {0, NULL}
216 };
217
218 static const PkEnumMatch enum_filter[] = {
219 {PK_FILTER_ENUM_UNKNOWN, "unknown"}, /* fall though value */
220 {PK_FILTER_ENUM_NONE, "none"},
221 {PK_FILTER_ENUM_INSTALLED, "installed"},
222 {PK_FILTER_ENUM_NOT_INSTALLED, "~installed"},
223 {PK_FILTER_ENUM_DEVELOPMENT, "devel"},
224 {PK_FILTER_ENUM_NOT_DEVELOPMENT, "~devel"},
225 {PK_FILTER_ENUM_GUI, "gui"},
226 {PK_FILTER_ENUM_NOT_GUI, "~gui"},
227 {PK_FILTER_ENUM_FREE, "free"},
228 {PK_FILTER_ENUM_NOT_FREE, "~free"},
229 {PK_FILTER_ENUM_VISIBLE, "visible"},
230 {PK_FILTER_ENUM_NOT_VISIBLE, "~visible"},
231 {PK_FILTER_ENUM_SUPPORTED, "supported"},
232 {PK_FILTER_ENUM_NOT_SUPPORTED, "~supported"},
233 {PK_FILTER_ENUM_BASENAME, "basename"},
234 {PK_FILTER_ENUM_NOT_BASENAME, "~basename"},
235 {PK_FILTER_ENUM_NEWEST, "newest"},
236 {PK_FILTER_ENUM_NOT_NEWEST, "~newest"},
237 {PK_FILTER_ENUM_ARCH, "arch"},
238 {PK_FILTER_ENUM_NOT_ARCH, "~arch"},
239 {PK_FILTER_ENUM_SOURCE, "source"},
240 {PK_FILTER_ENUM_NOT_SOURCE, "~source"},
241 {PK_FILTER_ENUM_COLLECTIONS, "collections"},
242 {PK_FILTER_ENUM_NOT_COLLECTIONS, "~collections"},
243 {PK_FILTER_ENUM_APPLICATION, "application"},
244 {PK_FILTER_ENUM_NOT_APPLICATION, "~application"},
245 {PK_FILTER_ENUM_DOWNLOADED, "downloaded"},
246 {PK_FILTER_ENUM_NOT_DOWNLOADED, "~downloaded"},
247 {0, NULL}
248 };
249
250 static const PkEnumMatch enum_group[] = {
251 {PK_GROUP_ENUM_UNKNOWN, "unknown"}, /* fall though value */
252 {PK_GROUP_ENUM_ACCESSIBILITY, "accessibility"},
253 {PK_GROUP_ENUM_ACCESSORIES, "accessories"},
254 {PK_GROUP_ENUM_EDUCATION, "education"},
255 {PK_GROUP_ENUM_GAMES, "games"},
256 {PK_GROUP_ENUM_GRAPHICS, "graphics"},
257 {PK_GROUP_ENUM_INTERNET, "internet"},
258 {PK_GROUP_ENUM_OFFICE, "office"},
259 {PK_GROUP_ENUM_OTHER, "other"},
260 {PK_GROUP_ENUM_PROGRAMMING, "programming"},
261 {PK_GROUP_ENUM_MULTIMEDIA, "multimedia"},
262 {PK_GROUP_ENUM_SYSTEM, "system"},
263 {PK_GROUP_ENUM_DESKTOP_GNOME, "desktop-gnome"},
264 {PK_GROUP_ENUM_DESKTOP_KDE, "desktop-kde"},
265 {PK_GROUP_ENUM_DESKTOP_XFCE, "desktop-xfce"},
266 {PK_GROUP_ENUM_DESKTOP_DDE, "desktop-dde"},
267 {PK_GROUP_ENUM_DESKTOP_OTHER, "desktop-other"},
268 {PK_GROUP_ENUM_PUBLISHING, "publishing"},
269 {PK_GROUP_ENUM_SERVERS, "servers"},
270 {PK_GROUP_ENUM_FONTS, "fonts"},
271 {PK_GROUP_ENUM_ADMIN_TOOLS, "admin-tools"},
272 {PK_GROUP_ENUM_LEGACY, "legacy"},
273 {PK_GROUP_ENUM_LOCALIZATION, "localization"},
274 {PK_GROUP_ENUM_VIRTUALIZATION, "virtualization"},
275 {PK_GROUP_ENUM_POWER_MANAGEMENT, "power-management"},
276 {PK_GROUP_ENUM_SECURITY, "security"},
277 {PK_GROUP_ENUM_COMMUNICATION, "communication"},
278 {PK_GROUP_ENUM_NETWORK, "network"},
279 {PK_GROUP_ENUM_MAPS, "maps"},
280 {PK_GROUP_ENUM_REPOS, "repos"},
281 {PK_GROUP_ENUM_SCIENCE, "science"},
282 {PK_GROUP_ENUM_DOCUMENTATION, "documentation"},
283 {PK_GROUP_ENUM_ELECTRONICS, "electronics"},
284 {PK_GROUP_ENUM_COLLECTIONS, "collections"},
285 {PK_GROUP_ENUM_VENDOR, "vendor"},
286 {PK_GROUP_ENUM_NEWEST, "newest"},
287 {0, NULL}
288 };
289
290 static const PkEnumMatch enum_update_state[] = {
291 {PK_UPDATE_STATE_ENUM_UNKNOWN, "unknown"}, /* fall though value */
292 {PK_UPDATE_STATE_ENUM_TESTING, "testing"},
293 {PK_UPDATE_STATE_ENUM_UNSTABLE, "unstable"},
294 {PK_UPDATE_STATE_ENUM_STABLE, "stable"},
295 {0, NULL}
296 };
297
298 static const PkEnumMatch enum_info[] = {
299 {PK_INFO_ENUM_UNKNOWN, "unknown"}, /* fall though value */
300 {PK_INFO_ENUM_INSTALLED, "installed"},
301 {PK_INFO_ENUM_AVAILABLE, "available"},
302 {PK_INFO_ENUM_UNAVAILABLE, "unavailable"},
303 {PK_INFO_ENUM_LOW, "low"},
304 {PK_INFO_ENUM_NORMAL, "normal"},
305 {PK_INFO_ENUM_IMPORTANT, "important"},
306 {PK_INFO_ENUM_SECURITY, "security"},
307 {PK_INFO_ENUM_BUGFIX, "bugfix"},
308 {PK_INFO_ENUM_ENHANCEMENT, "enhancement"},
309 {PK_INFO_ENUM_BLOCKED, "blocked"},
310 {PK_INFO_ENUM_DOWNLOADING, "downloading"},
311 {PK_INFO_ENUM_UPDATING, "updating"},
312 {PK_INFO_ENUM_INSTALLING, "installing"},
313 {PK_INFO_ENUM_REMOVING, "removing"},
314 {PK_INFO_ENUM_CLEANUP, "cleanup"},
315 {PK_INFO_ENUM_OBSOLETING, "obsoleting"},
316 {PK_INFO_ENUM_COLLECTION_INSTALLED, "collection-installed"},
317 {PK_INFO_ENUM_COLLECTION_AVAILABLE, "collection-available"},
318 {PK_INFO_ENUM_FINISHED, "finished"},
319 {PK_INFO_ENUM_REINSTALLING, "reinstalling"},
320 {PK_INFO_ENUM_DOWNGRADING, "downgrading"},
321 {PK_INFO_ENUM_PREPARING, "preparing"},
322 {PK_INFO_ENUM_DECOMPRESSING, "decompressing"},
323 {PK_INFO_ENUM_UNTRUSTED, "untrusted"},
324 {PK_INFO_ENUM_TRUSTED, "trusted"},
325 {PK_INFO_ENUM_CRITICAL, "critical"},
326 {PK_INFO_ENUM_INSTALL, "install"},
327 {PK_INFO_ENUM_REMOVE, "remove"},
328 {PK_INFO_ENUM_OBSOLETE, "obsolete"},
329 {PK_INFO_ENUM_DOWNGRADE, "downgrade"},
330 {0, NULL}
331 };
332
333 static const PkEnumMatch enum_sig_type[] = {
334 {PK_SIGTYPE_ENUM_UNKNOWN, "unknown"}, /* fall though value */
335 {PK_SIGTYPE_ENUM_GPG, "gpg"},
336 {0, NULL}
337 };
338
339 static const PkEnumMatch enum_upgrade[] = {
340 {PK_DISTRO_UPGRADE_ENUM_UNKNOWN, "unknown"}, /* fall though value */
341 {PK_DISTRO_UPGRADE_ENUM_STABLE, "stable"},
342 {PK_DISTRO_UPGRADE_ENUM_UNSTABLE, "unstable"},
343 {0, NULL}
344 };
345
346 static const PkEnumMatch enum_network[] = {
347 {PK_NETWORK_ENUM_UNKNOWN, "unknown"}, /* fall though value */
348 {PK_NETWORK_ENUM_OFFLINE, "offline"},
349 {PK_NETWORK_ENUM_ONLINE, "online"},
350 {PK_NETWORK_ENUM_WIRED, "wired"},
351 {PK_NETWORK_ENUM_WIFI, "wifi"},
352 {PK_NETWORK_ENUM_MOBILE, "mobile"},
353 {0, NULL}
354 };
355
356 static const PkEnumMatch enum_media_type[] = {
357 {PK_MEDIA_TYPE_ENUM_UNKNOWN, "unknown"}, /* fall though value */
358 {PK_MEDIA_TYPE_ENUM_CD, "cd"},
359 {PK_MEDIA_TYPE_ENUM_DVD, "dvd"},
360 {PK_MEDIA_TYPE_ENUM_DISC, "disc"},
361 {0, NULL}
362 };
363
364 static const PkEnumMatch enum_authorize_type[] = {
365 {PK_AUTHORIZE_ENUM_UNKNOWN, "unknown"}, /* fall though value */
366 {PK_AUTHORIZE_ENUM_YES, "yes"},
367 {PK_AUTHORIZE_ENUM_NO, "no"},
368 {PK_AUTHORIZE_ENUM_INTERACTIVE, "interactive"},
369 {0, NULL}
370 };
371
372 static const PkEnumMatch enum_upgrade_kind[] = {
373 {PK_UPGRADE_KIND_ENUM_UNKNOWN, "unknown"}, /* fall though value */
374 {PK_UPGRADE_KIND_ENUM_MINIMAL, "minimal"},
375 {PK_UPGRADE_KIND_ENUM_DEFAULT, "default"},
376 {PK_UPGRADE_KIND_ENUM_COMPLETE, "complete"},
377 {0, NULL}
378 };
379
380 static const PkEnumMatch enum_transaction_flag[] = {
381 {PK_TRANSACTION_FLAG_ENUM_NONE, "none"}, /* fall though value */
382 {PK_TRANSACTION_FLAG_ENUM_ONLY_TRUSTED, "only-trusted"},
383 {PK_TRANSACTION_FLAG_ENUM_SIMULATE, "simulate"},
384 {PK_TRANSACTION_FLAG_ENUM_ONLY_DOWNLOAD, "only-download"},
385 {PK_TRANSACTION_FLAG_ENUM_ALLOW_REINSTALL, "allow-reinstall"},
386 {PK_TRANSACTION_FLAG_ENUM_JUST_REINSTALL, "just-reinstall"},
387 {PK_TRANSACTION_FLAG_ENUM_ALLOW_DOWNGRADE, "allow-downgrade"},
388 {0, NULL}
389 };
390
391 /**
392 * pk_enum_find_value:
393 * @table: A #PkEnumMatch enum table of values
394 * @string: the string constant to search for, e.g. "desktop-gnome"
395 *
396 * Search for a string value in a table of constants.
397 *
398 * Return value: the enumerated constant value, e.g. PK_SIGTYPE_ENUM_GPG
399 */
400 guint
401 pk_enum_find_value (const PkEnumMatch *table, const gchar *string)
402 {
403 guint i;
404 const gchar *string_tmp;
405
406 /* return the first entry on non-found or error */
407 if (string == NULL) {
408 return table[0].value;
409 }
410 for (i = 0;;i++) {
411 string_tmp = table[i].string;
412 if (string_tmp == NULL)
413 break;
414 /* keep strcmp for speed */
415 if (strcmp (string, string_tmp) == 0)
416 return table[i].value;
417 }
418 return table[0].value;
419 }
420
421 /**
422 * pk_enum_find_string:
423 * @table: A #PkEnumMatch enum table of values
424 * @value: the enumerated constant value, e.g. PK_SIGTYPE_ENUM_GPG
425 *
426 * Search for a enum value in a table of constants.
427 *
428 * Return value: the string constant, e.g. "desktop-gnome"
429 */
430 const gchar *
431 pk_enum_find_string (const PkEnumMatch *table, guint value)
432 {
433 guint i;
434 guint tmp;
435 const gchar *string_tmp;
436
437 for (i = 0;;i++) {
438 string_tmp = table[i].string;
439 if (string_tmp == NULL)
440 break;
441 tmp = table[i].value;
442 if (tmp == value)
443 return table[i].string;
444 }
445 return table[0].string;
446 }
447
448 /**
449 * pk_sig_type_enum_from_string:
450 * @sig_type: Text describing the enumerated type
451 *
452 * Converts a text enumerated type to its unsigned integer representation
453 *
454 * Return value: the enumerated constant value, e.g. PK_SIGTYPE_ENUM_GPG
455 */
456 PkSigTypeEnum
457 pk_sig_type_enum_from_string (const gchar *sig_type)
458 {
459 return pk_enum_find_value (enum_sig_type, sig_type);
460 }
461
462 /**
463 * pk_sig_type_enum_to_string:
464 * @sig_type: The enumerated type value
465 *
466 * Converts a enumerated type to its text representation
467 *
468 * Return value: the enumerated constant value, e.g. "available"
469 *
470 * Since: 0.5.0
471 **/
472 const gchar *
473 pk_sig_type_enum_to_string (PkSigTypeEnum sig_type)
474 {
475 return pk_enum_find_string (enum_sig_type, sig_type);
476 }
477
478 /**
479 * pk_distro_upgrade_enum_from_string:
480 * @upgrade: Text describing the enumerated type
481 *
482 * Converts a text enumerated type to its unsigned integer representation
483 *
484 * Return value: the enumerated constant value, e.g. PK_DISTRO_UPGRADE_ENUM_STABLE
485 *
486 * Since: 0.5.0
487 **/
488 PkDistroUpgradeEnum
489 pk_distro_upgrade_enum_from_string (const gchar *upgrade)
490 {
491 return pk_enum_find_value (enum_upgrade, upgrade);
492 }
493
494 /**
495 * pk_distro_upgrade_enum_to_string:
496 * @upgrade: The enumerated type value
497 *
498 * Converts a enumerated type to its text representation
499 *
500 * Return value: the enumerated constant value, e.g. "stable"
501 *
502 * Since: 0.5.0
503 **/
504 const gchar *
505 pk_distro_upgrade_enum_to_string (PkDistroUpgradeEnum upgrade)
506 {
507 return pk_enum_find_string (enum_upgrade, upgrade);
508 }
509
510 /**
511 * pk_info_enum_from_string:
512 * @info: Text describing the enumerated type
513 *
514 * Converts a text enumerated type to its unsigned integer representation
515 *
516 * Return value: the enumerated constant value, e.g. PK_SIGTYPE_ENUM_GPG
517 *
518 * Since: 0.5.0
519 **/
520 PkInfoEnum
521 pk_info_enum_from_string (const gchar *info)
522 {
523 return pk_enum_find_value (enum_info, info);
524 }
525
526 /**
527 * pk_info_enum_to_string:
528 * @info: The enumerated type value
529 *
530 * Converts a enumerated type to its text representation
531 *
532 * Return value: the enumerated constant value, e.g. "available"
533 *
534 * Since: 0.5.0
535 **/
536 const gchar *
537 pk_info_enum_to_string (PkInfoEnum info)
538 {
539 return pk_enum_find_string (enum_info, info);
540 }
541
542 /**
543 * pk_exit_enum_from_string:
544 * @exit: Text describing the enumerated type
545 *
546 * Converts a text enumerated type to its unsigned integer representation
547 *
548 * Return value: the enumerated constant value, e.g. PK_SIGTYPE_ENUM_GPG
549 *
550 * Since: 0.5.0
551 **/
552 PkExitEnum
553 pk_exit_enum_from_string (const gchar *exit_text)
554 {
555 return pk_enum_find_value (enum_exit, exit_text);
556 }
557
558 /**
559 * pk_exit_enum_to_string:
560 * @exit: The enumerated type value
561 *
562 * Converts a enumerated type to its text representation
563 *
564 * Return value: the enumerated constant value, e.g. "available"
565 *
566 * Since: 0.5.0
567 **/
568 const gchar *
569 pk_exit_enum_to_string (PkExitEnum exit_enum)
570 {
571 return pk_enum_find_string (enum_exit, exit_enum);
572 }
573
574 /**
575 * pk_network_enum_from_string:
576 * @network: Text describing the enumerated type
577 *
578 * Converts a text enumerated type to its unsigned integer representation
579 *
580 * Return value: the enumerated constant value, e.g. PK_SIGTYPE_ENUM_GPG
581 *
582 * Since: 0.5.0
583 **/
584 PkNetworkEnum
585 pk_network_enum_from_string (const gchar *network)
586 {
587 return pk_enum_find_value (enum_network, network);
588 }
589
590 /**
591 * pk_network_enum_to_string:
592 * @network: The enumerated type value
593 *
594 * Converts a enumerated type to its text representation
595 *
596 * Return value: the enumerated constant value, e.g. "available"
597 *
598 * Since: 0.5.0
599 **/
600 const gchar *
601 pk_network_enum_to_string (PkNetworkEnum network)
602 {
603 return pk_enum_find_string (enum_network, network);
604 }
605
606 /**
607 * pk_status_enum_from_string:
608 * @status: Text describing the enumerated type
609 *
610 * Converts a text enumerated type to its unsigned integer representation
611 *
612 * Return value: the enumerated constant value, e.g. PK_SIGTYPE_ENUM_GPG
613 *
614 * Since: 0.5.0
615 **/
616 PkStatusEnum
617 pk_status_enum_from_string (const gchar *status)
618 {
619 return pk_enum_find_value (enum_status, status);
620 }
621
622 /**
623 * pk_status_enum_to_string:
624 * @status: The enumerated type value
625 *
626 * Converts a enumerated type to its text representation
627 *
628 * Return value: the enumerated constant value, e.g. "available"
629 *
630 * Since: 0.5.0
631 **/
632 const gchar *
633 pk_status_enum_to_string (PkStatusEnum status)
634 {
635 return pk_enum_find_string (enum_status, status);
636 }
637
638 /**
639 * pk_role_enum_from_string:
640 * @role: Text describing the enumerated type
641 *
642 * Converts a text enumerated type to its unsigned integer representation
643 *
644 * Return value: the enumerated constant value, e.g. PK_SIGTYPE_ENUM_GPG
645 *
646 * Since: 0.5.0
647 **/
648 PkRoleEnum
649 pk_role_enum_from_string (const gchar *role)
650 {
651 return pk_enum_find_value (enum_role, role);
652 }
653
654 /**
655 * pk_role_enum_to_string:
656 * @role: The enumerated type value
657 *
658 * Converts a enumerated type to its text representation
659 *
660 * Return value: the enumerated constant value, e.g. "available"
661 *
662 * Since: 0.5.0
663 **/
664 const gchar *
665 pk_role_enum_to_string (PkRoleEnum role)
666 {
667 return pk_enum_find_string (enum_role, role);
668 }
669
670 /**
671 * pk_error_enum_from_string:
672 * @code: Text describing the enumerated type
673 *
674 * Converts a text enumerated type to its unsigned integer representation
675 *
676 * Return value: the enumerated constant value, e.g. PK_SIGTYPE_ENUM_GPG
677 *
678 * Since: 0.5.0
679 **/
680 PkErrorEnum
681 pk_error_enum_from_string (const gchar *code)
682 {
683 return pk_enum_find_value (enum_error, code);
684 }
685
686 /**
687 * pk_error_enum_to_string:
688 * @code: The enumerated type value
689 *
690 * Converts a enumerated type to its text representation
691 *
692 * Return value: the enumerated constant value, e.g. "available"
693 *
694 * Since: 0.5.0
695 **/
696 const gchar *
697 pk_error_enum_to_string (PkErrorEnum code)
698 {
699 return pk_enum_find_string (enum_error, code);
700 }
701
702 /**
703 * pk_restart_enum_from_string:
704 * @restart: Text describing the enumerated type
705 *
706 * Converts a text enumerated type to its unsigned integer representation
707 *
708 * Return value: the enumerated constant value, e.g. PK_SIGTYPE_ENUM_GPG
709 *
710 * Since: 0.5.0
711 **/
712 PkRestartEnum
713 pk_restart_enum_from_string (const gchar *restart)
714 {
715 return pk_enum_find_value (enum_restart, restart);
716 }
717
718 /**
719 * pk_restart_enum_to_string:
720 * @restart: The enumerated type value
721 *
722 * Converts a enumerated type to its text representation
723 *
724 * Return value: the enumerated constant value, e.g. "available"
725 *
726 * Since: 0.5.0
727 **/
728 const gchar *
729 pk_restart_enum_to_string (PkRestartEnum restart)
730 {
731 return pk_enum_find_string (enum_restart, restart);
732 }
733
734 /**
735 * pk_group_enum_from_string:
736 * @group: Text describing the enumerated type
737 *
738 * Converts a text enumerated type to its unsigned integer representation
739 *
740 * Return value: the enumerated constant value, e.g. PK_SIGTYPE_ENUM_GPG
741 *
742 * Since: 0.5.0
743 **/
744 PkGroupEnum
745 pk_group_enum_from_string (const gchar *group)
746 {
747 return pk_enum_find_value (enum_group, group);
748 }
749
750 /**
751 * pk_group_enum_to_string:
752 * @group: The enumerated type value
753 *
754 * Converts a enumerated type to its text representation
755 *
756 * Return value: the enumerated constant value, e.g. "available"
757 *
758 * Since: 0.5.0
759 **/
760 const gchar *
761 pk_group_enum_to_string (PkGroupEnum group)
762 {
763 return pk_enum_find_string (enum_group, group);
764 }
765
766 /**
767 * pk_update_state_enum_from_string:
768 * @update_state: Text describing the enumerated type
769 *
770 * Converts a text enumerated type to its unsigned integer representation
771 *
772 * Return value: the enumerated constant value, e.g. %PK_UPDATE_STATE_ENUM_STABLE
773 *
774 * Since: 0.5.0
775 **/
776 PkUpdateStateEnum
777 pk_update_state_enum_from_string (const gchar *update_state)
778 {
779 return pk_enum_find_value (enum_update_state, update_state);
780 }
781
782 /**
783 * pk_update_state_enum_to_string:
784 * @update_state: The enumerated type value
785 *
786 * Converts a enumerated type to its text representation
787 *
788 * Return value: the enumerated constant value, e.g. "testing"
789 *
790 * Since: 0.5.0
791 **/
792 const gchar *
793 pk_update_state_enum_to_string (PkUpdateStateEnum update_state)
794 {
795 return pk_enum_find_string (enum_update_state, update_state);
796 }
797
798 /**
799 * pk_filter_enum_from_string:
800 * @filter: Text describing the enumerated type
801 *
802 * Converts a text enumerated type to its unsigned integer representation
803 *
804 * Return value: the enumerated constant value, e.g. PK_SIGTYPE_ENUM_GPG
805 *
806 * Since: 0.5.0
807 **/
808 PkFilterEnum
809 pk_filter_enum_from_string (const gchar *filter)
810 {
811 return pk_enum_find_value (enum_filter, filter);
812 }
813
814 /**
815 * pk_filter_enum_to_string:
816 * @filter: The enumerated type value
817 *
818 * Converts a enumerated type to its text representation
819 *
820 * Return value: the enumerated constant value, e.g. "available"
821 *
822 * Since: 0.5.0
823 **/
824 const gchar *
825 pk_filter_enum_to_string (PkFilterEnum filter)
826 {
827 return pk_enum_find_string (enum_filter, filter);
828 }
829
830 /**
831 * pk_media_type_enum_from_string:
832 * @media_type: Text describing the enumerated type
833 *
834 * Converts a text enumerated type to its unsigned integer representation
835 *
836 * Return value: the enumerated constant value, e.g. PK_MEDIA_TYPE_ENUM_CD
837 *
838 * Since: 0.5.0
839 **/
840 PkMediaTypeEnum
841 pk_media_type_enum_from_string (const gchar *media_type)
842 {
843 return pk_enum_find_value (enum_media_type, media_type);
844 }
845
846 /**
847 * pk_media_type_enum_to_string:
848 * @media_type: The enumerated type value
849 *
850 * Converts a enumerated type to its text representation
851 *
852 * Return value: the enumerated constant value, e.g. "dvd"
853 *
854 * Since: 0.5.0
855 **/
856 const gchar *
857 pk_media_type_enum_to_string (PkMediaTypeEnum media_type)
858 {
859 return pk_enum_find_string (enum_media_type, media_type);
860 }
861
862 /**
863 * pk_authorize_type_enum_from_string:
864 * @authorize_type: Text describing the enumerated type
865 *
866 * Converts a text enumerated type to its unsigned integer representation
867 *
868 * Return value: the enumerated constant value, e.g. %PK_AUTHORIZE_ENUM_YES
869 *
870 * Since: 0.5.0
871 **/
872 PkAuthorizeEnum
873 pk_authorize_type_enum_from_string (const gchar *authorize_type)
874 {
875 return pk_enum_find_value (enum_authorize_type, authorize_type);
876 }
877
878 /**
879 * pk_authorize_type_enum_to_string:
880 * @authorize_type: The enumerated type value
881 *
882 * Converts a enumerated type to its text representation
883 *
884 * Return value: the enumerated constant value, e.g. "yes"
885 *
886 * Since: 0.5.0
887 **/
888 const gchar *
889 pk_authorize_type_enum_to_string (PkAuthorizeEnum authorize_type)
890 {
891 return pk_enum_find_string (enum_authorize_type, authorize_type);
892 }
893
894 /**
895 * pk_upgrade_kind_enum_from_string:
896 * @upgrade_kind: Text describing the enumerated type
897 *
898 * Converts a text enumerated type to its unsigned integer representation
899 *
900 * Return value: the enumerated constant value, e.g. %PK_UPGRADE_KIND_ENUM_MINIMAL
901 *
902 * Since: 0.6.11
903 **/
904 PkUpgradeKindEnum
905 pk_upgrade_kind_enum_from_string (const gchar *upgrade_kind)
906 {
907 return pk_enum_find_value (enum_upgrade_kind, upgrade_kind);
908 }
909
910 /**
911 * pk_upgrade_kind_enum_to_string:
912 * @upgrade_kind: The enumerated type value
913 *
914 * Converts a enumerated type to its text representation
915 *
916 * Return value: the enumerated constant value, e.g. "minimal"
917 *
918 * Since: 0.6.11
919 **/
920 const gchar *
921 pk_upgrade_kind_enum_to_string (PkUpgradeKindEnum upgrade_kind)
922 {
923 return pk_enum_find_string (enum_upgrade_kind, upgrade_kind);
924 }
925
926 /**
927 * pk_transaction_flag_enum_from_string:
928 * @transaction_flag: Text describing the enumerated type
929 *
930 * Converts a text enumerated type to its unsigned integer representation
931 *
932 * Return value: the enumerated constant value, e.g. %PK_TRANSACTION_FLAG_ENUM_SIMULATE
933 *
934 * Since: 0.8.1
935 **/
936 PkTransactionFlagEnum
937 pk_transaction_flag_enum_from_string (const gchar *transaction_flag)
938 {
939 return pk_enum_find_value (enum_transaction_flag, transaction_flag);
940 }
941
942 /**
943 * pk_transaction_flag_enum_to_string:
944 * @transaction_flag: The enumerated type value
945 *
946 * Converts a enumerated type to its text representation
947 *
948 * Return value: the enumerated constant value, e.g. "simulate"
949 *
950 * Since: 0.8.1
951 **/
952 const gchar *
953 pk_transaction_flag_enum_to_string (PkTransactionFlagEnum transaction_flag)
954 {
955 return pk_enum_find_string (enum_transaction_flag, transaction_flag);
956 }
957
958 /**
959 * pk_info_enum_to_localised_text:
960 * @info: The enumerated type value
961 *
962 * Converts a enumerated type to its localized description
963 *
964 * Return Value: the translated text
965 *
966 * Since: 0.7.2
967 **/
968 static const gchar *
969 pk_info_enum_to_localised_text (PkInfoEnum info)
970 {
971 const gchar *text = NULL;
972 switch (info) {
973 case PK_INFO_ENUM_LOW:
974 /* TRANSLATORS: The type of update */
975 text = _("Trivial");
976 break;
977 case PK_INFO_ENUM_NORMAL:
978 /* TRANSLATORS: The type of update */
979 text = dgettext("PackageKit", "Normal");
980 break;
981 case PK_INFO_ENUM_IMPORTANT:
982 /* TRANSLATORS: The type of update */
983 text = dgettext("PackageKit", "Important");
984 break;
985 case PK_INFO_ENUM_SECURITY:
986 /* TRANSLATORS: The type of update */
987 text = dgettext("PackageKit", "Security");
988 break;
989 case PK_INFO_ENUM_BUGFIX:
990 /* TRANSLATORS: The type of update */
991 text = dgettext("PackageKit", "Bug fix");
992 break;
993 case PK_INFO_ENUM_ENHANCEMENT:
994 /* TRANSLATORS: The type of update */
995 text = dgettext("PackageKit", "Enhancement");
996 break;
997 case PK_INFO_ENUM_BLOCKED:
998 /* TRANSLATORS: The type of update */
999 text = dgettext("PackageKit", "Blocked");
1000 break;
1001 case PK_INFO_ENUM_INSTALLED:
1002 case PK_INFO_ENUM_COLLECTION_INSTALLED:
1003 /* TRANSLATORS: The state of a package */
1004 text = dgettext("PackageKit", "Installed");
1005 break;
1006 case PK_INFO_ENUM_AVAILABLE:
1007 case PK_INFO_ENUM_COLLECTION_AVAILABLE:
1008 /* TRANSLATORS: The state of a package, i.e. not installed */
1009 text = dgettext("PackageKit", "Available");
1010 break;
1011 case PK_INFO_ENUM_UNAVAILABLE:
1012 /* TRANSLATORS: The state of a package, i.e. not installed */
1013 text = dgettext("PackageKit", "Unavailable");
1014 break;
1015 case PK_INFO_ENUM_INSTALL:
1016 /* TRANSLATORS: The state of a package: to be installed with the next action */
1017 text = dgettext("PackageKit", "Install");
1018 break;
1019 case PK_INFO_ENUM_REMOVE:
1020 /* TRANSLATORS: The state of a package: to be removed with the next action */
1021 text = dgettext("PackageKit", "Remove");
1022 break;
1023 case PK_INFO_ENUM_OBSOLETE:
1024 /* TRANSLATORS: The state of a package: package is obsolete */
1025 text = dgettext("PackageKit", "Obsolete");
1026 break;
1027 case PK_INFO_ENUM_DOWNGRADE:
1028 /* TRANSLATORS: The state of a package: package is to be downgraded */
1029 text = dgettext("PackageKit", "Downgrade");
1030 break;
1031 default:
1032 g_warning ("info unrecognised: %s", pk_info_enum_to_string (info));
1033 }
1034 return text;
1035 }
1036
1037 /**
1038 * pk_info_enum_to_localised_present:
1039 * @info: The enumerated type value
1040 *
1041 * Converts a enumerated type to its localized description
1042 *
1043 * Return Value: the translated text
1044 *
1045 * Since: 0.7.2
1046 **/
1047 const gchar *
1048 pk_info_enum_to_localised_present (PkInfoEnum info)
1049 {
1050 const gchar *text = NULL;
1051 switch (info) {
1052 case PK_INFO_ENUM_DOWNLOADING:
1053 /* TRANSLATORS: The action of the package, in present tense */
1054 text = dgettext("PackageKit", "Downloading");
1055 break;
1056 case PK_INFO_ENUM_UPDATING:
1057 /* TRANSLATORS: The action of the package, in present tense */
1058 text = dgettext("PackageKit", "Updating");
1059 break;
1060 case PK_INFO_ENUM_INSTALLING:
1061 /* TRANSLATORS: The action of the package, in present tense */
1062 text = dgettext("PackageKit", "Installing");
1063 break;
1064 case PK_INFO_ENUM_REMOVING:
1065 /* TRANSLATORS: The action of the package, in present tense */
1066 text = dgettext("PackageKit", "Removing");
1067 break;
1068 case PK_INFO_ENUM_CLEANUP:
1069 /* TRANSLATORS: The action of the package, in present tense */
1070 text = dgettext("PackageKit", "Cleaning up");
1071 break;
1072 case PK_INFO_ENUM_OBSOLETING:
1073 /* TRANSLATORS: The action of the package, in present tense */
1074 text = dgettext("PackageKit", "Obsoleting");
1075 break;
1076 case PK_INFO_ENUM_REINSTALLING:
1077 /* TRANSLATORS: The action of the package, in present tense */
1078 text = dgettext("PackageKit", "Reinstalling");
1079 break;
1080 default:
1081 text = pk_info_enum_to_localised_text (info);
1082 }
1083 return text;
1084 }
1085
1086 /**
1087 * pk_info_enum_to_localised_past:
1088 * @info: The enumerated type value
1089 *
1090 * Converts a enumerated type to its localized description
1091 *
1092 * Return Value: the translated text
1093 *
1094 * Since: 0.7.2
1095 **/
1096 const gchar *
1097 pk_info_enum_to_localised_past (PkInfoEnum info)
1098 {
1099 const gchar *text = NULL;
1100 switch (info) {
1101 case PK_INFO_ENUM_DOWNLOADING:
1102 /* TRANSLATORS: The action of the package, in past tense */
1103 text = dgettext("PackageKit", "Downloaded");
1104 break;
1105 case PK_INFO_ENUM_UPDATING:
1106 /* TRANSLATORS: The action of the package, in past tense */
1107 text = dgettext("PackageKit", "Updated");
1108 break;
1109 case PK_INFO_ENUM_INSTALLING:
1110 /* TRANSLATORS: The action of the package, in past tense */
1111 text = dgettext("PackageKit", "Installed");
1112 break;
1113 case PK_INFO_ENUM_REMOVING:
1114 /* TRANSLATORS: The action of the package, in past tense */
1115 text = dgettext("PackageKit", "Removed");
1116 break;
1117 case PK_INFO_ENUM_CLEANUP:
1118 /* TRANSLATORS: The action of the package, in past tense */
1119 text = dgettext("PackageKit", "Cleaned up");
1120 break;
1121 case PK_INFO_ENUM_OBSOLETING:
1122 /* TRANSLATORS: The action of the package, in past tense */
1123 text = dgettext("PackageKit", "Obsoleted");
1124 break;
1125 case PK_INFO_ENUM_REINSTALLING:
1126 /* TRANSLATORS: The action of the package, in past tense */
1127 text = dgettext("PackageKit", "Reinstalled");
1128 break;
1129 default:
1130 text = pk_info_enum_to_localised_text (info);
1131 }
1132 return text;
1133 }
1134
1135 /**
1136 * pk_role_enum_to_localised_present:
1137 * @role: The enumerated type value
1138 *
1139 * Converts a enumerated type to its localized description
1140 *
1141 * Return Value: the translated text
1142 *
1143 * Since: 0.7.2
1144 **/
1145 const gchar *
1146 pk_role_enum_to_localised_present (PkRoleEnum role)
1147 {
1148 const gchar *text = NULL;
1149 switch (role) {
1150 case PK_ROLE_ENUM_UNKNOWN:
1151 /* TRANSLATORS: The role of the transaction, in present tense */
1152 text = dgettext("PackageKit", "Unknown role type");
1153 break;
1154 case PK_ROLE_ENUM_DEPENDS_ON:
1155 /* TRANSLATORS: The role of the transaction, in present tense */
1156 text = dgettext("PackageKit", "Getting dependencies");
1157 break;
1158 case PK_ROLE_ENUM_GET_UPDATE_DETAIL:
1159 /* TRANSLATORS: The role of the transaction, in present tense */
1160 text = dgettext("PackageKit", "Getting update details");
1161 break;
1162 case PK_ROLE_ENUM_GET_DETAILS:
1163 case PK_ROLE_ENUM_GET_DETAILS_LOCAL:
1164 /* TRANSLATORS: The role of the transaction, in present tense */
1165 text = dgettext("PackageKit", "Getting details");
1166 break;
1167 case PK_ROLE_ENUM_REQUIRED_BY:
1168 /* TRANSLATORS: The role of the transaction, in present tense */
1169 text = dgettext("PackageKit", "Getting requires");
1170 break;
1171 case PK_ROLE_ENUM_GET_UPDATES:
1172 /* TRANSLATORS: The role of the transaction, in present tense */
1173 text = dgettext("PackageKit", "Getting updates");
1174 break;
1175 case PK_ROLE_ENUM_SEARCH_DETAILS:
1176 /* TRANSLATORS: The role of the transaction, in present tense */
1177 text = dgettext("PackageKit", "Searching by details");
1178 break;
1179 case PK_ROLE_ENUM_SEARCH_FILE:
1180 /* TRANSLATORS: The role of the transaction, in present tense */
1181 text = dgettext("PackageKit", "Searching by file");
1182 break;
1183 case PK_ROLE_ENUM_SEARCH_GROUP:
1184 /* TRANSLATORS: The role of the transaction, in present tense */
1185 text = dgettext("PackageKit", "Searching groups");
1186 break;
1187 case PK_ROLE_ENUM_SEARCH_NAME:
1188 /* TRANSLATORS: The role of the transaction, in present tense */
1189 text = dgettext("PackageKit", "Searching by name");
1190 break;
1191 case PK_ROLE_ENUM_REMOVE_PACKAGES:
1192 /* TRANSLATORS: The role of the transaction, in present tense */
1193 text = dgettext("PackageKit", "Removing");
1194 break;
1195 case PK_ROLE_ENUM_INSTALL_PACKAGES:
1196 /* TRANSLATORS: The role of the transaction, in present tense */
1197 text = dgettext("PackageKit", "Installing");
1198 break;
1199 case PK_ROLE_ENUM_INSTALL_FILES:
1200 /* TRANSLATORS: The role of the transaction, in present tense */
1201 text = dgettext("PackageKit", "Installing files");
1202 break;
1203 case PK_ROLE_ENUM_REFRESH_CACHE:
1204 /* TRANSLATORS: The role of the transaction, in present tense */
1205 text = dgettext("PackageKit", "Refreshing cache");
1206 break;
1207 case PK_ROLE_ENUM_UPDATE_PACKAGES:
1208 /* TRANSLATORS: The role of the transaction, in present tense */
1209 text = dgettext("PackageKit", "Updating packages");
1210 break;
1211 case PK_ROLE_ENUM_CANCEL:
1212 /* TRANSLATORS: The role of the transaction, in present tense */
1213 text = dgettext("PackageKit", "Canceling");
1214 break;
1215 case PK_ROLE_ENUM_GET_REPO_LIST:
1216 /* TRANSLATORS: The role of the transaction, in present tense */
1217 text = dgettext("PackageKit", "Getting repositories");
1218 break;
1219 case PK_ROLE_ENUM_REPO_ENABLE:
1220 /* TRANSLATORS: The role of the transaction, in present tense */
1221 text = dgettext("PackageKit", "Modifying repository");
1222 break;
1223 case PK_ROLE_ENUM_REPO_SET_DATA:
1224 /* TRANSLATORS: The role of the transaction, in present tense */
1225 text = dgettext("PackageKit", "Setting data");
1226 break;
1227 case PK_ROLE_ENUM_REPO_REMOVE:
1228 /* TRANSLATORS: The role of the transaction, in present tense */
1229 text = dgettext("PackageKit", "Removing repository");
1230 break;
1231 case PK_ROLE_ENUM_RESOLVE:
1232 /* TRANSLATORS: The role of the transaction, in present tense */
1233 text = dgettext("PackageKit", "Resolving");
1234 break;
1235 case PK_ROLE_ENUM_GET_FILES:
1236 case PK_ROLE_ENUM_GET_FILES_LOCAL:
1237 /* TRANSLATORS: The role of the transaction, in present tense */
1238 text = dgettext("PackageKit", "Getting file list");
1239 break;
1240 case PK_ROLE_ENUM_WHAT_PROVIDES:
1241 /* TRANSLATORS: The role of the transaction, in present tense */
1242 text = dgettext("PackageKit", "Getting provides");
1243 break;
1244 case PK_ROLE_ENUM_INSTALL_SIGNATURE:
1245 /* TRANSLATORS: The role of the transaction, in present tense */
1246 text = dgettext("PackageKit", "Installing signature");
1247 break;
1248 case PK_ROLE_ENUM_GET_PACKAGES:
1249 /* TRANSLATORS: The role of the transaction, in present tense */
1250 text = dgettext("PackageKit", "Getting packages");
1251 break;
1252 case PK_ROLE_ENUM_ACCEPT_EULA:
1253 /* TRANSLATORS: The role of the transaction, in present tense */
1254 text = dgettext("PackageKit", "Accepting EULA");
1255 break;
1256 case PK_ROLE_ENUM_DOWNLOAD_PACKAGES:
1257 /* TRANSLATORS: The role of the transaction, in present tense */
1258 text = dgettext("PackageKit", "Downloading packages");
1259 break;
1260 case PK_ROLE_ENUM_GET_DISTRO_UPGRADES:
1261 /* TRANSLATORS: The role of the transaction, in present tense */
1262 text = dgettext("PackageKit", "Getting upgrades");
1263 break;
1264 case PK_ROLE_ENUM_GET_CATEGORIES:
1265 /* TRANSLATORS: The role of the transaction, in present tense */
1266 text = dgettext("PackageKit", "Getting categories");
1267 break;
1268 case PK_ROLE_ENUM_GET_OLD_TRANSACTIONS:
1269 /* TRANSLATORS: The role of the transaction, in present tense */
1270 text = dgettext("PackageKit", "Getting transactions");
1271 break;
1272 case PK_ROLE_ENUM_UPGRADE_SYSTEM:
1273 /* TRANSLATORS: The role of the transaction, in present tense */
1274 text = dgettext("PackageKit", "Getting system upgrades");
1275 break;
1276 case PK_ROLE_ENUM_REPAIR_SYSTEM:
1277 /* TRANSLATORS: The role of the transaction, in present tense */
1278 text = dgettext("PackageKit", "Repairing system");
1279 break;
1280 default:
1281 g_warning ("role unrecognised: %s", pk_role_enum_to_string (role));
1282 }
1283 return text;
1284 }