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:

    sigc::mem_fun(*this, &ExampleWindow::on_clipboard_received) );

Here is an example callback method:

void ExampleWindow::on_clipboard_received(
    const Gtk::SelectionData& selection_data)
  Glib::ustring clipboard_data = selection_data.get_data_as_string();
  //Do something with the pasted data.

19.3.1. Discovering the available targets

To find out what targets are currently available on the Clipboard for pasting, call the request_targets() method, specifying a method to be called with the information. For instance:

refClipboard->request_targets( sigc::mem_fun(*this,
    &ExampleWindow::on_clipboard_received_targets) );

In your callback, compare the vector of available targets with those that your application supports for pasting. You could enable or disable a Paste menu item, depending on whether pasting is currently possible. For instance:

void ExampleWindow::on_clipboard_received_targets(
  const std::vector<Glib::ustring>& targets)
  const bool bPasteIsPossible =
    std::find(targets.begin(), targets.end(),
      example_target_custom) != targets.end();

  // Enable/Disable the Paste button appropriately: