[gnome-software] flatpak: Set no-interaction option on transaction where possible
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] flatpak: Set no-interaction option on transaction where possible
- Date: Wed, 10 Jun 2020 12:20:29 +0000 (UTC)
commit 95c0802c77c273d3783369c4a773e9f2270cb5aa
Author: Philip Withnall <withnall endlessm com>
Date: Wed Jun 10 10:29:28 2020 +0100
flatpak: Set no-interaction option on transaction where possible
The final release of flatpak 1.7.3 contained a new
`flatpak_transaction_set_no_interaction()` API which allows the
interactivity state to be set on the transaction, rather than on the
installation.
This commit reworks commit ebbd1b2d0a1 (!283) to use the new API where
possible. It doesn’t bump gnome-software’s hard dependency on flatpak.
It’s a (future) code cleanup more than a behaviour change.
Signed-off-by: Philip Withnall <withnall endlessm com>
plugins/flatpak/gs-plugin-flatpak.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
---
diff --git a/plugins/flatpak/gs-plugin-flatpak.c b/plugins/flatpak/gs-plugin-flatpak.c
index 4d6a81ba..e3278b36 100644
--- a/plugins/flatpak/gs-plugin-flatpak.c
+++ b/plugins/flatpak/gs-plugin-flatpak.c
@@ -461,12 +461,15 @@ _build_transaction (GsPlugin *plugin, GsFlatpak *flatpak,
GCancellable *cancellable, GError **error)
{
FlatpakInstallation *installation;
+#if !FLATPAK_CHECK_VERSION(1, 7, 3)
g_autoptr(GFile) installation_path = NULL;
+#endif /* flatpak < 1.7.3 */
g_autoptr(FlatpakInstallation) installation_clone = NULL;
g_autoptr(FlatpakTransaction) transaction = NULL;
installation = gs_flatpak_get_installation (flatpak);
+#if !FLATPAK_CHECK_VERSION(1, 7, 3)
/* Operate on a copy of the installation so we can set the interactive
* flag for the duration of this transaction. */
installation_path = flatpak_installation_get_path (installation);
@@ -479,6 +482,9 @@ _build_transaction (GsPlugin *plugin, GsFlatpak *flatpak,
/* Let flatpak know if it is a background operation */
flatpak_installation_set_no_interaction (installation_clone,
!gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE));
+#else /* if flatpak ≥ 1.7.3 */
+ installation_clone = g_object_ref (installation);
+#endif /* flatpak ≥ 1.7.3 */
/* create transaction */
transaction = gs_flatpak_transaction_new (installation_clone, cancellable, error);
@@ -488,6 +494,12 @@ _build_transaction (GsPlugin *plugin, GsFlatpak *flatpak,
return NULL;
}
+#if FLATPAK_CHECK_VERSION(1, 7, 3)
+ /* Let flatpak know if it is a background operation */
+ flatpak_transaction_set_no_interaction (transaction,
+ !gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE));
+#endif /* flatpak ≥ 1.7.3 */
+
/* connect up signals */
g_signal_connect (transaction, "ref-to-app",
G_CALLBACK (_ref_to_app), plugin);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]