From 4d14ca0fcf93f09c21b13f2c830b696414215151 Mon Sep 17 00:00:00 2001 From: matthiakl Date: Fri, 9 Jul 2021 16:08:13 +0200 Subject: [PATCH] Fix pkg retrieve event handling --- src/pamac-system-daemon/system_daemon.vala | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/pamac-system-daemon/system_daemon.vala b/src/pamac-system-daemon/system_daemon.vala index 1abc793..69afd7a 100644 --- a/src/pamac-system-daemon/system_daemon.vala +++ b/src/pamac-system-daemon/system_daemon.vala @@ -1776,8 +1776,9 @@ private void cb_event (void *ctx, Alpm.Event.Data data) { if (system_daemon.cancellable.is_cancelled ()) { return; } - details += data.pkgdownload_file; - break; + system_daemon.emit_totaldownload (data.pkg_retrieve_total_size); + // event will be emitted by cb_fetch + return; case Alpm.Event.Type.OPTDEP_REMOVAL: details += data.optdep_removal_pkg.name; details += data.optdep_removal_optdep.compute_string (); @@ -1910,6 +1911,8 @@ private int cb_fetch (void *ctx, string fileurl, string localpath, int force) { var destfile = GLib.File.new_for_path (localpath + url.get_basename ()); var tempfile = GLib.File.new_for_path (destfile.get_path () + ".part"); + system_daemon.emit_event(Alpm.Event.Type.PKG_RETRIEVE_START, 0, {url.get_basename ()}); + system_daemon.curl.reset (); system_daemon.curl.setopt (Curl.Option.FAILONERROR, 1L); system_daemon.curl.setopt (Curl.Option.CONNECTTIMEOUT, 30L); @@ -2076,9 +2079,9 @@ private int cb_fetch (void *ctx, string fileurl, string localpath, int force) { } private void cb_download (void* ctx, string filename, Alpm.Download.Event event_type, void* event_data) { - // TODO: implement alpm_cb_download - // if (event_type == Alpm.Download.Event.COMPLETED)... - // system_daemon.emit_totaldownload (total); + if (event_type == Alpm.Download.Event.COMPLETED) { + system_daemon.emit_totaldownload (((Alpm.Download.Completed) event_data).total); + } } private void cb_log (void *ctx, Alpm.LogLevel level, string fmt, va_list args) {