Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
Discover
Commits
4dbaffd2
Commit
4dbaffd2
authored
May 01, 2021
by
Aleix Pol Gonzalez
🐧
Browse files
flatpak: use the right API for installing flatpakref apps
Ports away from deprecated API
parent
e4b7a854
Changes
1
Hide whitespace changes
Inline
Side-by-side
libdiscover/backends/FlatpakBackend/FlatpakTransactionThread.cpp
View file @
4dbaffd2
...
...
@@ -95,22 +95,29 @@ void FlatpakTransactionThread::run()
bool
correct
=
false
;
if
(
m_app
->
state
()
==
AbstractResource
::
Upgradeable
&&
m_app
->
isInstalled
())
{
correct
=
flatpak_transaction_add_update
(
m_transaction
,
refName
.
toUtf8
().
constData
(),
nullptr
,
nullptr
,
&
localError
);
}
else
{
if
(
m_app
->
flatpakFileType
()
==
QLatin1String
(
"flatpak"
))
{
g_autoptr
(
GFile
)
file
=
g_file_new_for_path
(
m_app
->
resourceFile
().
toLocalFile
().
toUtf8
().
constData
());
if
(
!
file
)
{
qWarning
()
<<
"Failed to install bundled application"
<<
refName
;
m_result
=
false
;
return
;
}
correct
=
flatpak_transaction_add_install_bundle
(
m_transaction
,
file
,
nullptr
,
&
localError
);
}
else
{
correct
=
flatpak_transaction_add_install
(
m_transaction
,
//
m_app
->
origin
().
toUtf8
().
constData
(),
refName
.
toUtf8
().
constData
(),
nullptr
,
&
localError
);
}
else
if
(
m_app
->
flatpakFileType
()
==
QLatin1String
(
"flatpak"
))
{
g_autoptr
(
GFile
)
file
=
g_file_new_for_path
(
m_app
->
resourceFile
().
toLocalFile
().
toUtf8
().
constData
());
if
(
!
file
)
{
qWarning
()
<<
"Failed to install bundled application"
<<
refName
;
m_result
=
false
;
return
;
}
correct
=
flatpak_transaction_add_install_bundle
(
m_transaction
,
file
,
nullptr
,
&
localError
);
}
else
if
(
m_app
->
flatpakFileType
()
==
QLatin1String
(
"flatpakref"
)
&&
m_app
->
resourceFile
().
isLocalFile
())
{
g_autoptr
(
GFile
)
file
=
g_file_new_for_path
(
m_app
->
resourceFile
().
toLocalFile
().
toUtf8
().
constData
());
if
(
!
file
)
{
qWarning
()
<<
"Failed to install flatpakref application"
<<
refName
;
m_result
=
false
;
return
;
}
g_autoptr
(
GBytes
)
bytes
=
g_file_load_bytes
(
file
,
m_cancellable
,
nullptr
,
&
localError
);
correct
=
flatpak_transaction_add_install_flatpakref
(
m_transaction
,
bytes
,
&
localError
);
}
else
{
correct
=
flatpak_transaction_add_install
(
m_transaction
,
//
m_app
->
origin
().
toUtf8
().
constData
(),
refName
.
toUtf8
().
constData
(),
nullptr
,
&
localError
);
}
if
(
!
correct
)
{
...
...
@@ -118,7 +125,7 @@ void FlatpakTransactionThread::run()
m_errorMessage
=
QString
::
fromUtf8
(
localError
->
message
);
// We are done so we can set the progress to 100
setProgress
(
100
);
qWarning
()
<<
"Failed to install"
<<
refName
<<
':'
<<
m_errorMessage
;
qWarning
()
<<
"Failed to install"
<<
m_app
->
flatpakFileType
()
<<
refName
<<
':'
<<
m_errorMessage
;
return
;
}
}
else
if
(
m_role
==
Transaction
::
Role
::
RemoveRole
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment