mirror of
https://github.com/flatpak/flatpak.git
synced 2026-01-26 14:13:26 +00:00
app: Add flatpak cli constructor
This lets us centralize in one place all setup needed for cli use of FlatpakTransactions (like interaction and progress).
This commit is contained in:
parent
7b24103321
commit
cca9005a3a
@ -43,6 +43,8 @@ flatpak_SOURCES = \
|
||||
app/flatpak-table-printer.h \
|
||||
app/flatpak-complete.c \
|
||||
app/flatpak-complete.h \
|
||||
app/flatpak-cli-transaction.c \
|
||||
app/flatpak-cli-transaction.h \
|
||||
app/parse-datetime.h \
|
||||
$(NULL)
|
||||
|
||||
|
||||
@ -33,8 +33,7 @@
|
||||
|
||||
#include "flatpak-builtins.h"
|
||||
#include "flatpak-builtins-utils.h"
|
||||
#include "flatpak-transaction-private.h"
|
||||
#include "flatpak-transaction.h"
|
||||
#include "flatpak-cli-transaction.h"
|
||||
#include "flatpak-utils-private.h"
|
||||
#include "flatpak-error.h"
|
||||
#include "flatpak-chain-input-stream-private.h"
|
||||
@ -288,8 +287,7 @@ install_bundle (FlatpakDir *dir,
|
||||
if (!flatpak_dir_ensure_repo (dir, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
transaction = flatpak_transaction_new (dir);
|
||||
flatpak_transaction_set_disable_interaction (transaction, opt_yes);
|
||||
transaction = flatpak_cli_transaction_new (dir, opt_yes);
|
||||
flatpak_transaction_set_no_pull (transaction, opt_no_pull);
|
||||
flatpak_transaction_set_no_deploy (transaction, opt_no_deploy);
|
||||
flatpak_transaction_set_disable_static_deltas (transaction, opt_no_static_deltas);
|
||||
@ -448,8 +446,7 @@ install_from (FlatpakDir *dir,
|
||||
slash = strchr (ref, '/');
|
||||
g_print (_("Installing: %s\n"), slash + 1);
|
||||
|
||||
transaction = flatpak_transaction_new (clone);
|
||||
flatpak_transaction_set_disable_interaction (transaction, opt_yes);
|
||||
transaction = flatpak_cli_transaction_new (clone, opt_yes);
|
||||
flatpak_transaction_set_no_pull (transaction, opt_no_pull);
|
||||
flatpak_transaction_set_no_deploy (transaction, opt_no_deploy);
|
||||
flatpak_transaction_set_disable_static_deltas (transaction, opt_no_static_deltas);
|
||||
@ -533,8 +530,7 @@ flatpak_builtin_install (int argc, char **argv, GCancellable *cancellable, GErro
|
||||
default_branch = flatpak_dir_get_remote_default_branch (dir, remote);
|
||||
kinds = flatpak_kinds_from_bools (opt_app, opt_runtime);
|
||||
|
||||
transaction = flatpak_transaction_new (dir);
|
||||
flatpak_transaction_set_disable_interaction (transaction, opt_yes);
|
||||
transaction = flatpak_cli_transaction_new (dir, opt_yes);
|
||||
flatpak_transaction_set_no_pull (transaction, opt_no_pull);
|
||||
flatpak_transaction_set_no_deploy (transaction, opt_no_deploy);
|
||||
flatpak_transaction_set_disable_static_deltas (transaction, opt_no_static_deltas);
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
#include "flatpak-builtins.h"
|
||||
#include "flatpak-builtins-utils.h"
|
||||
#include "flatpak-transaction-private.h"
|
||||
#include "flatpak-cli-transaction.h"
|
||||
#include "flatpak-utils-private.h"
|
||||
#include "flatpak-error.h"
|
||||
|
||||
@ -110,8 +110,7 @@ flatpak_builtin_update (int argc,
|
||||
|
||||
for (k = 0; k < dirs->len; k++)
|
||||
{
|
||||
FlatpakTransaction *transaction = flatpak_transaction_new (g_ptr_array_index (dirs, k));
|
||||
flatpak_transaction_set_disable_interaction (transaction, opt_yes);
|
||||
FlatpakTransaction *transaction = flatpak_cli_transaction_new (g_ptr_array_index (dirs, k), opt_yes);
|
||||
flatpak_transaction_set_no_pull (transaction, opt_no_pull);
|
||||
flatpak_transaction_set_no_deploy (transaction, opt_no_deploy);
|
||||
flatpak_transaction_set_disable_static_deltas (transaction, opt_no_static_deltas);
|
||||
|
||||
33
app/flatpak-cli-transaction.c
Normal file
33
app/flatpak-cli-transaction.c
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright © 2018 Red Hat, Inc
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors:
|
||||
* Alexander Larsson <alexl@redhat.com>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "flatpak-cli-transaction.h"
|
||||
#include "flatpak-transaction-private.h"
|
||||
|
||||
FlatpakTransaction *
|
||||
flatpak_cli_transaction_new (FlatpakDir *dir,
|
||||
gboolean disable_interaction)
|
||||
{
|
||||
FlatpakTransaction *transaction = flatpak_transaction_new (dir);
|
||||
flatpak_transaction_set_disable_interaction (transaction, disable_interaction);
|
||||
return transaction;
|
||||
}
|
||||
30
app/flatpak-cli-transaction.h
Normal file
30
app/flatpak-cli-transaction.h
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright © 2018 Red Hat, Inc
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors:
|
||||
* Alexander Larsson <alexl@redhat.com>
|
||||
*/
|
||||
|
||||
#ifndef __FLATPAK_CLI_TRANSACTION_H__
|
||||
#define __FLATPAK_CLI_TRANSACTION_H__
|
||||
|
||||
#include "flatpak-transaction.h"
|
||||
#include "flatpak-dir-private.h"
|
||||
|
||||
FlatpakTransaction *flatpak_cli_transaction_new (FlatpakDir *dir,
|
||||
gboolean disable_interaction);
|
||||
|
||||
#endif /* __FLATPAK_CLI_TRANSACTION_H__ */
|
||||
Loading…
x
Reference in New Issue
Block a user