[gnome-software/wip/ubuntu-master] apt: Use GCancellable for transactions
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/ubuntu-master] apt: Use GCancellable for transactions
- Date: Wed, 26 Apr 2017 04:01:14 +0000 (UTC)
commit 7db73cbf9d485910ec39abd70037476f11069ef8
Author: Robert Ancell <robert ancell canonical com>
Date: Thu Apr 13 16:14:48 2017 +1200
apt: Use GCancellable for transactions
plugins/apt/gs-plugin-apt.cc | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/plugins/apt/gs-plugin-apt.cc b/plugins/apt/gs-plugin-apt.cc
index c88a883..8ab1b30 100644
--- a/plugins/apt/gs-plugin-apt.cc
+++ b/plugins/apt/gs-plugin-apt.cc
@@ -844,6 +844,7 @@ aptd_transaction (GsPlugin *plugin,
GsApp *app,
GList *apps,
GVariant *parameters,
+ GCancellable *cancellable,
GError **error)
{
g_autoptr(GDBusConnection) conn = NULL;
@@ -861,7 +862,7 @@ aptd_transaction (GsPlugin *plugin,
data.cond = cond;
data.finished = FALSE;
- conn = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, error);
+ conn = g_bus_get_sync (G_BUS_TYPE_SYSTEM, cancellable, error);
if (conn == NULL)
return FALSE;
@@ -877,7 +878,7 @@ aptd_transaction (GsPlugin *plugin,
G_VARIANT_TYPE ("(s)"),
G_DBUS_CALL_FLAGS_NONE,
-1,
- NULL,
+ cancellable,
error);
if (result == NULL)
return FALSE;
@@ -923,7 +924,7 @@ aptd_transaction (GsPlugin *plugin,
G_VARIANT_TYPE ("()"),
G_DBUS_CALL_FLAGS_NONE,
-1,
- NULL,
+ cancellable,
error);
if (result) {
@@ -977,14 +978,14 @@ gs_plugin_app_install (GsPlugin *plugin,
case AS_APP_STATE_AVAILABLE:
case AS_APP_STATE_UPDATABLE:
gs_app_set_state (app, AS_APP_STATE_INSTALLING);
- success = aptd_transaction (plugin, "InstallPackages", app, NULL, NULL, error);
+ success = aptd_transaction (plugin, "InstallPackages", app, NULL, NULL, cancellable, error);
break;
case AS_APP_STATE_AVAILABLE_LOCAL:
filename = g_file_get_path (gs_app_get_local_file (app));
gs_app_set_state (app, AS_APP_STATE_INSTALLING);
success = aptd_transaction (plugin, "InstallFile", app, NULL,
g_variant_new_parsed ("(%s, true)", filename),
- error);
+ cancellable, error);
break;
default:
g_set_error (error,
@@ -1017,7 +1018,7 @@ gs_plugin_app_remove (GsPlugin *plugin,
return TRUE;
gs_app_set_state (app, AS_APP_STATE_REMOVING);
- if (aptd_transaction (plugin, "RemovePackages", app, NULL, NULL, error))
+ if (aptd_transaction (plugin, "RemovePackages", app, NULL, NULL, cancellable, error))
gs_app_set_state (app, AS_APP_STATE_AVAILABLE);
else {
gs_app_set_state (app, AS_APP_STATE_INSTALLED);
@@ -1037,7 +1038,7 @@ gs_plugin_refresh (GsPlugin *plugin,
if ((flags & GS_PLUGIN_REFRESH_FLAGS_METADATA) == 0)
return TRUE;
- if (!aptd_transaction (plugin, "UpdateCache", NULL, NULL, NULL, error))
+ if (!aptd_transaction (plugin, "UpdateCache", NULL, NULL, NULL, cancellable, error))
return FALSE;
unload_apt_db (plugin);
@@ -1125,7 +1126,7 @@ gs_plugin_update (GsPlugin *plugin,
NULL,
apps,
g_variant_new_parsed ("(false,)"),
- error)) {
+ cancellable, error)) {
set_list_state (apps, AS_APP_STATE_INSTALLED);
unload_apt_db (plugin);
@@ -1176,7 +1177,7 @@ gs_plugin_update_app (GsPlugin *plugin,
app,
NULL,
g_variant_builder_end (&builder),
- error)) {
+ cancellable, error)) {
gs_app_set_state (app, AS_APP_STATE_INSTALLED);
for (i = 0; i < apps->len; i++)
@@ -1198,7 +1199,7 @@ gs_plugin_update_app (GsPlugin *plugin,
} else if (app_is_ours (app)) {
gs_app_set_state (app, AS_APP_STATE_INSTALLING);
- if (aptd_transaction (plugin, "UpgradePackages", app, NULL, NULL, error)) {
+ if (aptd_transaction (plugin, "UpgradePackages", app, NULL, NULL, cancellable, error)) {
gs_app_set_state (app, AS_APP_STATE_INSTALLED);
unload_apt_db (plugin);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]