| 1 |
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- |
| 2 |
* |
| 3 |
* Copyright (C) 2009 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 |
#if !defined (__PACKAGEKIT_H_INSIDE__) && !defined (PK_COMPILATION) |
| 23 |
#error "Only <packagekit.h> can be included directly." |
| 24 |
#endif |
| 25 |
|
| 26 |
#ifndef __PK_TASK_H |
| 27 |
#define __PK_TASK_H |
| 28 |
|
| 29 |
#include <glib-object.h> |
| 30 |
#include <gio/gio.h> |
| 31 |
|
| 32 |
#include <packagekit-glib2/pk-progress.h> |
| 33 |
#include <packagekit-glib2/pk-results.h> |
| 34 |
#include <packagekit-glib2/pk-client.h> |
| 35 |
|
| 36 |
G_BEGIN_DECLS |
| 37 |
|
| 38 |
#define PK_TYPE_TASK (pk_task_get_type ()) |
| 39 |
#define PK_TASK(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PK_TYPE_TASK, PkTask)) |
| 40 |
#define PK_TASK_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PK_TYPE_TASK, PkTaskClass)) |
| 41 |
#define PK_IS_TASK(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PK_TYPE_TASK)) |
| 42 |
#define PK_IS_TASK_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PK_TYPE_TASK)) |
| 43 |
#define PK_TASK_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PK_TYPE_TASK, PkTaskClass)) |
| 44 |
#define PK_TASK_TYPE_ERROR (pk_task_error_get_type ()) |
| 45 |
|
| 46 |
typedef struct _PkTaskPrivate PkTaskPrivate; |
| 47 |
typedef struct _PkTask PkTask; |
| 48 |
typedef struct _PkTaskClass PkTaskClass; |
| 49 |
|
| 50 |
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC |
| 51 |
G_DEFINE_AUTOPTR_CLEANUP_FUNC(PkTask, g_object_unref) |
| 52 |
#endif |
| 53 |
|
| 54 |
struct _PkTask |
| 55 |
{ |
| 56 |
PkClient parent; |
| 57 |
PkTaskPrivate *priv; |
| 58 |
}; |
| 59 |
|
| 60 |
struct _PkTaskClass |
| 61 |
{ |
| 62 |
PkClientClass parent_class; |
| 63 |
void (*untrusted_question) (PkTask *task, |
| 64 |
guint request, |
| 65 |
PkResults *results); |
| 66 |
void (*key_question) (PkTask *task, |
| 67 |
guint request, |
| 68 |
PkResults *results); |
| 69 |
void (*eula_question) (PkTask *task, |
| 70 |
guint request, |
| 71 |
PkResults *results); |
| 72 |
void (*media_change_question) (PkTask *task, |
| 73 |
guint request, |
| 74 |
PkResults *results); |
| 75 |
void (*simulate_question) (PkTask *task, |
| 76 |
guint request, |
| 77 |
PkResults *results); |
| 78 |
void (*repair_question) (PkTask *task, |
| 79 |
guint request, |
| 80 |
PkResults *results); |
| 81 |
/* padding for future expansion */ |
| 82 |
void (*_pk_reserved1) (void); |
| 83 |
void (*_pk_reserved2) (void); |
| 84 |
void (*_pk_reserved3) (void); |
| 85 |
void (*_pk_reserved4) (void); |
| 86 |
}; |
| 87 |
|
| 88 |
GType pk_task_get_type (void); |
| 89 |
PkTask *pk_task_new (void); |
| 90 |
|
| 91 |
PkResults *pk_task_generic_finish (PkTask *task, |
| 92 |
GAsyncResult *res, |
| 93 |
GError **error); |
| 94 |
|
| 95 |
void pk_task_install_packages_async (PkTask *task, |
| 96 |
gchar **package_ids, |
| 97 |
GCancellable *cancellable, |
| 98 |
PkProgressCallback progress_callback, |
| 99 |
gpointer progress_user_data, |
| 100 |
GAsyncReadyCallback callback_ready, |
| 101 |
gpointer user_data); |
| 102 |
void pk_task_update_packages_async (PkTask *task, |
| 103 |
gchar **package_ids, |
| 104 |
GCancellable *cancellable, |
| 105 |
PkProgressCallback progress_callback, |
| 106 |
gpointer progress_user_data, |
| 107 |
GAsyncReadyCallback callback_ready, |
| 108 |
gpointer user_data); |
| 109 |
void pk_task_remove_packages_async (PkTask *task, |
| 110 |
gchar **package_ids, |
| 111 |
gboolean allow_deps, |
| 112 |
gboolean autoremove, |
| 113 |
GCancellable *cancellable, |
| 114 |
PkProgressCallback progress_callback, |
| 115 |
gpointer progress_user_data, |
| 116 |
GAsyncReadyCallback callback_ready, |
| 117 |
gpointer user_data); |
| 118 |
void pk_task_install_files_async (PkTask *task, |
| 119 |
gchar **files, |
| 120 |
GCancellable *cancellable, |
| 121 |
PkProgressCallback progress_callback, |
| 122 |
gpointer progress_user_data, |
| 123 |
GAsyncReadyCallback callback_ready, |
| 124 |
gpointer user_data); |
| 125 |
void pk_task_resolve_async (PkTask *task, |
| 126 |
PkBitfield filters, |
| 127 |
gchar **packages, |
| 128 |
GCancellable *cancellable, |
| 129 |
PkProgressCallback progress_callback, |
| 130 |
gpointer progress_user_data, |
| 131 |
GAsyncReadyCallback callback_ready, |
| 132 |
gpointer user_data); |
| 133 |
void pk_task_search_names_async (PkTask *task, |
| 134 |
PkBitfield filters, |
| 135 |
gchar **values, |
| 136 |
GCancellable *cancellable, |
| 137 |
PkProgressCallback progress_callback, |
| 138 |
gpointer progress_user_data, |
| 139 |
GAsyncReadyCallback callback_ready, |
| 140 |
gpointer user_data); |
| 141 |
void pk_task_search_details_async (PkTask *task, |
| 142 |
PkBitfield filters, |
| 143 |
gchar **values, |
| 144 |
GCancellable *cancellable, |
| 145 |
PkProgressCallback progress_callback, |
| 146 |
gpointer progress_user_data, |
| 147 |
GAsyncReadyCallback callback_ready, |
| 148 |
gpointer user_data); |
| 149 |
void pk_task_search_groups_async (PkTask *task, |
| 150 |
PkBitfield filters, |
| 151 |
gchar **values, |
| 152 |
GCancellable *cancellable, |
| 153 |
PkProgressCallback progress_callback, |
| 154 |
gpointer progress_user_data, |
| 155 |
GAsyncReadyCallback callback_ready, |
| 156 |
gpointer user_data); |
| 157 |
void pk_task_search_files_async (PkTask *task, |
| 158 |
PkBitfield filters, |
| 159 |
gchar **values, |
| 160 |
GCancellable *cancellable, |
| 161 |
PkProgressCallback progress_callback, |
| 162 |
gpointer progress_user_data, |
| 163 |
GAsyncReadyCallback callback_ready, |
| 164 |
gpointer user_data); |
| 165 |
void pk_task_get_details_async (PkTask *task, |
| 166 |
gchar **package_ids, |
| 167 |
GCancellable *cancellable, |
| 168 |
PkProgressCallback progress_callback, |
| 169 |
gpointer progress_user_data, |
| 170 |
GAsyncReadyCallback callback_ready, |
| 171 |
gpointer user_data); |
| 172 |
void pk_task_get_update_detail_async (PkTask *task, |
| 173 |
gchar **package_ids, |
| 174 |
GCancellable *cancellable, |
| 175 |
PkProgressCallback progress_callback, |
| 176 |
gpointer progress_user_data, |
| 177 |
GAsyncReadyCallback callback_ready, |
| 178 |
gpointer user_data); |
| 179 |
void pk_task_download_packages_async (PkTask *task, |
| 180 |
gchar **package_ids, |
| 181 |
const gchar *directory, |
| 182 |
GCancellable *cancellable, |
| 183 |
PkProgressCallback progress_callback, |
| 184 |
gpointer progress_user_data, |
| 185 |
GAsyncReadyCallback callback_ready, |
| 186 |
gpointer user_data); |
| 187 |
void pk_task_get_updates_async (PkTask *task, |
| 188 |
PkBitfield filters, |
| 189 |
GCancellable *cancellable, |
| 190 |
PkProgressCallback progress_callback, |
| 191 |
gpointer progress_user_data, |
| 192 |
GAsyncReadyCallback callback_ready, |
| 193 |
gpointer user_data); |
| 194 |
void pk_task_depends_on_async (PkTask *task, |
| 195 |
PkBitfield filters, |
| 196 |
gchar **package_ids, |
| 197 |
gboolean recursive, |
| 198 |
GCancellable *cancellable, |
| 199 |
PkProgressCallback progress_callback, |
| 200 |
gpointer progress_user_data, |
| 201 |
GAsyncReadyCallback callback_ready, |
| 202 |
gpointer user_data); |
| 203 |
void pk_task_get_packages_async (PkTask *task, |
| 204 |
PkBitfield filters, |
| 205 |
GCancellable *cancellable, |
| 206 |
PkProgressCallback progress_callback, |
| 207 |
gpointer progress_user_data, |
| 208 |
GAsyncReadyCallback callback_ready, |
| 209 |
gpointer user_data); |
| 210 |
void pk_task_required_by_async (PkTask *task, |
| 211 |
PkBitfield filters, |
| 212 |
gchar **package_ids, |
| 213 |
gboolean recursive, |
| 214 |
GCancellable *cancellable, |
| 215 |
PkProgressCallback progress_callback, |
| 216 |
gpointer progress_user_data, |
| 217 |
GAsyncReadyCallback callback_ready, |
| 218 |
gpointer user_data); |
| 219 |
void pk_task_what_provides_async (PkTask *task, |
| 220 |
PkBitfield filters, |
| 221 |
gchar **values, |
| 222 |
GCancellable *cancellable, |
| 223 |
PkProgressCallback progress_callback, |
| 224 |
gpointer progress_user_data, |
| 225 |
GAsyncReadyCallback callback_ready, |
| 226 |
gpointer user_data); |
| 227 |
void pk_task_get_files_async (PkTask *task, |
| 228 |
gchar **package_ids, |
| 229 |
GCancellable *cancellable, |
| 230 |
PkProgressCallback progress_callback, |
| 231 |
gpointer progress_user_data, |
| 232 |
GAsyncReadyCallback callback_ready, |
| 233 |
gpointer user_data); |
| 234 |
void pk_task_get_categories_async (PkTask *task, |
| 235 |
GCancellable *cancellable, |
| 236 |
PkProgressCallback progress_callback, |
| 237 |
gpointer progress_user_data, |
| 238 |
GAsyncReadyCallback callback_ready, |
| 239 |
gpointer user_data); |
| 240 |
void pk_task_refresh_cache_async (PkTask *task, |
| 241 |
gboolean force, |
| 242 |
GCancellable *cancellable, |
| 243 |
PkProgressCallback progress_callback, |
| 244 |
gpointer progress_user_data, |
| 245 |
GAsyncReadyCallback callback_ready, |
| 246 |
gpointer user_data); |
| 247 |
void pk_task_get_repo_list_async (PkTask *task, |
| 248 |
PkBitfield filters, |
| 249 |
GCancellable *cancellable, |
| 250 |
PkProgressCallback progress_callback, |
| 251 |
gpointer progress_user_data, |
| 252 |
GAsyncReadyCallback callback_ready, |
| 253 |
gpointer user_data); |
| 254 |
void pk_task_repo_enable_async (PkTask *task, |
| 255 |
const gchar *repo_id, |
| 256 |
gboolean enabled, |
| 257 |
GCancellable *cancellable, |
| 258 |
PkProgressCallback progress_callback, |
| 259 |
gpointer progress_user_data, |
| 260 |
GAsyncReadyCallback callback_ready, |
| 261 |
gpointer user_data); |
| 262 |
void pk_task_upgrade_system_async (PkTask *task, |
| 263 |
const gchar *distro_id, |
| 264 |
PkUpgradeKindEnum upgrade_kind, |
| 265 |
GCancellable *cancellable, |
| 266 |
PkProgressCallback progress_callback, |
| 267 |
gpointer progress_user_data, |
| 268 |
GAsyncReadyCallback callback_ready, |
| 269 |
gpointer user_data); |
| 270 |
void pk_task_repair_system_async (PkTask *task, |
| 271 |
GCancellable *cancellable, |
| 272 |
PkProgressCallback progress_callback, |
| 273 |
gpointer progress_user_data, |
| 274 |
GAsyncReadyCallback callback_ready, |
| 275 |
gpointer user_data); |
| 276 |
|
| 277 |
gboolean pk_task_user_accepted (PkTask *task, |
| 278 |
guint request); |
| 279 |
gboolean pk_task_user_declined (PkTask *task, |
| 280 |
guint request); |
| 281 |
|
| 282 |
/* getters and setters */ |
| 283 |
void pk_task_set_simulate (PkTask *task, |
| 284 |
gboolean simulate); |
| 285 |
gboolean pk_task_get_simulate (PkTask *task); |
| 286 |
void pk_task_set_only_download (PkTask *task, |
| 287 |
gboolean only_download); |
| 288 |
gboolean pk_task_get_only_download (PkTask *task); |
| 289 |
void pk_task_set_allow_downgrade (PkTask *task, |
| 290 |
gboolean allow_downgrade); |
| 291 |
gboolean pk_task_get_allow_downgrade (PkTask *task); |
| 292 |
void pk_task_set_allow_reinstall (PkTask *task, |
| 293 |
gboolean allow_reinstall); |
| 294 |
gboolean pk_task_get_allow_reinstall (PkTask *task); |
| 295 |
void pk_task_set_only_trusted (PkTask *task, |
| 296 |
gboolean only_trusted); |
| 297 |
gboolean pk_task_get_only_trusted (PkTask *task); |
| 298 |
|
| 299 |
G_END_DECLS |
| 300 |
|
| 301 |
#endif /* __PK_TASK_H */ |
| 302 |
|