}
- public class Callbacks : Ggit.RemoteCallbacks {
-
- Repo repo;
- public Callbacks(Repo repo)
+ private class Callbacks : Ggit.RemoteCallbacks
+ {
+ private Remote d_remote;
+ private Ggit.RemoteCallbacks? d_proxy;
+
+ public delegate void TransferProgress(Ggit.TransferProgress stats);
+ private TransferProgress? d_transfer_progress;
+
+ public Callbacks(Remote remote, Ggit.RemoteCallbacks? proxy, owned TransferProgress? transfer_progress)
{
- this.repo = repo;
- this.transfer_progress.connect(this.onTransferProgress);
+ d_remote = remote;
+ d_proxy = proxy;
+ d_transfer_progress = (owned)transfer_progress;
}
-
- void onTransferProgress( Ggit.TransferProgress stats)
+
+ protected override void progress(string message)
+ {
+ if (d_proxy != null)
+ {
+ d_proxy.progress(message);
+ }
+ }
+
+ protected override void transfer_progress(Ggit.TransferProgress stats)
+ {
+ if (d_transfer_progress != null)
+ {
+ d_transfer_progress(stats);
+ }
+
+ if (d_proxy != null)
+ {
+ d_proxy.transfer_progress(stats);
+ }
+ }
+
+ protected override void update_tips(string refname, Ggit.OId a, Ggit.OId b)
+ {
+ d_remote.tip_updated(refname, a, b);
+
+ if (d_proxy != null)
+ {
+ d_proxy.update_tips(refname, a, b);
+ }
+ }
+
+ protected override void completion(Ggit.RemoteCompletionType type)
+ {
+ if (d_proxy != null)
+ {
+ d_proxy.completion(type);
+ }
+ }
+
+ protected override Ggit.Cred? credentials(string url, string? username_from_url, Ggit.Credtype allowed_types) throws Error
{
- GLib.debug("got progress");
+ Ggit.Cred? ret = null;
+ GLib.log("get credentials %s UN=%s", url, username_from_url);
+
+ new Ggit.CredPlaintext(username_from_url, "test");
+ /*var provider = d_remote.credentials_provider;
+
+ if (provider != null)
+ {
+ ret = provider.credentials(url, username_from_url, allowed_types);
+ }
+
+ if (ret == null && d_proxy != null)
+ {
+ ret = d_proxy.credentials(url, username_from_url, allowed_types);
+ }
+
+ return ret;
}
}