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

flatpak: connect to the add remote transaction signal

parent abe43cbe
...@@ -61,6 +61,7 @@ void FlatpakJobTransaction::start() ...@@ -61,6 +61,7 @@ void FlatpakJobTransaction::start()
m_appJob = new FlatpakTransactionThread(m_app, role()); m_appJob = new FlatpakTransactionThread(m_app, role());
connect(m_appJob, &FlatpakTransactionThread::finished, this, &FlatpakJobTransaction::finishTransaction); connect(m_appJob, &FlatpakTransactionThread::finished, this, &FlatpakJobTransaction::finishTransaction);
connect(m_appJob, &FlatpakTransactionThread::progressChanged, this, &FlatpakJobTransaction::onJobProgressChanged); connect(m_appJob, &FlatpakTransactionThread::progressChanged, this, &FlatpakJobTransaction::onJobProgressChanged);
connect(m_appJob, &FlatpakTransactionThread::passiveMessage, this, &FlatpakJobTransaction::passiveMessage);
m_appJob->start(); m_appJob->start();
} }
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "FlatpakTransactionThread.h" #include "FlatpakTransactionThread.h"
#include "FlatpakResource.h" #include "FlatpakResource.h"
#include <KLocalizedString>
#include <QDebug> #include <QDebug>
static void flatpakInstallationProgressCallback(const gchar *stats, guint progress, gboolean estimating, gpointer userData) static void flatpakInstallationProgressCallback(const gchar *stats, guint progress, gboolean estimating, gpointer userData)
...@@ -36,6 +37,21 @@ static void flatpakInstallationProgressCallback(const gchar *stats, guint progre ...@@ -36,6 +37,21 @@ static void flatpakInstallationProgressCallback(const gchar *stats, guint progre
transactionJob->setProgress(progress); transactionJob->setProgress(progress);
} }
gboolean
add_new_remote_cb(FlatpakTransaction */*object*/,
gint /*reason*/,
gchar *from_id,
gchar *suggested_remote_name,
gchar *url,
gpointer user_data)
{
FlatpakTransactionThread *obj = (FlatpakTransactionThread*) user_data;
//TODO ask instead
Q_EMIT obj->passiveMessage(i18n("Adding remote '%1' in %2 from %3", QString::fromUtf8(suggested_remote_name), QString::fromUtf8(url), QString::fromUtf8(from_id)));
return true;
}
FlatpakTransactionThread::FlatpakTransactionThread(FlatpakResource *app, Transaction::Role role) FlatpakTransactionThread::FlatpakTransactionThread(FlatpakResource *app, Transaction::Role role)
: QThread() : QThread()
, m_result(false) , m_result(false)
...@@ -47,6 +63,7 @@ FlatpakTransactionThread::FlatpakTransactionThread(FlatpakResource *app, Transac ...@@ -47,6 +63,7 @@ FlatpakTransactionThread::FlatpakTransactionThread(FlatpakResource *app, Transac
g_autoptr(GError) localError = nullptr; g_autoptr(GError) localError = nullptr;
m_transaction = flatpak_transaction_new_for_installation(m_app->installation(), m_cancellable, &localError); m_transaction = flatpak_transaction_new_for_installation(m_app->installation(), m_cancellable, &localError);
g_signal_connect (m_transaction, "add-new-remote", G_CALLBACK (add_new_remote_cb), this);
} }
FlatpakTransactionThread::~FlatpakTransactionThread() FlatpakTransactionThread::~FlatpakTransactionThread()
......
...@@ -51,6 +51,7 @@ public: ...@@ -51,6 +51,7 @@ public:
Q_SIGNALS: Q_SIGNALS:
void progressChanged(int progress); void progressChanged(int progress);
void passiveMessage(const QString &msg);
private: private:
FlatpakTransaction* m_transaction; FlatpakTransaction* m_transaction;
......
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