Signal that expects a returned string doesn't work in GJS

Hi all:

I’m working with AutoAR and GJS, and I have an odd problem when trying to decompress password-protected files.

AutoAR works by sending a signal, ‘request-passphrase’, to, as its name says, request the password, and the callback should return a string with it.

I did this:

const passwordRequiredID = extractor.connect('request-passphrase', () => {
    print("Asking for password");
    return "password";
});

to decompress a .zip file compressed with “password” as password, but it doesn’t work. Even worse: I modified AutoAR, adding g_print() before and after emitting that signal, and showing what does it recover, and not only it is always NULL, but the most odd thing is that ‘emit’ returns before the GJS callback is called, which can explain why it is falling: the signal’s callback seems to be called asynchronously.

To ensure that this wasn’t some kind of output buffer artifact, I even showed a Gtk.Dialog() in the signal callback, to ensure that everything would be printed before the callback would return, but it was the same result: first the ‘emit’ in AutoAR is called and returns, and only then the GJS callback is called.

But the most odd thing is that other signals, like ‘delete-event’ are called synchronously and the return value is used by the C code…

So… what am I doing wrong?

Thanks.

Ok, I found what happens: autoAR uses this to send the signal, and it seems that, under GJS, the signal is delayed.

imagen

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.