Clipboard improvements, II



Here is another piece of clipboard api that will be needed to make
the clipboard experience less painful. It is the cleanup call outlined
earlier by Owen.

Tor, Hans, I'm posting this mainly as a quick check that the proposed
API is implementable for the Windows clipboard as well. 

Regards, Matthias


/**
 * gtk_clipboard_wait_for_exit_cleanup:
 * 
 * Asks a clipboard manager to take over the contents of the CLIPBOARD,
 * if the application owns the CLIPBOARD selection. Applications should
 * call this when exiting, in order to provide the user with the 
 * experience of a persistent clipboard. See 
 * <ulink url="http://www.freedesktop.org";>www.freedesktop.org</ulink>
 * for details of the clipboard manager protocol used to implement
 * this functionality.
 *
 * Since: 2.6
 */
void
gtk_clipboard_wait_for_exit_cleanup (void)
{
  GtkClipboard *clipboard;
  GObject *owner;

  clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
  owner = gtk_clipboard_get_owner (clipboard);
  
  if (owner)
    {
      GdkAtom clipboard_manager;
      GdkAtom save_targets;
      GtkClipboard *manager;
      GtkSelectionData *selection_data;

      clipboard_manager = gdk_atom_intern ("CLIPBOARD_MANAGER", FALSE);
      save_targets = gdk_atom_intern ("SAVE_TARGETS", FALSE);
      manager = gtk_clipboard_get (clipboard_manager);

      selection_data = gtk_clipboard_wait_for_contents (manager,      
                                                        save_targets);
      if (selection_data)
	gtk_selection_data_free (selection_data);
    }
}






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]