| 1 |
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- |
| 2 |
* |
| 3 |
* Copyright (C) 2008-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 |
#include "config.h" |
| 23 |
|
| 24 |
#include <stdio.h> |
| 25 |
#include <string.h> |
| 26 |
#include <gio/gio.h> |
| 27 |
#include <glib.h> |
| 28 |
#include <packagekit-glib2/pk-results.h> |
| 29 |
#include <packagekit-glib2/pk-progress.h> |
| 30 |
|
| 31 |
#include "pk-client-sync.h" |
| 32 |
|
| 33 |
/* tiny helper to help us do the async operation */ |
| 34 |
typedef struct { |
| 35 |
GError **error; |
| 36 |
GMainContext *context; |
| 37 |
GMainLoop *loop; |
| 38 |
PkResults *results; |
| 39 |
PkProgress *progress; |
| 40 |
} PkClientHelper; |
| 41 |
|
| 42 |
/* |
| 43 |
* pk_client_generic_finish_sync: |
| 44 |
**/ |
| 45 |
static void |
| 46 |
pk_client_generic_finish_sync (PkClient *client, GAsyncResult *res, PkClientHelper *helper) |
| 47 |
{ |
| 48 |
PkResults *results; |
| 49 |
results = pk_client_generic_finish (client, res, helper->error); |
| 50 |
if (results != NULL) { |
| 51 |
helper->results = g_object_ref (results); |
| 52 |
g_object_unref (results); |
| 53 |
} |
| 54 |
g_main_loop_quit (helper->loop); |
| 55 |
} |
| 56 |
|
| 57 |
/** |
| 58 |
* pk_client_resolve: |
| 59 |
* @client: a valid #PkClient instance |
| 60 |
* @filters: a #PkBitfield such as %PK_FILTER_ENUM_GUI | %PK_FILTER_ENUM_FREE or %PK_FILTER_ENUM_NONE |
| 61 |
* @packages: (array zero-terminated=1): an array of package names to resolve, e.g. "gnome-system-tools" |
| 62 |
* @cancellable: a #GCancellable or %NULL |
| 63 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 64 |
* @progress_user_data: data to pass to @progress_callback |
| 65 |
* @error: the #GError to store any failure, or %NULL |
| 66 |
* |
| 67 |
* Resolve a package name into a @package_id. This can return installed and |
| 68 |
* available packages and allows you find out if a package is installed locally |
| 69 |
* or is available in a repository. |
| 70 |
* |
| 71 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 72 |
* applications. |
| 73 |
* |
| 74 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 75 |
* |
| 76 |
* Since: 0.5.3 |
| 77 |
**/ |
| 78 |
PkResults * |
| 79 |
pk_client_resolve (PkClient *client, PkBitfield filters, gchar **packages, GCancellable *cancellable, |
| 80 |
PkProgressCallback progress_callback, gpointer progress_user_data, GError **error) |
| 81 |
{ |
| 82 |
PkClientHelper helper; |
| 83 |
PkResults *results; |
| 84 |
|
| 85 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 86 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 87 |
|
| 88 |
/* create temp object */ |
| 89 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 90 |
helper.context = g_main_context_new (); |
| 91 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 92 |
helper.error = error; |
| 93 |
|
| 94 |
g_main_context_push_thread_default (helper.context); |
| 95 |
|
| 96 |
/* run async method */ |
| 97 |
pk_client_resolve_async (client, filters, packages, cancellable, progress_callback, progress_user_data, |
| 98 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 99 |
|
| 100 |
g_main_loop_run (helper.loop); |
| 101 |
|
| 102 |
results = helper.results; |
| 103 |
|
| 104 |
g_main_context_pop_thread_default (helper.context); |
| 105 |
|
| 106 |
/* free temp object */ |
| 107 |
g_main_loop_unref (helper.loop); |
| 108 |
g_main_context_unref (helper.context); |
| 109 |
|
| 110 |
return results; |
| 111 |
} |
| 112 |
|
| 113 |
/** |
| 114 |
* pk_client_search_names: |
| 115 |
* @client: a valid #PkClient instance |
| 116 |
* @filters: a #PkBitfield such as %PK_FILTER_ENUM_GUI | %PK_FILTER_ENUM_FREE or %PK_FILTER_ENUM_NONE |
| 117 |
* @values: (array zero-terminated=1): free text to search for, for instance, "power" |
| 118 |
* @cancellable: a #GCancellable or %NULL |
| 119 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 120 |
* @progress_user_data: data to pass to @progress_callback |
| 121 |
* @error: the #GError to store any failure, or %NULL |
| 122 |
* |
| 123 |
* Search all the locally installed files and remote repositories for a package |
| 124 |
* that matches a specific name. |
| 125 |
* |
| 126 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 127 |
* applications. |
| 128 |
* |
| 129 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 130 |
* |
| 131 |
* Since: 0.5.5 |
| 132 |
**/ |
| 133 |
PkResults * |
| 134 |
pk_client_search_names (PkClient *client, PkBitfield filters, gchar **values, GCancellable *cancellable, |
| 135 |
PkProgressCallback progress_callback, gpointer progress_user_data, GError **error) |
| 136 |
{ |
| 137 |
PkClientHelper helper; |
| 138 |
PkResults *results; |
| 139 |
|
| 140 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 141 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 142 |
|
| 143 |
/* create temp object */ |
| 144 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 145 |
helper.context = g_main_context_new (); |
| 146 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 147 |
helper.error = error; |
| 148 |
|
| 149 |
g_main_context_push_thread_default (helper.context); |
| 150 |
|
| 151 |
/* run async method */ |
| 152 |
pk_client_search_names_async (client, filters, values, cancellable, progress_callback, progress_user_data, |
| 153 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 154 |
|
| 155 |
g_main_loop_run (helper.loop); |
| 156 |
|
| 157 |
results = helper.results; |
| 158 |
|
| 159 |
g_main_context_pop_thread_default (helper.context); |
| 160 |
|
| 161 |
/* free temp object */ |
| 162 |
g_main_loop_unref (helper.loop); |
| 163 |
g_main_context_unref (helper.context); |
| 164 |
|
| 165 |
return results; |
| 166 |
} |
| 167 |
|
| 168 |
/** |
| 169 |
* pk_client_search_details: |
| 170 |
* @client: a valid #PkClient instance |
| 171 |
* @filters: a #PkBitfield such as %PK_FILTER_ENUM_GUI | %PK_FILTER_ENUM_FREE or %PK_FILTER_ENUM_NONE |
| 172 |
* @values: (array zero-terminated=1): free text to search for, for instance, "power" |
| 173 |
* @cancellable: a #GCancellable or %NULL |
| 174 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 175 |
* @progress_user_data: data to pass to @progress_callback |
| 176 |
* @error: the #GError to store any failure, or %NULL |
| 177 |
* |
| 178 |
* Search all detailed summary information to try and find a keyword. |
| 179 |
* Think of this as pk_client_search_names(), but trying much harder and |
| 180 |
* taking longer. |
| 181 |
* |
| 182 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 183 |
* applications. |
| 184 |
* |
| 185 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 186 |
* |
| 187 |
* Since: 0.5.5 |
| 188 |
**/ |
| 189 |
PkResults * |
| 190 |
pk_client_search_details (PkClient *client, PkBitfield filters, gchar **values, GCancellable *cancellable, |
| 191 |
PkProgressCallback progress_callback, gpointer progress_user_data, GError **error) |
| 192 |
{ |
| 193 |
PkClientHelper helper; |
| 194 |
PkResults *results; |
| 195 |
|
| 196 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 197 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 198 |
|
| 199 |
/* create temp object */ |
| 200 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 201 |
helper.context = g_main_context_new (); |
| 202 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 203 |
helper.error = error; |
| 204 |
|
| 205 |
g_main_context_push_thread_default (helper.context); |
| 206 |
|
| 207 |
/* run async method */ |
| 208 |
pk_client_search_details_async (client, filters, values, cancellable, progress_callback, progress_user_data, |
| 209 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 210 |
|
| 211 |
g_main_loop_run (helper.loop); |
| 212 |
|
| 213 |
results = helper.results; |
| 214 |
|
| 215 |
g_main_context_pop_thread_default (helper.context); |
| 216 |
|
| 217 |
/* free temp object */ |
| 218 |
g_main_loop_unref (helper.loop); |
| 219 |
g_main_context_unref (helper.context); |
| 220 |
|
| 221 |
return results; |
| 222 |
} |
| 223 |
|
| 224 |
/** |
| 225 |
* pk_client_search_groups: |
| 226 |
* @client: a valid #PkClient instance |
| 227 |
* @filters: a #PkBitfield such as %PK_FILTER_ENUM_GUI | %PK_FILTER_ENUM_FREE or %PK_FILTER_ENUM_NONE |
| 228 |
* @values: (array zero-terminated=1): a group enum to search for, for instance, "system-tools" |
| 229 |
* @cancellable: a #GCancellable or %NULL |
| 230 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 231 |
* @progress_user_data: data to pass to @progress_callback |
| 232 |
* @error: the #GError to store any failure, or %NULL |
| 233 |
* |
| 234 |
* Return all packages in a specific group. |
| 235 |
* |
| 236 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 237 |
* applications. |
| 238 |
* |
| 239 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 240 |
* |
| 241 |
* Since: 0.5.5 |
| 242 |
**/ |
| 243 |
PkResults * |
| 244 |
pk_client_search_groups (PkClient *client, PkBitfield filters, gchar **values, GCancellable *cancellable, |
| 245 |
PkProgressCallback progress_callback, gpointer progress_user_data, GError **error) |
| 246 |
{ |
| 247 |
PkClientHelper helper; |
| 248 |
PkResults *results; |
| 249 |
|
| 250 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 251 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 252 |
|
| 253 |
/* create temp object */ |
| 254 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 255 |
helper.context = g_main_context_new (); |
| 256 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 257 |
helper.error = error; |
| 258 |
|
| 259 |
g_main_context_push_thread_default (helper.context); |
| 260 |
|
| 261 |
/* run async method */ |
| 262 |
pk_client_search_groups_async (client, filters, values, cancellable, progress_callback, progress_user_data, |
| 263 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 264 |
|
| 265 |
g_main_loop_run (helper.loop); |
| 266 |
|
| 267 |
results = helper.results; |
| 268 |
|
| 269 |
g_main_context_pop_thread_default (helper.context); |
| 270 |
|
| 271 |
/* free temp object */ |
| 272 |
g_main_loop_unref (helper.loop); |
| 273 |
g_main_context_unref (helper.context); |
| 274 |
|
| 275 |
return results; |
| 276 |
} |
| 277 |
|
| 278 |
/** |
| 279 |
* pk_client_search_files: |
| 280 |
* @client: a valid #PkClient instance |
| 281 |
* @filters: a #PkBitfield such as %PK_FILTER_ENUM_GUI | %PK_FILTER_ENUM_FREE or %PK_FILTER_ENUM_NONE |
| 282 |
* @values: (array zero-terminated=1): file to search for, for instance, "/sbin/service" |
| 283 |
* @cancellable: a #GCancellable or %NULL |
| 284 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 285 |
* @progress_user_data: data to pass to @progress_callback |
| 286 |
* @error: the #GError to store any failure, or %NULL |
| 287 |
* |
| 288 |
* Search for packages that provide a specific file. |
| 289 |
* |
| 290 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 291 |
* applications. |
| 292 |
* |
| 293 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 294 |
* |
| 295 |
* Since: 0.5.5 |
| 296 |
**/ |
| 297 |
PkResults * |
| 298 |
pk_client_search_files (PkClient *client, PkBitfield filters, gchar **values, GCancellable *cancellable, |
| 299 |
PkProgressCallback progress_callback, gpointer progress_user_data, GError **error) |
| 300 |
{ |
| 301 |
PkClientHelper helper; |
| 302 |
PkResults *results; |
| 303 |
|
| 304 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 305 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 306 |
|
| 307 |
/* create temp object */ |
| 308 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 309 |
helper.context = g_main_context_new (); |
| 310 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 311 |
helper.error = error; |
| 312 |
|
| 313 |
g_main_context_push_thread_default (helper.context); |
| 314 |
|
| 315 |
/* run async method */ |
| 316 |
pk_client_search_files_async (client, filters, values, cancellable, progress_callback, progress_user_data, |
| 317 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 318 |
|
| 319 |
g_main_loop_run (helper.loop); |
| 320 |
|
| 321 |
results = helper.results; |
| 322 |
|
| 323 |
g_main_context_pop_thread_default (helper.context); |
| 324 |
|
| 325 |
/* free temp object */ |
| 326 |
g_main_loop_unref (helper.loop); |
| 327 |
g_main_context_unref (helper.context); |
| 328 |
|
| 329 |
return results; |
| 330 |
} |
| 331 |
|
| 332 |
/** |
| 333 |
* pk_client_get_details: |
| 334 |
* @client: a valid #PkClient instance |
| 335 |
* @package_ids: (array zero-terminated=1): a null terminated array of package_id structures such as "hal;0.0.1;i386;fedora" |
| 336 |
* @cancellable: a #GCancellable or %NULL |
| 337 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 338 |
* @progress_user_data: data to pass to @progress_callback |
| 339 |
* @error: the #GError to store any failure, or %NULL |
| 340 |
* |
| 341 |
* Get details of a package, so more information can be obtained for GUI |
| 342 |
* or command line tools. |
| 343 |
* |
| 344 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 345 |
* applications. |
| 346 |
* |
| 347 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 348 |
* |
| 349 |
* Since: 0.5.3 |
| 350 |
**/ |
| 351 |
PkResults * |
| 352 |
pk_client_get_details (PkClient *client, gchar **package_ids, GCancellable *cancellable, |
| 353 |
PkProgressCallback progress_callback, gpointer progress_user_data, GError **error) |
| 354 |
{ |
| 355 |
PkClientHelper helper; |
| 356 |
PkResults *results; |
| 357 |
|
| 358 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 359 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 360 |
|
| 361 |
/* create temp object */ |
| 362 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 363 |
helper.context = g_main_context_new (); |
| 364 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 365 |
helper.error = error; |
| 366 |
|
| 367 |
g_main_context_push_thread_default (helper.context); |
| 368 |
|
| 369 |
/* run async method */ |
| 370 |
pk_client_get_details_async (client, package_ids, cancellable, progress_callback, progress_user_data, |
| 371 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 372 |
|
| 373 |
g_main_loop_run (helper.loop); |
| 374 |
|
| 375 |
results = helper.results; |
| 376 |
|
| 377 |
g_main_context_pop_thread_default (helper.context); |
| 378 |
|
| 379 |
/* free temp object */ |
| 380 |
g_main_loop_unref (helper.loop); |
| 381 |
g_main_context_unref (helper.context); |
| 382 |
|
| 383 |
return results; |
| 384 |
} |
| 385 |
|
| 386 |
/** |
| 387 |
* pk_client_get_details_local: |
| 388 |
* @client: a valid #PkClient instance |
| 389 |
* @files: (array zero-terminated=1): a null terminated array of filenames |
| 390 |
* @cancellable: a #GCancellable or %NULL |
| 391 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 392 |
* @progress_user_data: data to pass to @progress_callback |
| 393 |
* @error: the #GError to store any failure, or %NULL |
| 394 |
* |
| 395 |
* Get details of a local package, so more information can be obtained for GUI |
| 396 |
* or command line tools. |
| 397 |
* |
| 398 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 399 |
* applications. |
| 400 |
* |
| 401 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 402 |
* |
| 403 |
* Since: 0.8.17 |
| 404 |
**/ |
| 405 |
PkResults * |
| 406 |
pk_client_get_details_local (PkClient *client, gchar **files, GCancellable *cancellable, |
| 407 |
PkProgressCallback progress_callback, gpointer progress_user_data, |
| 408 |
GError **error) |
| 409 |
{ |
| 410 |
PkClientHelper helper; |
| 411 |
PkResults *results; |
| 412 |
|
| 413 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 414 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 415 |
|
| 416 |
/* create temp object */ |
| 417 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 418 |
helper.context = g_main_context_new (); |
| 419 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 420 |
helper.error = error; |
| 421 |
|
| 422 |
g_main_context_push_thread_default (helper.context); |
| 423 |
|
| 424 |
/* run async method */ |
| 425 |
pk_client_get_details_local_async (client, files, cancellable, |
| 426 |
progress_callback, progress_user_data, |
| 427 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 428 |
|
| 429 |
g_main_loop_run (helper.loop); |
| 430 |
|
| 431 |
results = helper.results; |
| 432 |
|
| 433 |
g_main_context_pop_thread_default (helper.context); |
| 434 |
|
| 435 |
/* free temp object */ |
| 436 |
g_main_loop_unref (helper.loop); |
| 437 |
g_main_context_unref (helper.context); |
| 438 |
|
| 439 |
return results; |
| 440 |
} |
| 441 |
|
| 442 |
/** |
| 443 |
* pk_client_get_files_local: |
| 444 |
* @client: a valid #PkClient instance |
| 445 |
* @files: (array zero-terminated=1): a null terminated array of filenames |
| 446 |
* @cancellable: a #GCancellable or %NULL |
| 447 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 448 |
* @progress_user_data: data to pass to @progress_callback |
| 449 |
* @error: the #GError to store any failure, or %NULL |
| 450 |
* |
| 451 |
* Get file list of a local package, so more information can be obtained for GUI |
| 452 |
* or command line tools. |
| 453 |
* |
| 454 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 455 |
* applications. |
| 456 |
* |
| 457 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 458 |
* |
| 459 |
* Since: 0.9.1 |
| 460 |
**/ |
| 461 |
PkResults * |
| 462 |
pk_client_get_files_local (PkClient *client, gchar **files, GCancellable *cancellable, |
| 463 |
PkProgressCallback progress_callback, gpointer progress_user_data, |
| 464 |
GError **error) |
| 465 |
{ |
| 466 |
PkClientHelper helper; |
| 467 |
PkResults *results; |
| 468 |
|
| 469 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 470 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 471 |
|
| 472 |
/* create temp object */ |
| 473 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 474 |
helper.context = g_main_context_new (); |
| 475 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 476 |
helper.error = error; |
| 477 |
|
| 478 |
g_main_context_push_thread_default (helper.context); |
| 479 |
|
| 480 |
/* run async method */ |
| 481 |
pk_client_get_files_local_async (client, files, cancellable, |
| 482 |
progress_callback, progress_user_data, |
| 483 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 484 |
|
| 485 |
g_main_loop_run (helper.loop); |
| 486 |
|
| 487 |
results = helper.results; |
| 488 |
|
| 489 |
g_main_context_pop_thread_default (helper.context); |
| 490 |
|
| 491 |
/* free temp object */ |
| 492 |
g_main_loop_unref (helper.loop); |
| 493 |
g_main_context_unref (helper.context); |
| 494 |
|
| 495 |
return results; |
| 496 |
} |
| 497 |
|
| 498 |
/** |
| 499 |
* pk_client_get_update_detail: |
| 500 |
* @client: a valid #PkClient instance |
| 501 |
* @package_ids: (array zero-terminated=1): a null terminated array of package_id structures such as "hal;0.0.1;i386;fedora" |
| 502 |
* @cancellable: a #GCancellable or %NULL |
| 503 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 504 |
* @progress_user_data: data to pass to @progress_callback |
| 505 |
* @error: the #GError to store any failure, or %NULL |
| 506 |
* |
| 507 |
* Get details about the specific update, for instance any CVE urls and |
| 508 |
* severity information. |
| 509 |
* |
| 510 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 511 |
* applications. |
| 512 |
* |
| 513 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 514 |
* |
| 515 |
* Since: 0.5.3 |
| 516 |
**/ |
| 517 |
PkResults * |
| 518 |
pk_client_get_update_detail (PkClient *client, gchar **package_ids, GCancellable *cancellable, |
| 519 |
PkProgressCallback progress_callback, gpointer progress_user_data, GError **error) |
| 520 |
{ |
| 521 |
PkClientHelper helper; |
| 522 |
PkResults *results; |
| 523 |
|
| 524 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 525 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 526 |
|
| 527 |
/* create temp object */ |
| 528 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 529 |
helper.context = g_main_context_new (); |
| 530 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 531 |
helper.error = error; |
| 532 |
|
| 533 |
g_main_context_push_thread_default (helper.context); |
| 534 |
|
| 535 |
/* run async method */ |
| 536 |
pk_client_get_update_detail_async (client, package_ids, cancellable, progress_callback, progress_user_data, |
| 537 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 538 |
|
| 539 |
g_main_loop_run (helper.loop); |
| 540 |
|
| 541 |
results = helper.results; |
| 542 |
|
| 543 |
g_main_context_pop_thread_default (helper.context); |
| 544 |
|
| 545 |
/* free temp object */ |
| 546 |
g_main_loop_unref (helper.loop); |
| 547 |
g_main_context_unref (helper.context); |
| 548 |
|
| 549 |
return results; |
| 550 |
} |
| 551 |
|
| 552 |
/** |
| 553 |
* pk_client_download_packages: |
| 554 |
* @client: a valid #PkClient instance |
| 555 |
* @package_ids: (array zero-terminated=1): a null terminated array of package_id structures such as "hal;0.0.1;i386;fedora" |
| 556 |
* @directory: the location where packages are to be downloaded |
| 557 |
* @cancellable: a #GCancellable or %NULL |
| 558 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 559 |
* @progress_user_data: data to pass to @progress_callback |
| 560 |
* @error: the #GError to store any failure, or %NULL |
| 561 |
* |
| 562 |
* Downloads package files to a specified location. |
| 563 |
* |
| 564 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 565 |
* applications. |
| 566 |
* |
| 567 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 568 |
* |
| 569 |
* Since: 0.5.3 |
| 570 |
**/ |
| 571 |
PkResults * |
| 572 |
pk_client_download_packages (PkClient *client, gchar **package_ids, const gchar *directory, GCancellable *cancellable, |
| 573 |
PkProgressCallback progress_callback, gpointer progress_user_data, GError **error) |
| 574 |
{ |
| 575 |
PkClientHelper helper; |
| 576 |
PkResults *results; |
| 577 |
|
| 578 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 579 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 580 |
|
| 581 |
/* create temp object */ |
| 582 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 583 |
helper.context = g_main_context_new (); |
| 584 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 585 |
helper.error = error; |
| 586 |
|
| 587 |
g_main_context_push_thread_default (helper.context); |
| 588 |
|
| 589 |
/* run async method */ |
| 590 |
pk_client_download_packages_async (client, package_ids, directory, cancellable, progress_callback, progress_user_data, |
| 591 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 592 |
|
| 593 |
g_main_loop_run (helper.loop); |
| 594 |
|
| 595 |
results = helper.results; |
| 596 |
|
| 597 |
g_main_context_pop_thread_default (helper.context); |
| 598 |
|
| 599 |
/* free temp object */ |
| 600 |
g_main_loop_unref (helper.loop); |
| 601 |
g_main_context_unref (helper.context); |
| 602 |
|
| 603 |
return results; |
| 604 |
} |
| 605 |
|
| 606 |
/** |
| 607 |
* pk_client_get_updates: |
| 608 |
* @client: a valid #PkClient instance |
| 609 |
* @filters: a #PkBitfield such as %PK_FILTER_ENUM_DEVELOPMENT or %PK_FILTER_ENUM_NONE |
| 610 |
* @cancellable: a #GCancellable or %NULL |
| 611 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 612 |
* @progress_user_data: data to pass to @progress_callback |
| 613 |
* @error: the #GError to store any failure, or %NULL |
| 614 |
* |
| 615 |
* Get a list of all the packages that can be updated for all repositories. |
| 616 |
* |
| 617 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 618 |
* applications. |
| 619 |
* |
| 620 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 621 |
* |
| 622 |
* Since: 0.5.3 |
| 623 |
**/ |
| 624 |
PkResults * |
| 625 |
pk_client_get_updates (PkClient *client, PkBitfield filters, GCancellable *cancellable, |
| 626 |
PkProgressCallback progress_callback, gpointer progress_user_data, GError **error) |
| 627 |
{ |
| 628 |
PkClientHelper helper; |
| 629 |
PkResults *results; |
| 630 |
|
| 631 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 632 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 633 |
|
| 634 |
/* create temp object */ |
| 635 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 636 |
helper.context = g_main_context_new (); |
| 637 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 638 |
helper.error = error; |
| 639 |
|
| 640 |
g_main_context_push_thread_default (helper.context); |
| 641 |
|
| 642 |
/* run async method */ |
| 643 |
pk_client_get_updates_async (client, filters, cancellable, progress_callback, progress_user_data, |
| 644 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 645 |
|
| 646 |
g_main_loop_run (helper.loop); |
| 647 |
|
| 648 |
results = helper.results; |
| 649 |
|
| 650 |
g_main_context_pop_thread_default (helper.context); |
| 651 |
|
| 652 |
/* free temp object */ |
| 653 |
g_main_loop_unref (helper.loop); |
| 654 |
g_main_context_unref (helper.context); |
| 655 |
|
| 656 |
return results; |
| 657 |
} |
| 658 |
|
| 659 |
/** |
| 660 |
* pk_client_get_old_transactions: |
| 661 |
* @client: a valid #PkClient instance |
| 662 |
* @number: the number of past transactions to return, or 0 for all |
| 663 |
* @cancellable: a #GCancellable or %NULL |
| 664 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 665 |
* @progress_user_data: data to pass to @progress_callback |
| 666 |
* @error: the #GError to store any failure, or %NULL |
| 667 |
* |
| 668 |
* Get the old transaction list, mainly used for the transaction viewer. |
| 669 |
* |
| 670 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 671 |
* applications. |
| 672 |
* |
| 673 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 674 |
* |
| 675 |
* Since: 0.5.3 |
| 676 |
**/ |
| 677 |
PkResults * |
| 678 |
pk_client_get_old_transactions (PkClient *client, guint number, GCancellable *cancellable, |
| 679 |
PkProgressCallback progress_callback, gpointer progress_user_data, GError **error) |
| 680 |
{ |
| 681 |
PkClientHelper helper; |
| 682 |
PkResults *results; |
| 683 |
|
| 684 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 685 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 686 |
|
| 687 |
/* create temp object */ |
| 688 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 689 |
helper.context = g_main_context_new (); |
| 690 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 691 |
helper.error = error; |
| 692 |
|
| 693 |
g_main_context_push_thread_default (helper.context); |
| 694 |
|
| 695 |
/* run async method */ |
| 696 |
pk_client_get_old_transactions_async (client, number, cancellable, progress_callback, progress_user_data, |
| 697 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 698 |
|
| 699 |
g_main_loop_run (helper.loop); |
| 700 |
|
| 701 |
results = helper.results; |
| 702 |
|
| 703 |
g_main_context_pop_thread_default (helper.context); |
| 704 |
|
| 705 |
/* free temp object */ |
| 706 |
g_main_loop_unref (helper.loop); |
| 707 |
g_main_context_unref (helper.context); |
| 708 |
|
| 709 |
return results; |
| 710 |
} |
| 711 |
|
| 712 |
/** |
| 713 |
* pk_client_depends_on: |
| 714 |
* @client: a valid #PkClient instance |
| 715 |
* @filters: a #PkBitfield such as %PK_FILTER_ENUM_GUI | %PK_FILTER_ENUM_FREE or %PK_FILTER_ENUM_NONE |
| 716 |
* @package_ids: (array zero-terminated=1): a null terminated array of package_id structures such as "hal;0.0.1;i386;fedora" |
| 717 |
* @recursive: If we should search recursively for depends |
| 718 |
* @cancellable: a #GCancellable or %NULL |
| 719 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 720 |
* @progress_user_data: data to pass to @progress_callback |
| 721 |
* @error: the #GError to store any failure, or %NULL |
| 722 |
* |
| 723 |
* Get the packages that depend this one, i.e. child.parent. |
| 724 |
* |
| 725 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 726 |
* applications. |
| 727 |
* |
| 728 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 729 |
* |
| 730 |
* Since: 0.5.3 |
| 731 |
**/ |
| 732 |
PkResults * |
| 733 |
pk_client_depends_on (PkClient *client, PkBitfield filters, gchar **package_ids, gboolean recursive, GCancellable *cancellable, |
| 734 |
PkProgressCallback progress_callback, gpointer progress_user_data, GError **error) |
| 735 |
{ |
| 736 |
PkClientHelper helper; |
| 737 |
PkResults *results; |
| 738 |
|
| 739 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 740 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 741 |
|
| 742 |
/* create temp object */ |
| 743 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 744 |
helper.context = g_main_context_new (); |
| 745 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 746 |
helper.error = error; |
| 747 |
|
| 748 |
g_main_context_push_thread_default (helper.context); |
| 749 |
|
| 750 |
/* run async method */ |
| 751 |
pk_client_depends_on_async (client, filters, package_ids, recursive, cancellable, progress_callback, progress_user_data, |
| 752 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 753 |
|
| 754 |
g_main_loop_run (helper.loop); |
| 755 |
|
| 756 |
results = helper.results; |
| 757 |
|
| 758 |
g_main_context_pop_thread_default (helper.context); |
| 759 |
|
| 760 |
/* free temp object */ |
| 761 |
g_main_loop_unref (helper.loop); |
| 762 |
g_main_context_unref (helper.context); |
| 763 |
|
| 764 |
return results; |
| 765 |
} |
| 766 |
|
| 767 |
/** |
| 768 |
* pk_client_get_packages: |
| 769 |
* @client: a valid #PkClient instance |
| 770 |
* @filters: a #PkBitfield such as %PK_FILTER_ENUM_GUI | %PK_FILTER_ENUM_FREE or %PK_FILTER_ENUM_NONE |
| 771 |
* @cancellable: a #GCancellable or %NULL |
| 772 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 773 |
* @progress_user_data: data to pass to @progress_callback |
| 774 |
* @error: the #GError to store any failure, or %NULL |
| 775 |
* |
| 776 |
* Get the list of packages from the backend |
| 777 |
* |
| 778 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 779 |
* applications. |
| 780 |
* |
| 781 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 782 |
* |
| 783 |
* Since: 0.5.3 |
| 784 |
**/ |
| 785 |
PkResults * |
| 786 |
pk_client_get_packages (PkClient *client, PkBitfield filters, GCancellable *cancellable, |
| 787 |
PkProgressCallback progress_callback, gpointer progress_user_data, GError **error) |
| 788 |
{ |
| 789 |
PkClientHelper helper; |
| 790 |
PkResults *results; |
| 791 |
|
| 792 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 793 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 794 |
|
| 795 |
/* create temp object */ |
| 796 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 797 |
helper.context = g_main_context_new (); |
| 798 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 799 |
helper.error = error; |
| 800 |
|
| 801 |
g_main_context_push_thread_default (helper.context); |
| 802 |
|
| 803 |
/* run async method */ |
| 804 |
pk_client_get_packages_async (client, filters, cancellable, progress_callback, progress_user_data, |
| 805 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 806 |
|
| 807 |
g_main_loop_run (helper.loop); |
| 808 |
|
| 809 |
results = helper.results; |
| 810 |
|
| 811 |
g_main_context_pop_thread_default (helper.context); |
| 812 |
|
| 813 |
/* free temp object */ |
| 814 |
g_main_loop_unref (helper.loop); |
| 815 |
g_main_context_unref (helper.context); |
| 816 |
|
| 817 |
return results; |
| 818 |
} |
| 819 |
|
| 820 |
/** |
| 821 |
* pk_client_required_by: |
| 822 |
* @client: a valid #PkClient instance |
| 823 |
* @filters: a #PkBitfield such as %PK_FILTER_ENUM_GUI | %PK_FILTER_ENUM_FREE or %PK_FILTER_ENUM_NONE |
| 824 |
* @package_ids: (array zero-terminated=1): a null terminated array of package_id structures such as "hal;0.0.1;i386;fedora" |
| 825 |
* @recursive: If we should search recursively for requires |
| 826 |
* @cancellable: a #GCancellable or %NULL |
| 827 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 828 |
* @progress_user_data: data to pass to @progress_callback |
| 829 |
* @error: the #GError to store any failure, or %NULL |
| 830 |
* |
| 831 |
* Get the packages that require this one, i.e. parent.child. |
| 832 |
* |
| 833 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 834 |
* applications. |
| 835 |
* |
| 836 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 837 |
* |
| 838 |
* Since: 0.5.3 |
| 839 |
**/ |
| 840 |
PkResults * |
| 841 |
pk_client_required_by (PkClient *client, PkBitfield filters, gchar **package_ids, gboolean recursive, GCancellable *cancellable, |
| 842 |
PkProgressCallback progress_callback, gpointer progress_user_data, GError **error) |
| 843 |
{ |
| 844 |
PkClientHelper helper; |
| 845 |
PkResults *results; |
| 846 |
|
| 847 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 848 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 849 |
|
| 850 |
/* create temp object */ |
| 851 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 852 |
helper.context = g_main_context_new (); |
| 853 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 854 |
helper.error = error; |
| 855 |
|
| 856 |
g_main_context_push_thread_default (helper.context); |
| 857 |
|
| 858 |
/* run async method */ |
| 859 |
pk_client_required_by_async (client, filters, package_ids, recursive, cancellable, progress_callback, progress_user_data, |
| 860 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 861 |
|
| 862 |
g_main_loop_run (helper.loop); |
| 863 |
|
| 864 |
results = helper.results; |
| 865 |
|
| 866 |
g_main_context_pop_thread_default (helper.context); |
| 867 |
|
| 868 |
/* free temp object */ |
| 869 |
g_main_loop_unref (helper.loop); |
| 870 |
g_main_context_unref (helper.context); |
| 871 |
|
| 872 |
return results; |
| 873 |
} |
| 874 |
|
| 875 |
/** |
| 876 |
* pk_client_what_provides: |
| 877 |
* @client: a valid #PkClient instance |
| 878 |
* @filters: a #PkBitfield such as %PK_FILTER_ENUM_GUI | %PK_FILTER_ENUM_FREE or %PK_FILTER_ENUM_NONE |
| 879 |
* @values: (array zero-terminated=1): a search term such as "sound/mp3" |
| 880 |
* @cancellable: a #GCancellable or %NULL |
| 881 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 882 |
* @progress_user_data: data to pass to @progress_callback |
| 883 |
* @error: the #GError to store any failure, or %NULL |
| 884 |
* |
| 885 |
* This should return packages that provide the supplied attributes. |
| 886 |
* This method is useful for finding out what package(s) provide a modalias |
| 887 |
* or GStreamer codec string. |
| 888 |
* |
| 889 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 890 |
* applications. |
| 891 |
* |
| 892 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 893 |
* |
| 894 |
* Since: 0.5.3 |
| 895 |
**/ |
| 896 |
PkResults * |
| 897 |
pk_client_what_provides (PkClient *client, |
| 898 |
PkBitfield filters, |
| 899 |
gchar **values, |
| 900 |
GCancellable *cancellable, |
| 901 |
PkProgressCallback progress_callback, gpointer progress_user_data, GError **error) |
| 902 |
{ |
| 903 |
PkClientHelper helper; |
| 904 |
PkResults *results; |
| 905 |
|
| 906 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 907 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 908 |
|
| 909 |
/* create temp object */ |
| 910 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 911 |
helper.context = g_main_context_new (); |
| 912 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 913 |
helper.error = error; |
| 914 |
|
| 915 |
g_main_context_push_thread_default (helper.context); |
| 916 |
|
| 917 |
/* run async method */ |
| 918 |
pk_client_what_provides_async (client, filters, values, cancellable, progress_callback, progress_user_data, |
| 919 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 920 |
|
| 921 |
g_main_loop_run (helper.loop); |
| 922 |
|
| 923 |
results = helper.results; |
| 924 |
|
| 925 |
g_main_context_pop_thread_default (helper.context); |
| 926 |
|
| 927 |
/* free temp object */ |
| 928 |
g_main_loop_unref (helper.loop); |
| 929 |
g_main_context_unref (helper.context); |
| 930 |
|
| 931 |
return results; |
| 932 |
} |
| 933 |
|
| 934 |
/** |
| 935 |
* pk_client_get_distro_upgrades: |
| 936 |
* @client: a valid #PkClient instance |
| 937 |
* @cancellable: a #GCancellable or %NULL |
| 938 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 939 |
* @progress_user_data: data to pass to @progress_callback |
| 940 |
* @error: the #GError to store any failure, or %NULL |
| 941 |
* |
| 942 |
* This method should return a list of distribution upgrades that are available. |
| 943 |
* It should not return updates, only major upgrades. |
| 944 |
* |
| 945 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 946 |
* applications. |
| 947 |
* |
| 948 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 949 |
* |
| 950 |
* Since: 0.5.3 |
| 951 |
**/ |
| 952 |
PkResults * |
| 953 |
pk_client_get_distro_upgrades (PkClient *client, GCancellable *cancellable, |
| 954 |
PkProgressCallback progress_callback, gpointer progress_user_data, GError **error) |
| 955 |
{ |
| 956 |
PkClientHelper helper; |
| 957 |
PkResults *results; |
| 958 |
|
| 959 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 960 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 961 |
|
| 962 |
/* create temp object */ |
| 963 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 964 |
helper.context = g_main_context_new (); |
| 965 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 966 |
helper.error = error; |
| 967 |
|
| 968 |
g_main_context_push_thread_default (helper.context); |
| 969 |
|
| 970 |
/* run async method */ |
| 971 |
pk_client_get_distro_upgrades_async (client, cancellable, progress_callback, progress_user_data, |
| 972 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 973 |
|
| 974 |
g_main_loop_run (helper.loop); |
| 975 |
|
| 976 |
results = helper.results; |
| 977 |
|
| 978 |
g_main_context_pop_thread_default (helper.context); |
| 979 |
|
| 980 |
/* free temp object */ |
| 981 |
g_main_loop_unref (helper.loop); |
| 982 |
g_main_context_unref (helper.context); |
| 983 |
|
| 984 |
return results; |
| 985 |
} |
| 986 |
|
| 987 |
/** |
| 988 |
* pk_client_get_files: |
| 989 |
* @client: a valid #PkClient instance |
| 990 |
* @package_ids: (array zero-terminated=1): a null terminated array of package_id structures such as "hal;0.0.1;i386;fedora" |
| 991 |
* @cancellable: a #GCancellable or %NULL |
| 992 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 993 |
* @progress_user_data: data to pass to @progress_callback |
| 994 |
* @error: the #GError to store any failure, or %NULL |
| 995 |
* |
| 996 |
* Get the file list (i.e. a list of files installed) for the specified package. |
| 997 |
* |
| 998 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 999 |
* applications. |
| 1000 |
* |
| 1001 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 1002 |
* |
| 1003 |
* Since: 0.5.3 |
| 1004 |
**/ |
| 1005 |
PkResults * |
| 1006 |
pk_client_get_files (PkClient *client, gchar **package_ids, GCancellable *cancellable, |
| 1007 |
PkProgressCallback progress_callback, gpointer progress_user_data, GError **error) |
| 1008 |
{ |
| 1009 |
PkClientHelper helper; |
| 1010 |
PkResults *results; |
| 1011 |
|
| 1012 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 1013 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 1014 |
|
| 1015 |
/* create temp object */ |
| 1016 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 1017 |
helper.context = g_main_context_new (); |
| 1018 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 1019 |
helper.error = error; |
| 1020 |
|
| 1021 |
g_main_context_push_thread_default (helper.context); |
| 1022 |
|
| 1023 |
/* run async method */ |
| 1024 |
pk_client_get_files_async (client, package_ids, cancellable, progress_callback, progress_user_data, |
| 1025 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 1026 |
|
| 1027 |
g_main_loop_run (helper.loop); |
| 1028 |
|
| 1029 |
results = helper.results; |
| 1030 |
|
| 1031 |
g_main_context_pop_thread_default (helper.context); |
| 1032 |
|
| 1033 |
/* free temp object */ |
| 1034 |
g_main_loop_unref (helper.loop); |
| 1035 |
g_main_context_unref (helper.context); |
| 1036 |
|
| 1037 |
return results; |
| 1038 |
} |
| 1039 |
|
| 1040 |
/** |
| 1041 |
* pk_client_get_categories: |
| 1042 |
* @client: a valid #PkClient instance |
| 1043 |
* @cancellable: a #GCancellable or %NULL |
| 1044 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 1045 |
* @progress_user_data: data to pass to @progress_callback |
| 1046 |
* @error: the #GError to store any failure, or %NULL |
| 1047 |
* |
| 1048 |
* Get a list of all categories supported. |
| 1049 |
* |
| 1050 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 1051 |
* applications. |
| 1052 |
* |
| 1053 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 1054 |
* |
| 1055 |
* Since: 0.5.3 |
| 1056 |
**/ |
| 1057 |
PkResults * |
| 1058 |
pk_client_get_categories (PkClient *client, GCancellable *cancellable, |
| 1059 |
PkProgressCallback progress_callback, gpointer progress_user_data, GError **error) |
| 1060 |
{ |
| 1061 |
PkClientHelper helper; |
| 1062 |
PkResults *results; |
| 1063 |
|
| 1064 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 1065 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 1066 |
|
| 1067 |
/* create temp object */ |
| 1068 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 1069 |
helper.context = g_main_context_new (); |
| 1070 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 1071 |
helper.error = error; |
| 1072 |
|
| 1073 |
g_main_context_push_thread_default (helper.context); |
| 1074 |
|
| 1075 |
/* run async method */ |
| 1076 |
pk_client_get_categories_async (client, cancellable, progress_callback, progress_user_data, |
| 1077 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 1078 |
|
| 1079 |
g_main_loop_run (helper.loop); |
| 1080 |
|
| 1081 |
results = helper.results; |
| 1082 |
|
| 1083 |
g_main_context_pop_thread_default (helper.context); |
| 1084 |
|
| 1085 |
/* free temp object */ |
| 1086 |
g_main_loop_unref (helper.loop); |
| 1087 |
g_main_context_unref (helper.context); |
| 1088 |
|
| 1089 |
return results; |
| 1090 |
} |
| 1091 |
|
| 1092 |
/** |
| 1093 |
* pk_client_remove_packages: |
| 1094 |
* @client: a valid #PkClient instance |
| 1095 |
* @transaction_flags: a transaction type bitfield |
| 1096 |
* @package_ids: (array zero-terminated=1): a null terminated array of package_id structures such as "hal;0.0.1;i386;fedora" |
| 1097 |
* @allow_deps: if other dependent packages are allowed to be removed from the computer |
| 1098 |
* @autoremove: if other packages installed at the same time should be tried to remove |
| 1099 |
* @cancellable: a #GCancellable or %NULL |
| 1100 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 1101 |
* @progress_user_data: data to pass to @progress_callback |
| 1102 |
* @error: the #GError to store any failure, or %NULL |
| 1103 |
* |
| 1104 |
* Remove a package (optionally with dependancies) from the system. |
| 1105 |
* If @allow_deps is set to %FALSE, and other packages would have to be removed, |
| 1106 |
* then the transaction would fail. |
| 1107 |
* |
| 1108 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 1109 |
* applications. |
| 1110 |
* |
| 1111 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 1112 |
* |
| 1113 |
* Since: 0.8.1 |
| 1114 |
**/ |
| 1115 |
PkResults * |
| 1116 |
pk_client_remove_packages (PkClient *client, |
| 1117 |
PkBitfield transaction_flags, |
| 1118 |
gchar **package_ids, |
| 1119 |
gboolean allow_deps, |
| 1120 |
gboolean autoremove, |
| 1121 |
GCancellable *cancellable, |
| 1122 |
PkProgressCallback progress_callback, |
| 1123 |
gpointer progress_user_data, |
| 1124 |
GError **error) |
| 1125 |
{ |
| 1126 |
PkClientHelper helper; |
| 1127 |
PkResults *results; |
| 1128 |
|
| 1129 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 1130 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 1131 |
|
| 1132 |
/* create temp object */ |
| 1133 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 1134 |
helper.context = g_main_context_new (); |
| 1135 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 1136 |
helper.error = error; |
| 1137 |
|
| 1138 |
g_main_context_push_thread_default (helper.context); |
| 1139 |
|
| 1140 |
/* run async method */ |
| 1141 |
pk_client_remove_packages_async (client, |
| 1142 |
transaction_flags, |
| 1143 |
package_ids, |
| 1144 |
allow_deps, |
| 1145 |
autoremove, |
| 1146 |
cancellable, |
| 1147 |
progress_callback, |
| 1148 |
progress_user_data, |
| 1149 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, |
| 1150 |
&helper); |
| 1151 |
|
| 1152 |
g_main_loop_run (helper.loop); |
| 1153 |
|
| 1154 |
results = helper.results; |
| 1155 |
|
| 1156 |
g_main_context_pop_thread_default (helper.context); |
| 1157 |
|
| 1158 |
/* free temp object */ |
| 1159 |
g_main_loop_unref (helper.loop); |
| 1160 |
g_main_context_unref (helper.context); |
| 1161 |
|
| 1162 |
return results; |
| 1163 |
} |
| 1164 |
|
| 1165 |
/** |
| 1166 |
* pk_client_refresh_cache: |
| 1167 |
* @client: a valid #PkClient instance |
| 1168 |
* @force: if we should aggressively drop caches |
| 1169 |
* @cancellable: a #GCancellable or %NULL |
| 1170 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 1171 |
* @progress_user_data: data to pass to @progress_callback |
| 1172 |
* @error: the #GError to store any failure, or %NULL |
| 1173 |
* |
| 1174 |
* Refresh the cache, i.e. download new metadata from a remote URL so that |
| 1175 |
* package lists are up to date. |
| 1176 |
* This action may take a few minutes and should be done when the session and |
| 1177 |
* system are idle. |
| 1178 |
* |
| 1179 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 1180 |
* applications. |
| 1181 |
* |
| 1182 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 1183 |
* |
| 1184 |
* Since: 0.5.3 |
| 1185 |
**/ |
| 1186 |
PkResults * |
| 1187 |
pk_client_refresh_cache (PkClient *client, gboolean force, GCancellable *cancellable, |
| 1188 |
PkProgressCallback progress_callback, gpointer progress_user_data, GError **error) |
| 1189 |
{ |
| 1190 |
PkClientHelper helper; |
| 1191 |
PkResults *results; |
| 1192 |
|
| 1193 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 1194 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 1195 |
|
| 1196 |
/* create temp object */ |
| 1197 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 1198 |
helper.context = g_main_context_new (); |
| 1199 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 1200 |
helper.error = error; |
| 1201 |
|
| 1202 |
g_main_context_push_thread_default (helper.context); |
| 1203 |
|
| 1204 |
/* run async method */ |
| 1205 |
pk_client_refresh_cache_async (client, force, cancellable, progress_callback, progress_user_data, |
| 1206 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 1207 |
|
| 1208 |
g_main_loop_run (helper.loop); |
| 1209 |
|
| 1210 |
results = helper.results; |
| 1211 |
|
| 1212 |
g_main_context_pop_thread_default (helper.context); |
| 1213 |
|
| 1214 |
/* free temp object */ |
| 1215 |
g_main_loop_unref (helper.loop); |
| 1216 |
g_main_context_unref (helper.context); |
| 1217 |
|
| 1218 |
return results; |
| 1219 |
} |
| 1220 |
|
| 1221 |
/** |
| 1222 |
* pk_client_install_packages: |
| 1223 |
* @client: a valid #PkClient instance |
| 1224 |
* @transaction_flags: a transaction type bitfield |
| 1225 |
* @package_ids: (array zero-terminated=1): a null terminated array of package_id structures such as "hal;0.0.1;i386;fedora" |
| 1226 |
* @cancellable: a #GCancellable or %NULL |
| 1227 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 1228 |
* @progress_user_data: data to pass to @progress_callback |
| 1229 |
* @error: the #GError to store any failure, or %NULL |
| 1230 |
* |
| 1231 |
* Install a package of the newest and most correct version. |
| 1232 |
* |
| 1233 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 1234 |
* applications. |
| 1235 |
* |
| 1236 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 1237 |
* |
| 1238 |
* Since: 0.8.1 |
| 1239 |
**/ |
| 1240 |
PkResults * |
| 1241 |
pk_client_install_packages (PkClient *client, |
| 1242 |
PkBitfield transaction_flags, |
| 1243 |
gchar **package_ids, |
| 1244 |
GCancellable *cancellable, |
| 1245 |
PkProgressCallback progress_callback, |
| 1246 |
gpointer progress_user_data, |
| 1247 |
GError **error) |
| 1248 |
{ |
| 1249 |
PkClientHelper helper; |
| 1250 |
PkResults *results; |
| 1251 |
|
| 1252 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 1253 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 1254 |
|
| 1255 |
/* create temp object */ |
| 1256 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 1257 |
helper.context = g_main_context_new (); |
| 1258 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 1259 |
helper.error = error; |
| 1260 |
|
| 1261 |
g_main_context_push_thread_default (helper.context); |
| 1262 |
|
| 1263 |
/* run async method */ |
| 1264 |
pk_client_install_packages_async (client, transaction_flags, package_ids, cancellable, progress_callback, progress_user_data, |
| 1265 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 1266 |
|
| 1267 |
g_main_loop_run (helper.loop); |
| 1268 |
|
| 1269 |
results = helper.results; |
| 1270 |
|
| 1271 |
g_main_context_pop_thread_default (helper.context); |
| 1272 |
|
| 1273 |
/* free temp object */ |
| 1274 |
g_main_loop_unref (helper.loop); |
| 1275 |
g_main_context_unref (helper.context); |
| 1276 |
|
| 1277 |
return results; |
| 1278 |
} |
| 1279 |
|
| 1280 |
/** |
| 1281 |
* pk_client_install_signature: |
| 1282 |
* @client: a valid #PkClient instance |
| 1283 |
* @type: the signature type, e.g. %PK_SIGTYPE_ENUM_GPG |
| 1284 |
* @key_id: a key ID such as "0df23df" |
| 1285 |
* @package_id: a signature_id structure such as "hal;0.0.1;i386;fedora" |
| 1286 |
* @cancellable: a #GCancellable or %NULL |
| 1287 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 1288 |
* @progress_user_data: data to pass to @progress_callback |
| 1289 |
* @error: the #GError to store any failure, or %NULL |
| 1290 |
* |
| 1291 |
* Install a software repository signature of the newest and most correct version. |
| 1292 |
* |
| 1293 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 1294 |
* applications. |
| 1295 |
* |
| 1296 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 1297 |
* |
| 1298 |
* Since: 0.5.3 |
| 1299 |
**/ |
| 1300 |
PkResults * |
| 1301 |
pk_client_install_signature (PkClient *client, PkSigTypeEnum type, const gchar *key_id, const gchar *package_id, GCancellable *cancellable, |
| 1302 |
PkProgressCallback progress_callback, gpointer progress_user_data, GError **error) |
| 1303 |
{ |
| 1304 |
PkClientHelper helper; |
| 1305 |
PkResults *results; |
| 1306 |
|
| 1307 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 1308 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 1309 |
|
| 1310 |
/* create temp object */ |
| 1311 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 1312 |
helper.context = g_main_context_new (); |
| 1313 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 1314 |
helper.error = error; |
| 1315 |
|
| 1316 |
g_main_context_push_thread_default (helper.context); |
| 1317 |
|
| 1318 |
/* run async method */ |
| 1319 |
pk_client_install_signature_async (client, type, key_id, package_id, cancellable, progress_callback, progress_user_data, |
| 1320 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 1321 |
|
| 1322 |
g_main_loop_run (helper.loop); |
| 1323 |
|
| 1324 |
results = helper.results; |
| 1325 |
|
| 1326 |
g_main_context_pop_thread_default (helper.context); |
| 1327 |
|
| 1328 |
/* free temp object */ |
| 1329 |
g_main_loop_unref (helper.loop); |
| 1330 |
g_main_context_unref (helper.context); |
| 1331 |
|
| 1332 |
return results; |
| 1333 |
} |
| 1334 |
|
| 1335 |
/** |
| 1336 |
* pk_client_update_packages: |
| 1337 |
* @client: a valid #PkClient instance |
| 1338 |
* @transaction_flags: a transaction type bitfield |
| 1339 |
* @package_ids: (array zero-terminated=1): a null terminated array of package_id structures such as "hal;0.0.1;i386;fedora" |
| 1340 |
* @cancellable: a #GCancellable or %NULL |
| 1341 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 1342 |
* @progress_user_data: data to pass to @progress_callback |
| 1343 |
* @error: the #GError to store any failure, or %NULL |
| 1344 |
* |
| 1345 |
* Update specific packages to the newest available versions. |
| 1346 |
* |
| 1347 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 1348 |
* applications. |
| 1349 |
* |
| 1350 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 1351 |
* |
| 1352 |
* Since: 0.8.1 |
| 1353 |
**/ |
| 1354 |
PkResults * |
| 1355 |
pk_client_update_packages (PkClient *client, |
| 1356 |
PkBitfield transaction_flags, |
| 1357 |
gchar **package_ids, |
| 1358 |
GCancellable *cancellable, |
| 1359 |
PkProgressCallback progress_callback, |
| 1360 |
gpointer progress_user_data, |
| 1361 |
GError **error) |
| 1362 |
{ |
| 1363 |
PkClientHelper helper; |
| 1364 |
PkResults *results; |
| 1365 |
|
| 1366 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 1367 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 1368 |
|
| 1369 |
/* create temp object */ |
| 1370 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 1371 |
helper.context = g_main_context_new (); |
| 1372 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 1373 |
helper.error = error; |
| 1374 |
|
| 1375 |
g_main_context_push_thread_default (helper.context); |
| 1376 |
|
| 1377 |
/* run async method */ |
| 1378 |
pk_client_update_packages_async (client, transaction_flags, package_ids, cancellable, progress_callback, progress_user_data, |
| 1379 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 1380 |
|
| 1381 |
g_main_loop_run (helper.loop); |
| 1382 |
|
| 1383 |
results = helper.results; |
| 1384 |
|
| 1385 |
g_main_context_pop_thread_default (helper.context); |
| 1386 |
|
| 1387 |
/* free temp object */ |
| 1388 |
g_main_loop_unref (helper.loop); |
| 1389 |
g_main_context_unref (helper.context); |
| 1390 |
|
| 1391 |
return results; |
| 1392 |
} |
| 1393 |
|
| 1394 |
/** |
| 1395 |
* pk_client_install_files: |
| 1396 |
* @client: a valid #PkClient instance |
| 1397 |
* @transaction_flags: a transaction type bitfield |
| 1398 |
* @files: (array zero-terminated=1): a file such as "/home/hughsie/Desktop/hal-devel-0.10.0.rpm" |
| 1399 |
* @cancellable: a #GCancellable or %NULL |
| 1400 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 1401 |
* @progress_user_data: data to pass to @progress_callback |
| 1402 |
* @error: the #GError to store any failure, or %NULL |
| 1403 |
* |
| 1404 |
* Install a file locally, and get the deps from the repositories. |
| 1405 |
* This is useful for double clicking on a .rpm or .deb file. |
| 1406 |
* |
| 1407 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 1408 |
* applications. |
| 1409 |
* |
| 1410 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 1411 |
* |
| 1412 |
* Since: 0.8.1 |
| 1413 |
**/ |
| 1414 |
PkResults * |
| 1415 |
pk_client_install_files (PkClient *client, |
| 1416 |
PkBitfield transaction_flags, |
| 1417 |
gchar **files, |
| 1418 |
GCancellable *cancellable, |
| 1419 |
PkProgressCallback progress_callback, |
| 1420 |
gpointer progress_user_data, |
| 1421 |
GError **error) |
| 1422 |
{ |
| 1423 |
PkClientHelper helper; |
| 1424 |
PkResults *results; |
| 1425 |
|
| 1426 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 1427 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 1428 |
|
| 1429 |
/* create temp object */ |
| 1430 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 1431 |
helper.context = g_main_context_new (); |
| 1432 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 1433 |
helper.error = error; |
| 1434 |
|
| 1435 |
g_main_context_push_thread_default (helper.context); |
| 1436 |
|
| 1437 |
/* run async method */ |
| 1438 |
pk_client_install_files_async (client, transaction_flags, files, cancellable, progress_callback, progress_user_data, |
| 1439 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 1440 |
|
| 1441 |
g_main_loop_run (helper.loop); |
| 1442 |
|
| 1443 |
results = helper.results; |
| 1444 |
|
| 1445 |
g_main_context_pop_thread_default (helper.context); |
| 1446 |
|
| 1447 |
/* free temp object */ |
| 1448 |
g_main_loop_unref (helper.loop); |
| 1449 |
g_main_context_unref (helper.context); |
| 1450 |
|
| 1451 |
return results; |
| 1452 |
} |
| 1453 |
|
| 1454 |
/** |
| 1455 |
* pk_client_accept_eula: |
| 1456 |
* @client: a valid #PkClient instance |
| 1457 |
* @eula_id: the <literal>eula_id</literal> we are agreeing to |
| 1458 |
* @cancellable: a #GCancellable or %NULL |
| 1459 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 1460 |
* @progress_user_data: data to pass to @progress_callback |
| 1461 |
* @error: the #GError to store any failure, or %NULL |
| 1462 |
* |
| 1463 |
* We may want to agree to a EULA dialog if one is presented. |
| 1464 |
* |
| 1465 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 1466 |
* applications. |
| 1467 |
* |
| 1468 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 1469 |
* |
| 1470 |
* Since: 0.5.3 |
| 1471 |
**/ |
| 1472 |
PkResults * |
| 1473 |
pk_client_accept_eula (PkClient *client, const gchar *eula_id, GCancellable *cancellable, |
| 1474 |
PkProgressCallback progress_callback, gpointer progress_user_data, GError **error) |
| 1475 |
{ |
| 1476 |
PkClientHelper helper; |
| 1477 |
PkResults *results; |
| 1478 |
|
| 1479 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 1480 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 1481 |
|
| 1482 |
/* create temp object */ |
| 1483 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 1484 |
helper.context = g_main_context_new (); |
| 1485 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 1486 |
helper.error = error; |
| 1487 |
|
| 1488 |
g_main_context_push_thread_default (helper.context); |
| 1489 |
|
| 1490 |
/* run async method */ |
| 1491 |
pk_client_accept_eula_async (client, eula_id, cancellable, progress_callback, progress_user_data, |
| 1492 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 1493 |
|
| 1494 |
g_main_loop_run (helper.loop); |
| 1495 |
|
| 1496 |
results = helper.results; |
| 1497 |
|
| 1498 |
g_main_context_pop_thread_default (helper.context); |
| 1499 |
|
| 1500 |
/* free temp object */ |
| 1501 |
g_main_loop_unref (helper.loop); |
| 1502 |
g_main_context_unref (helper.context); |
| 1503 |
|
| 1504 |
return results; |
| 1505 |
} |
| 1506 |
|
| 1507 |
/** |
| 1508 |
* pk_client_get_repo_list: |
| 1509 |
* @client: a valid #PkClient instance |
| 1510 |
* @filters: a #PkBitfield such as %PK_FILTER_ENUM_DEVELOPMENT or %PK_FILTER_ENUM_NONE |
| 1511 |
* @cancellable: a #GCancellable or %NULL |
| 1512 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 1513 |
* @progress_user_data: data to pass to @progress_callback |
| 1514 |
* @error: the #GError to store any failure, or %NULL |
| 1515 |
* |
| 1516 |
* Get the list of repositories installed on the system. |
| 1517 |
* |
| 1518 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 1519 |
* applications. |
| 1520 |
* |
| 1521 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 1522 |
* |
| 1523 |
* Since: 0.5.3 |
| 1524 |
**/ |
| 1525 |
PkResults * |
| 1526 |
pk_client_get_repo_list (PkClient *client, PkBitfield filters, GCancellable *cancellable, |
| 1527 |
PkProgressCallback progress_callback, gpointer progress_user_data, GError **error) |
| 1528 |
{ |
| 1529 |
PkClientHelper helper; |
| 1530 |
PkResults *results; |
| 1531 |
|
| 1532 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 1533 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 1534 |
|
| 1535 |
/* create temp object */ |
| 1536 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 1537 |
helper.context = g_main_context_new (); |
| 1538 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 1539 |
helper.error = error; |
| 1540 |
|
| 1541 |
g_main_context_push_thread_default (helper.context); |
| 1542 |
|
| 1543 |
/* run async method */ |
| 1544 |
pk_client_get_repo_list_async (client, filters, cancellable, progress_callback, progress_user_data, |
| 1545 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 1546 |
|
| 1547 |
g_main_loop_run (helper.loop); |
| 1548 |
|
| 1549 |
results = helper.results; |
| 1550 |
|
| 1551 |
g_main_context_pop_thread_default (helper.context); |
| 1552 |
|
| 1553 |
/* free temp object */ |
| 1554 |
g_main_loop_unref (helper.loop); |
| 1555 |
g_main_context_unref (helper.context); |
| 1556 |
|
| 1557 |
return results; |
| 1558 |
} |
| 1559 |
|
| 1560 |
/** |
| 1561 |
* pk_client_repo_enable: |
| 1562 |
* @client: a valid #PkClient instance |
| 1563 |
* @repo_id: a repo_id structure such as "livna-devel" |
| 1564 |
* @enabled: if we should enable the repository |
| 1565 |
* @cancellable: a #GCancellable or %NULL |
| 1566 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 1567 |
* @progress_user_data: data to pass to @progress_callback |
| 1568 |
* @error: the #GError to store any failure, or %NULL |
| 1569 |
* |
| 1570 |
* Enable or disable the repository. |
| 1571 |
* |
| 1572 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 1573 |
* applications. |
| 1574 |
* |
| 1575 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 1576 |
* |
| 1577 |
* Since: 0.5.3 |
| 1578 |
**/ |
| 1579 |
PkResults * |
| 1580 |
pk_client_repo_enable (PkClient *client, const gchar *repo_id, gboolean enabled, GCancellable *cancellable, |
| 1581 |
PkProgressCallback progress_callback, gpointer progress_user_data, GError **error) |
| 1582 |
{ |
| 1583 |
PkClientHelper helper; |
| 1584 |
PkResults *results; |
| 1585 |
|
| 1586 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 1587 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 1588 |
|
| 1589 |
/* create temp object */ |
| 1590 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 1591 |
helper.context = g_main_context_new (); |
| 1592 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 1593 |
helper.error = error; |
| 1594 |
|
| 1595 |
g_main_context_push_thread_default (helper.context); |
| 1596 |
|
| 1597 |
/* run async method */ |
| 1598 |
pk_client_repo_enable_async (client, repo_id, enabled, cancellable, progress_callback, progress_user_data, |
| 1599 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 1600 |
|
| 1601 |
g_main_loop_run (helper.loop); |
| 1602 |
|
| 1603 |
results = helper.results; |
| 1604 |
|
| 1605 |
g_main_context_pop_thread_default (helper.context); |
| 1606 |
|
| 1607 |
/* free temp object */ |
| 1608 |
g_main_loop_unref (helper.loop); |
| 1609 |
g_main_context_unref (helper.context); |
| 1610 |
|
| 1611 |
return results; |
| 1612 |
} |
| 1613 |
|
| 1614 |
/** |
| 1615 |
* pk_client_repo_set_data: |
| 1616 |
* @client: a valid #PkClient instance |
| 1617 |
* @repo_id: a repo_id structure such as "livna-devel" |
| 1618 |
* @parameter: the parameter to change |
| 1619 |
* @value: what we should change it to |
| 1620 |
* @cancellable: a #GCancellable or %NULL |
| 1621 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 1622 |
* @progress_user_data: data to pass to @progress_callback |
| 1623 |
* @error: the #GError to store any failure, or %NULL |
| 1624 |
* |
| 1625 |
* We may want to set a repository parameter. |
| 1626 |
* NOTE: this is free text, and is left to the backend to define a format. |
| 1627 |
* |
| 1628 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 1629 |
* applications. |
| 1630 |
* |
| 1631 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 1632 |
* |
| 1633 |
* Since: 0.5.3 |
| 1634 |
**/ |
| 1635 |
PkResults * |
| 1636 |
pk_client_repo_set_data (PkClient *client, const gchar *repo_id, const gchar *parameter, const gchar *value, GCancellable *cancellable, |
| 1637 |
PkProgressCallback progress_callback, gpointer progress_user_data, GError **error) |
| 1638 |
{ |
| 1639 |
PkClientHelper helper; |
| 1640 |
PkResults *results; |
| 1641 |
|
| 1642 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 1643 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 1644 |
|
| 1645 |
/* create temp object */ |
| 1646 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 1647 |
helper.context = g_main_context_new (); |
| 1648 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 1649 |
helper.error = error; |
| 1650 |
|
| 1651 |
g_main_context_push_thread_default (helper.context); |
| 1652 |
|
| 1653 |
/* run async method */ |
| 1654 |
pk_client_repo_set_data_async (client, repo_id, parameter, value, cancellable, progress_callback, progress_user_data, |
| 1655 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 1656 |
|
| 1657 |
g_main_loop_run (helper.loop); |
| 1658 |
|
| 1659 |
results = helper.results; |
| 1660 |
|
| 1661 |
g_main_context_pop_thread_default (helper.context); |
| 1662 |
|
| 1663 |
/* free temp object */ |
| 1664 |
g_main_loop_unref (helper.loop); |
| 1665 |
g_main_context_unref (helper.context); |
| 1666 |
|
| 1667 |
return results; |
| 1668 |
} |
| 1669 |
|
| 1670 |
/** |
| 1671 |
* pk_client_repo_remove: |
| 1672 |
* @client: a valid #PkClient instance |
| 1673 |
* @transaction_flags: transaction flags |
| 1674 |
* @repo_id: a repo_id structure such as "livna-devel" |
| 1675 |
* @autoremove: If packages should be auto-removed |
| 1676 |
* @cancellable: a #GCancellable or %NULL |
| 1677 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 1678 |
* @progress_user_data: data to pass to @progress_callback |
| 1679 |
* @error: the #GError to store any failure, or %NULL |
| 1680 |
* |
| 1681 |
* Removes a repo and optionally the packages installed from it. |
| 1682 |
* |
| 1683 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 1684 |
* applications. |
| 1685 |
* |
| 1686 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 1687 |
* |
| 1688 |
* Since: 0.9.1 |
| 1689 |
**/ |
| 1690 |
PkResults * |
| 1691 |
pk_client_repo_remove (PkClient *client, |
| 1692 |
PkBitfield transaction_flags, |
| 1693 |
const gchar *repo_id, |
| 1694 |
gboolean autoremove, |
| 1695 |
GCancellable *cancellable, |
| 1696 |
PkProgressCallback progress_callback, |
| 1697 |
gpointer progress_user_data, |
| 1698 |
GError **error) |
| 1699 |
{ |
| 1700 |
PkClientHelper helper; |
| 1701 |
PkResults *results; |
| 1702 |
|
| 1703 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 1704 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 1705 |
|
| 1706 |
/* create temp object */ |
| 1707 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 1708 |
helper.context = g_main_context_new (); |
| 1709 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 1710 |
helper.error = error; |
| 1711 |
|
| 1712 |
g_main_context_push_thread_default (helper.context); |
| 1713 |
|
| 1714 |
/* run async method */ |
| 1715 |
pk_client_repo_remove_async (client, |
| 1716 |
transaction_flags, |
| 1717 |
repo_id, |
| 1718 |
autoremove, |
| 1719 |
cancellable, |
| 1720 |
progress_callback, |
| 1721 |
progress_user_data, |
| 1722 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, |
| 1723 |
&helper); |
| 1724 |
|
| 1725 |
g_main_loop_run (helper.loop); |
| 1726 |
|
| 1727 |
results = helper.results; |
| 1728 |
|
| 1729 |
g_main_context_pop_thread_default (helper.context); |
| 1730 |
|
| 1731 |
/* free temp object */ |
| 1732 |
g_main_loop_unref (helper.loop); |
| 1733 |
g_main_context_unref (helper.context); |
| 1734 |
|
| 1735 |
return results; |
| 1736 |
} |
| 1737 |
|
| 1738 |
/** |
| 1739 |
* pk_client_upgrade_system: |
| 1740 |
* @client: a valid #PkClient instance |
| 1741 |
* @distro_id: a distro ID such as "fedora-14" |
| 1742 |
* @transaction_flags: transaction flags |
| 1743 |
* @upgrade_kind: a #PkUpgradeKindEnum such as %PK_UPGRADE_KIND_ENUM_COMPLETE |
| 1744 |
* @cancellable: a #GCancellable or %NULL |
| 1745 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 1746 |
* @progress_user_data: data to pass to @progress_callback |
| 1747 |
* @error: the #GError to store any failure, or %NULL |
| 1748 |
* |
| 1749 |
* This transaction will upgrade the distro to the next version, which may |
| 1750 |
* involve just downloading the installer and setting up the boot device, |
| 1751 |
* or may involve doing an on-line upgrade. |
| 1752 |
* |
| 1753 |
* The backend will decide what is best to do. |
| 1754 |
* |
| 1755 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 1756 |
* applications. |
| 1757 |
* |
| 1758 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 1759 |
* |
| 1760 |
* Since: 1.0.10 |
| 1761 |
**/ |
| 1762 |
PkResults * |
| 1763 |
pk_client_upgrade_system (PkClient *client, PkBitfield transaction_flags, |
| 1764 |
const gchar *distro_id, PkUpgradeKindEnum upgrade_kind, |
| 1765 |
GCancellable *cancellable, |
| 1766 |
PkProgressCallback progress_callback, gpointer progress_user_data, GError **error) |
| 1767 |
{ |
| 1768 |
PkClientHelper helper; |
| 1769 |
PkResults *results; |
| 1770 |
|
| 1771 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 1772 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 1773 |
|
| 1774 |
/* create temp object */ |
| 1775 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 1776 |
helper.context = g_main_context_new (); |
| 1777 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 1778 |
helper.error = error; |
| 1779 |
|
| 1780 |
g_main_context_push_thread_default (helper.context); |
| 1781 |
|
| 1782 |
/* run async method */ |
| 1783 |
pk_client_upgrade_system_async (client, transaction_flags, distro_id, upgrade_kind, |
| 1784 |
cancellable, progress_callback, progress_user_data, |
| 1785 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 1786 |
|
| 1787 |
g_main_loop_run (helper.loop); |
| 1788 |
|
| 1789 |
results = helper.results; |
| 1790 |
|
| 1791 |
g_main_context_pop_thread_default (helper.context); |
| 1792 |
|
| 1793 |
/* free temp object */ |
| 1794 |
g_main_loop_unref (helper.loop); |
| 1795 |
g_main_context_unref (helper.context); |
| 1796 |
|
| 1797 |
return results; |
| 1798 |
} |
| 1799 |
|
| 1800 |
/** |
| 1801 |
* pk_client_repair_system: |
| 1802 |
* @client: a valid #PkClient instance |
| 1803 |
* @transaction_flags: if only trusted packages should be installed |
| 1804 |
* @cancellable: a #GCancellable or %NULL |
| 1805 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 1806 |
* @progress_user_data: data to pass to @progress_callback |
| 1807 |
* @error: the #GError to store any failure, or %NULL |
| 1808 |
* |
| 1809 |
* This transaction will try to recover from a broken package management system: |
| 1810 |
* e.g. the installation of a package with unsatisfied dependencies has |
| 1811 |
* been forced by using a low level tool (rpm or dpkg) or the |
| 1812 |
* system was shutdown during processing an installation. |
| 1813 |
* |
| 1814 |
* The backend will decide what is best to do. |
| 1815 |
* |
| 1816 |
* Warning: this function is synchronous, and may block. Do not use it in GUI |
| 1817 |
* applications. |
| 1818 |
* |
| 1819 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 1820 |
* |
| 1821 |
* Since: 0.8.1 |
| 1822 |
**/ |
| 1823 |
PkResults * |
| 1824 |
pk_client_repair_system (PkClient *client, |
| 1825 |
PkBitfield transaction_flags, |
| 1826 |
GCancellable *cancellable, |
| 1827 |
PkProgressCallback progress_callback, |
| 1828 |
gpointer progress_user_data, |
| 1829 |
GError **error) |
| 1830 |
{ |
| 1831 |
PkClientHelper helper; |
| 1832 |
PkResults *results; |
| 1833 |
|
| 1834 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 1835 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 1836 |
|
| 1837 |
/* create temp object */ |
| 1838 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 1839 |
helper.context = g_main_context_new (); |
| 1840 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 1841 |
helper.error = error; |
| 1842 |
|
| 1843 |
g_main_context_push_thread_default (helper.context); |
| 1844 |
|
| 1845 |
/* run async method */ |
| 1846 |
pk_client_repair_system_async (client, |
| 1847 |
transaction_flags, |
| 1848 |
cancellable, |
| 1849 |
progress_callback, |
| 1850 |
progress_user_data, |
| 1851 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, |
| 1852 |
&helper); |
| 1853 |
|
| 1854 |
g_main_loop_run (helper.loop); |
| 1855 |
|
| 1856 |
results = helper.results; |
| 1857 |
|
| 1858 |
g_main_context_pop_thread_default (helper.context); |
| 1859 |
|
| 1860 |
/* free temp object */ |
| 1861 |
g_main_loop_unref (helper.loop); |
| 1862 |
g_main_context_unref (helper.context); |
| 1863 |
|
| 1864 |
return results; |
| 1865 |
} |
| 1866 |
|
| 1867 |
/** |
| 1868 |
* pk_client_adopt: |
| 1869 |
* @client: a valid #PkClient instance |
| 1870 |
* @transaction_id: a transaction ID such as "/21_ebcbdaae_data" |
| 1871 |
* @cancellable: a #GCancellable or %NULL |
| 1872 |
* @progress_callback: (scope call): the function to run when the progress changes |
| 1873 |
* @progress_user_data: data to pass to @progress_callback |
| 1874 |
* @error: the #GError to store any failure, or %NULL |
| 1875 |
* |
| 1876 |
* Adopt a transaction. |
| 1877 |
* |
| 1878 |
* Warning: this function is synchronous, and will block. Do not use it in GUI |
| 1879 |
* applications. |
| 1880 |
* |
| 1881 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 1882 |
* |
| 1883 |
* Since: 0.5.3 |
| 1884 |
**/ |
| 1885 |
PkResults * |
| 1886 |
pk_client_adopt (PkClient *client, const gchar *transaction_id, GCancellable *cancellable, |
| 1887 |
PkProgressCallback progress_callback, gpointer progress_user_data, GError **error) |
| 1888 |
{ |
| 1889 |
PkClientHelper helper; |
| 1890 |
PkResults *results; |
| 1891 |
|
| 1892 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 1893 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 1894 |
|
| 1895 |
/* create temp object */ |
| 1896 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 1897 |
helper.context = g_main_context_new (); |
| 1898 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 1899 |
helper.error = error; |
| 1900 |
|
| 1901 |
g_main_context_push_thread_default (helper.context); |
| 1902 |
|
| 1903 |
/* run async method */ |
| 1904 |
pk_client_adopt_async (client, transaction_id, cancellable, progress_callback, progress_user_data, |
| 1905 |
(GAsyncReadyCallback) pk_client_generic_finish_sync, &helper); |
| 1906 |
|
| 1907 |
g_main_loop_run (helper.loop); |
| 1908 |
|
| 1909 |
results = helper.results; |
| 1910 |
|
| 1911 |
g_main_context_pop_thread_default (helper.context); |
| 1912 |
|
| 1913 |
/* free temp object */ |
| 1914 |
g_main_loop_unref (helper.loop); |
| 1915 |
g_main_context_unref (helper.context); |
| 1916 |
|
| 1917 |
return results; |
| 1918 |
} |
| 1919 |
|
| 1920 |
/* |
| 1921 |
* pk_client_get_progress_finish_sync: |
| 1922 |
**/ |
| 1923 |
static void |
| 1924 |
pk_client_get_progress_finish_sync (PkClient *client, GAsyncResult *res, PkClientHelper *helper) |
| 1925 |
{ |
| 1926 |
PkProgress *progress; |
| 1927 |
progress = pk_client_get_progress_finish (client, res, helper->error); |
| 1928 |
if (progress != NULL) { |
| 1929 |
helper->progress = g_object_ref (progress); |
| 1930 |
g_object_unref (progress); |
| 1931 |
} |
| 1932 |
g_main_loop_quit (helper->loop); |
| 1933 |
} |
| 1934 |
|
| 1935 |
/** |
| 1936 |
* pk_client_get_progress: |
| 1937 |
* @client: a valid #PkClient instance |
| 1938 |
* @transaction_id: The transaction id |
| 1939 |
* @cancellable: a #GCancellable or %NULL |
| 1940 |
* @error: the #GError to store any failure, or %NULL |
| 1941 |
* |
| 1942 |
* Get the progress of a transaction. |
| 1943 |
* |
| 1944 |
* Warning: this function is synchronous, and will block. Do not use it in GUI |
| 1945 |
* applications. |
| 1946 |
* |
| 1947 |
* Return value: (transfer full): a #PkResults object, or %NULL for error |
| 1948 |
* |
| 1949 |
* Since: 0.5.3 |
| 1950 |
**/ |
| 1951 |
PkProgress * |
| 1952 |
pk_client_get_progress (PkClient *client, const gchar *transaction_id, GCancellable *cancellable, GError **error) |
| 1953 |
{ |
| 1954 |
PkClientHelper helper; |
| 1955 |
PkProgress *progress; |
| 1956 |
|
| 1957 |
g_return_val_if_fail (PK_IS_CLIENT (client), NULL); |
| 1958 |
g_return_val_if_fail (error == NULL || *error == NULL, NULL); |
| 1959 |
|
| 1960 |
/* create temp object */ |
| 1961 |
memset (&helper, 0, sizeof (PkClientHelper)); |
| 1962 |
helper.context = g_main_context_new (); |
| 1963 |
helper.loop = g_main_loop_new (helper.context, FALSE); |
| 1964 |
helper.error = error; |
| 1965 |
|
| 1966 |
g_main_context_push_thread_default (helper.context); |
| 1967 |
|
| 1968 |
/* run async method */ |
| 1969 |
pk_client_get_progress_async (client, transaction_id, cancellable, |
| 1970 |
(GAsyncReadyCallback) pk_client_get_progress_finish_sync, &helper); |
| 1971 |
|
| 1972 |
g_main_loop_run (helper.loop); |
| 1973 |
|
| 1974 |
progress = helper.progress; |
| 1975 |
|
| 1976 |
g_main_context_pop_thread_default (helper.context); |
| 1977 |
|
| 1978 |
/* free temp object */ |
| 1979 |
g_main_loop_unref (helper.loop); |
| 1980 |
g_main_context_unref (helper.context); |
| 1981 |
|
| 1982 |
return progress; |
| 1983 |
} |
| 1984 |
|