Skip to content
GitLab
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
06821351
Commit
06821351
authored
Jan 12, 2021
by
Aleix Pol Gonzalez
🐧
Browse files
flatpak: process runtimes before apps
Makes the process a bit more fluid, as apps look for runtimes
parent
537b9222
Changes
1
Hide whitespace changes
Inline
Side-by-side
libdiscover/backends/FlatpakBackend/FlatpakBackend.cpp
View file @
06821351
...
...
@@ -258,7 +258,7 @@ FlatpakResource * FlatpakBackend::getRuntimeForApp(FlatpakResource *resource) co
// TODO if runtime wasn't found, create a new one from available info
if
(
!
runtime
)
{
qWarning
()
<<
"could not find runtime"
<<
runtime
Info
<<
resource
;
qWarning
()
<<
"could not find runtime"
<<
runtime
Name
<<
resource
;
}
return
runtime
;
...
...
@@ -655,10 +655,18 @@ void FlatpakBackend::integrateRemote(FlatpakInstallation *flatpakInstallation, F
const
auto
sourceName
=
source
.
name
();
connect
(
fw
,
&
QFutureWatcher
<
QList
<
AppStream
::
Component
>>::
finished
,
this
,
[
this
,
fw
,
flatpakInstallation
,
appstreamIconsPath
,
sourceName
]()
{
const
auto
components
=
fw
->
result
();
foreach
(
const
AppStream
::
Component
&
appstreamComponent
,
components
)
{
QVector
<
FlatpakResource
*>
resources
;
for
(
const
AppStream
::
Component
&
appstreamComponent
:
components
)
{
FlatpakResource
*
resource
=
new
FlatpakResource
(
appstreamComponent
,
flatpakInstallation
,
this
);
resource
->
setIconPath
(
appstreamIconsPath
);
resource
->
setOrigin
(
sourceName
);
if
(
resource
->
resourceType
()
==
FlatpakResource
::
Runtime
)
{
resources
.
prepend
(
resource
);
}
else
{
resources
.
append
(
resource
);
}
}
for
(
auto
resource
:
qAsConst
(
resources
))
{
addResource
(
resource
);
}
...
...
@@ -704,6 +712,7 @@ bool FlatpakBackend::loadInstalledApps(FlatpakInstallation *flatpakInstallation)
const
QString
pathExports
=
FlatpakResource
::
installationPath
(
flatpakInstallation
)
+
QLatin1String
(
"/exports/"
);
const
QString
pathApps
=
pathExports
+
QLatin1String
(
"share/applications/"
);
QVector
<
FlatpakResource
*>
resources
;
for
(
uint
i
=
0
;
i
<
refs
->
len
;
i
++
)
{
FlatpakInstalledRef
*
ref
=
FLATPAK_INSTALLED_REF
(
g_ptr_array_index
(
refs
,
i
));
...
...
@@ -739,8 +748,14 @@ bool FlatpakBackend::loadInstalledApps(FlatpakInstallation *flatpakInstallation)
resource
->
setOrigin
(
QString
::
fromUtf8
(
flatpak_installed_ref_get_origin
(
ref
)));
resource
->
updateFromRef
(
FLATPAK_REF
(
ref
));
addResource
(
resource
);
if
(
resource
->
resourceType
()
==
FlatpakResource
::
Runtime
)
{
resources
.
prepend
(
resource
);
}
else
{
resources
.
append
(
resource
);
}
}
for
(
auto
resource
:
qAsConst
(
resources
))
addResource
(
resource
);
return
true
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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