I am writing a application based on gtk::Clipboard
in using the gtk-rs crate. I have already initialized a Clipboard
like this:
let clipboard = gtk::Clipboard::get(&gdk::SELECTION_PRIMARY);
It is able to print the selected text by using clipboard.wait_for_text()
in loop.
However, I only need the text when the selection changes. How can I connect a handling function to the owner-change
event emitted from clipboard
?
In Python, it could be implemented like this
clipboard = Gtk.Clipboard.get(Gdk.SELECTION_PRIMARY)
clipboard.connect("owner-change", foo)