When the user asks to paste data from the Clipboard
, you
should request a specific format and provide a callback method which will be
called with the actual data. For instance:
void ExampleWindow::on_button_paste()
{
get_clipboard()->read_text_async(sigc::mem_fun(*this,
&ExampleWindow::on_clipboard_received));
}
Here is an example callback method:
void ExampleWindow::on_clipboard_received(Glib::RefPtr<Gio::AsyncResult>& result)
{
auto text = get_clipboard()->read_text_finish(result);
//Do something with the pasted data.
}