Missing Gtk.Clipboard.set_with_data in Gtk 3


I need to use Gtk.Clipboard.set_with_data in Gtk3 to be able to pass through the clipboard files between Nautilus 40 and Desktop Icons NG, but although it does exist in C and Vala, it isn’t available in the documentation of the Javascript bindings (DevDocs ). Is it a bug, or that method can’t be used from Javascript? What alternative do I have in that case?


It’s marked as non-introspectable. I can’t tell for sure whether that annotation is correct in this case, but I suspect it is given that the old selection API is known to be awkward for introspection.

Is porting to GTK4 an option for you?

Thanks for your answer, Florian.

No, unfortunately, porting to Gtk4 isn’t currently an option, because I need to keep compatibility with Gnome Shell 3.38.

Isn’t that about the GTK program rather than the extension?

Sadly, it’s correct.

The closure passed to set_with_data() can be called multiple times, which means its scope cannot really be async; and it does not have a destroy notification, which means it cannot be notified either. Also, it has the same data pointer for two closures, which is unsupported.

The entire GtkClipboard API is really an old school, Xlib-like API, written long before introspection was a thing. It entirely relies on something calling it from C.

Yes, but I’m not sure if Ubuntu 20.10 and 21.04, and Debian stable has Gtk4. Also, doing a full port… it will require time…

I see… Well, I suppose that I will have to port it to Gtk4… But I don’t know when I will have enough spare time.

Thanks, Emmanuele, thanks Florian.

Can’t say I’m surprised …

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