Commit e567c346 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Remove boilerplate code

parent c30ff451
......@@ -707,21 +707,14 @@ public:
// With Flatpak 0.9.4 we can use flatpak_installation_update_appstream_full_sync() providing progress reporting which we don't use at this moment, but still
// better to use newer function in case the previous one gets deprecated
if (!flatpak_installation_update_appstream_full_sync(m_installation, flatpak_remote_get_name(m_remote), nullptr, nullptr, nullptr, nullptr, m_cancellable, &localError)) {
qWarning() << "Failed to refresh appstream metadata for " << flatpak_remote_get_name(m_remote) << ": " << (localError ? localError->message : "<no error>");
Q_EMIT jobRefreshAppstreamMetadataFailed();
return;
}
Q_EMIT jobRefreshAppstreamMetadataFinished(m_installation, m_remote);
#else
if (!flatpak_installation_update_appstream_sync(m_installation, flatpak_remote_get_name(m_remote), nullptr, nullptr, m_cancellable, &localError)) {
#endif
qWarning() << "Failed to refresh appstream metadata for " << flatpak_remote_get_name(m_remote) << ": " << (localError ? localError->message : "<no error>");
Q_EMIT jobRefreshAppstreamMetadataFailed();
return;
} else {
Q_EMIT jobRefreshAppstreamMetadataFinished(m_installation, m_remote);
}
Q_EMIT jobRefreshAppstreamMetadataFinished(m_installation, m_remote);
#endif
}
Q_SIGNALS:
......@@ -738,15 +731,10 @@ void FlatpakBackend::refreshAppstreamMetadata(FlatpakInstallation *installation,
{
FlatpakRefreshAppstreamMetadataJob *job = new FlatpakRefreshAppstreamMetadataJob(installation, remote);
connect(job, &FlatpakRefreshAppstreamMetadataJob::finished, job, &FlatpakFetchDataJob::deleteLater);
connect(job, &FlatpakRefreshAppstreamMetadataJob::jobRefreshAppstreamMetadataFinished, this, &FlatpakBackend::onRefreshAppstreamMetadataFinished);
connect(job, &FlatpakRefreshAppstreamMetadataJob::jobRefreshAppstreamMetadataFinished, this, &FlatpakBackend::integrateRemote);
job->start();
}
void FlatpakBackend::onRefreshAppstreamMetadataFinished(FlatpakInstallation* flatpakInstallation, FlatpakRemote* remote)
{
integrateRemote(flatpakInstallation, remote);
}
void FlatpakBackend::reloadPackageList()
{
setFetching(true);
......
......@@ -68,7 +68,6 @@ private Q_SLOTS:
void onFetchMetadataFinished(FlatpakInstallation *flatpakInstallation, FlatpakResource *resource, const QByteArray &metadata);
void onFetchSizeFinished(FlatpakResource *resource, guint64 downloadSize, guint64 installedSize);
void onFetchUpdatesFinished(FlatpakInstallation *flatpakInstallation, GPtrArray *updates);
void onRefreshAppstreamMetadataFinished(FlatpakInstallation *flatpakInstallation, FlatpakRemote *remote);
private:
void announceRatingsReady();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment