Top | ![]() |
![]() |
![]() |
![]() |
FlatpakTransaction is an object representing an install/update
transaction. You create an object like this using flatpak_transaction_new_for_installation()
and then you add all the operations (installs, updates, etc) you wish to do. Then
you start the transaction with flatpak_transaction_run()
which will resolve all kinds
of dependencies and report progress and status while downloading and installing these.
A transaction is a blocking operation, and all signals are emitted in the same thread. This means you should either handle the signals directly (say, by doing blocking console interaction, or by just returning without interaction), or run the operation in a separate thread and do your own forwarding to the GUI thread.
FlatpakTransaction * flatpak_transaction_new_for_installation (FlatpakInstallation *installation
,GCancellable *cancellable
,GError **error
);
Creates a new FlatpakTransaction object that can be used to do installation
and updates of multiple refs, as well as their dependencies, in a single
operation. Set the options you want on the transaction and add the
refs you want to install/update, then start the transaction with
flatpak_transaction_run()
.
gboolean flatpak_transaction_add_install (FlatpakTransaction *self
,const char *remote
,const char *ref
,const char **subpaths
,GError **error
);
Adds installing the given ref to this transaction.
gboolean flatpak_transaction_add_install_bundle (FlatpakTransaction *self
,GFile *file
,GBytes *gpg_data
,GError **error
);
Adds installing the given bundle to this transaction.
gboolean flatpak_transaction_add_install_flatpakref (FlatpakTransaction *self
,GBytes *flatpakref_data
,GError **error
);
gboolean flatpak_transaction_add_update (FlatpakTransaction *self
,const char *ref
,const char **subpaths
,const char *commit
,GError **error
);
Adds updating the given ref to this transaction.
gboolean flatpak_transaction_add_uninstall (FlatpakTransaction *self
,const char *ref
,GError **error
);
Adds uninstalling the given ref to this transaction.
void
flatpak_transaction_add_default_dependency_sources
(FlatpakTransaction *self
);
Similar to flatpak_transaction_add_dependency_source()
, but adds
all the default installations, which means all the defined system-wide
(but not per-user) installations.
void flatpak_transaction_add_dependency_source (FlatpakTransaction *self
,FlatpakInstallation *installation
);
Adds an extra installation as a source for application dependencies. This means that applications can be installed in this transaction relying on runtimes from this additional installation (wheres it would normally install required runtimes that are not installed in the installation the transaction works on).
gboolean flatpak_transaction_run (FlatpakTransaction *self
,GCancellable *cancellable
,GError **error
);
FlatpakTransactionOperation *
flatpak_transaction_get_current_operation
(FlatpakTransaction *self
);
Gets the current operation.
FlatpakInstallation *
flatpak_transaction_get_installation (FlatpakTransaction *self
);
Gets the installation this transaction was created for.
GList *
flatpak_transaction_get_operations (FlatpakTransaction *self
);
Gets the list of operations.
void flatpak_transaction_set_disable_dependencies (FlatpakTransaction *self
,gboolean disable_dependencies
);
void flatpak_transaction_set_disable_prune (FlatpakTransaction *self
,gboolean disable_prune
);
void flatpak_transaction_set_disable_related (FlatpakTransaction *self
,gboolean disable_related
);
void flatpak_transaction_set_disable_static_deltas (FlatpakTransaction *self
,gboolean disable_static_deltas
);
void flatpak_transaction_set_no_deploy (FlatpakTransaction *self
,gboolean no_deploy
);
void flatpak_transaction_set_no_pull (FlatpakTransaction *self
,gboolean no_pull
);
void flatpak_transaction_set_reinstall (FlatpakTransaction *self
,gboolean reinstall
);
void flatpak_transaction_set_force_uninstall (FlatpakTransaction *self
,gboolean force_uninstall
);
void flatpak_transaction_set_default_arch (FlatpakTransaction *self
,const char *arch
);
The type of a FlatpakTransactionOperation.
“installation”
property“installation” FlatpakInstallation *
The installation instance.
Flags: Read / Write / Construct Only
“add-new-remote”
signalgboolean user_function (FlatpakTransaction *object, gint reason, gchar *from_id, gchar *suggested_remote_name, gchar *url, gpointer user_data)
As part of the transaction, it is required or recommended
that a new remote is added, for the reason described in reason
.
Return TRUE
to add it.
object |
||
reason |
A FlatpakTransactionRemoteReason for this suggestion |
|
from_id |
The id of the app/runtime |
|
suggested_remote_name |
The suggested remote name |
|
url |
The repo url |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“choose-remote-for-ref”
signalgint user_function (FlatpakTransaction *object, gchar *for_ref, gchar *runtime_ref, GStrv remotes, gpointer user_data)
object |
||
for_ref |
The ref we are installing |
|
runtime_ref |
The ref we are looking for |
|
remotes |
the remotes that has the ref, sorted in prio order |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“end-of-lifed”
signalvoid user_function (FlatpakTransaction *object, gchar *ref, gchar *reason, gchar *rebase, gpointer user_data)
Flags: Run Last
“new-operation”
signalvoid user_function (FlatpakTransaction *object, FlatpakTransactionOperation *operation, FlatpakTransactionProgress *progress, gpointer user_data)
object |
||
operation |
The new FlatpakTransactionOperation |
|
progress |
A FlatpakTransactionProgress for |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“operation-done”
signalvoid user_function (FlatpakTransaction *object, FlatpakTransactionOperation *operation, gint result, gpointer user_data)
object |
||
operation |
The FlatpakTransactionOperation which finished |
|
result |
A FlatpakTransactionResult giving details about the result |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“operation-error”
signalgboolean user_function (FlatpakTransaction *object, FlatpakTransactionOperation *operation, GError *error, gint details, gpointer user_data)
object |
||
operation |
The FlatpakTransactionOperation which failed |
|
error |
A GError |
|
details |
A FlatpakTransactionErrorDetails with details about the error |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“ready”
signalgboolean user_function (FlatpakTransaction *object, gpointer user_data)
This is is emitted when all the refs involved in the operation have been
resolved to commits. At this point flatpak_transaction_get_operations()
will return all the operations that will be executed as part of the
transaction. If this returns FALSE, the operation is aborted.
Flags: Run Last