Commit e5a3cfc9 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

fwupd: simplify information population

No need to call functions twice, we can just as well pass directly the
information to the resource.
parent 1adb137a
......@@ -115,23 +115,14 @@ FwupdResource * FwupdBackend::createRelease(FwupdDevice *device)
}
void FwupdBackend::setReleaseDetails(FwupdResource *res, FwupdRelease *release)
{
res->addCategories(QLatin1String("Releases"));
if (fwupd_release_get_summary(release))
res->setSummary(QString::fromUtf8(fwupd_release_get_summary(release)));
if (fwupd_release_get_vendor(release))
res->setVendor(QString::fromUtf8(fwupd_release_get_vendor(release)));
if (fwupd_release_get_size(release))
res->setSize(fwupd_release_get_size(release));
if (fwupd_release_get_version(release))
res->setVersion(QString::fromUtf8(fwupd_release_get_version(release)));
if (fwupd_release_get_description(release))
res->setDescription(QString::fromUtf8((fwupd_release_get_description(release))));
if (fwupd_release_get_homepage(release))
res->setHomePage(QUrl(QString::fromUtf8(fwupd_release_get_homepage(release))));
if (fwupd_release_get_license(release))
res->setLicense(QString::fromUtf8(fwupd_release_get_license(release)));
if (fwupd_release_get_uri(release))
res->m_updateURI = QString::fromUtf8(fwupd_release_get_uri(release));
res->setSummary(QString::fromUtf8(fwupd_release_get_summary(release)));
res->setVendor(QString::fromUtf8(fwupd_release_get_vendor(release)));
res->setSize(fwupd_release_get_size(release));
res->setVersion(QString::fromUtf8(fwupd_release_get_version(release)));
res->setDescription(QString::fromUtf8((fwupd_release_get_description(release))));
res->setHomePage(QUrl(QString::fromUtf8(fwupd_release_get_homepage(release))));
res->setLicense(QString::fromUtf8(fwupd_release_get_license(release)));
res->m_updateURI = QString::fromUtf8(fwupd_release_get_uri(release));
}
void FwupdBackend::setDeviceDetails(FwupdResource *res, FwupdDevice *dev)
{
......@@ -160,16 +151,11 @@ void FwupdBackend::setDeviceDetails(FwupdResource *res, FwupdDevice *dev)
vendorDesc = vendorName + QLatin1Char(' ') + vendorDesc;
res->setName(vendorDesc);
}
if (fwupd_device_get_summary(dev))
res->setSummary(QString::fromUtf8(fwupd_device_get_summary(dev)));
if (fwupd_device_get_vendor(dev))
res->setVendor(QString::fromUtf8(fwupd_device_get_vendor(dev)));
if (fwupd_device_get_created(dev))
res->setReleaseDate((QDateTime::fromSecsSinceEpoch(fwupd_device_get_created(dev))).date());
if (fwupd_device_get_version(dev))
res->setVersion(QString::fromUtf8(fwupd_device_get_version(dev)));
if (fwupd_device_get_description(dev))
res->setDescription(QString::fromUtf8((fwupd_device_get_description(dev))));
res->setSummary(QString::fromUtf8(fwupd_device_get_summary(dev)));
res->setVendor(QString::fromUtf8(fwupd_device_get_vendor(dev)));
res->setReleaseDate((QDateTime::fromSecsSinceEpoch(fwupd_device_get_created(dev))).date());
res->setVersion(QString::fromUtf8(fwupd_device_get_version(dev)));
res->setDescription(QString::fromUtf8((fwupd_device_get_description(dev))));
res->setIconName(QString::fromUtf8("device-notifier"));
}
......@@ -187,7 +173,6 @@ void FwupdBackend::populate()
}
}
void FwupdBackend::addUpdates()
{
g_autoptr(GError) error = nullptr;
......
......@@ -33,7 +33,6 @@ FwupdResource::FwupdResource(QString name, bool isTechnical, AbstractResourcesBa
, m_state(State::Broken)
, m_isTechnical(isTechnical)
{
}
QList<PackageState> FwupdResource::addonsInformation()
......@@ -56,10 +55,6 @@ QStringList FwupdResource::categories()
return m_categories;
}
void FwupdResource::addCategories(const QString &category){
m_categories.append(category);
}
QString FwupdResource::comment()
{
return m_summary;
......
......@@ -69,7 +69,6 @@ public:
void setDescription(const QString &description){ m_description = description;}
void setVersion(const QString &version){ m_version = version;}
void setVendor(const QString &vendor){ m_vendor = vendor;}
void addCategories(const QString &category);
void setHomePage(const QUrl &homepage){ m_homepage = homepage;}
void setLicense(const QString &license){ m_license = license;}
void setIconName(const QString &iconName){ m_iconName = iconName;}
......
Supports Markdown
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