clipboard: Add get_default() helper

Add helper for getting the main clipboard. This makes
the API usable for bindings (as GdkAtoms aren't usable through
gobject-introspection), and easier to use in C.

https://bugzilla.gnome.org/show_bug.cgi?id=712752
This commit is contained in:
Jonas Danielsson 2013-11-20 17:25:59 +01:00 committed by Bastien Nocera
parent 46b10f1d92
commit 1442299b48
3 changed files with 24 additions and 0 deletions

View File

@ -6476,6 +6476,7 @@ GtkClipboardClearFunc
gtk_clipboard_get
gtk_clipboard_get_for_display
gtk_clipboard_get_display
gtk_clipboard_get_default
gtk_clipboard_set_with_data
gtk_clipboard_set_with_owner
gtk_clipboard_get_owner

View File

@ -378,6 +378,26 @@ gtk_clipboard_get (GdkAtom selection)
return gtk_clipboard_get_for_display (gdk_display_get_default (), selection);
}
/**
* gtk_clipboard_get_default:
* @display: the #GdkDisplay for which the clipboard is to be retrieved.
*
* Returns the default clipboard object for use with cut/copy/paste menu items
* and keyboard shortcuts.
*
* Return value: (transfer none): the default clipboard object.
*
* Since: 3.16
**/
GtkClipboard *
gtk_clipboard_get_default (GdkDisplay *display)
{
g_return_val_if_fail (display != NULL, NULL);
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
return gtk_clipboard_get_for_display (display, GDK_SELECTION_CLIPBOARD);
}
static void
selection_get_cb (GtkWidget *widget,
GtkSelectionData *selection_data,

View File

@ -189,6 +189,9 @@ GtkClipboard *gtk_clipboard_get_for_display (GdkDisplay *display,
GDK_AVAILABLE_IN_ALL
GtkClipboard *gtk_clipboard_get (GdkAtom selection);
GDK_AVAILABLE_IN_3_16
GtkClipboard *gtk_clipboard_get_default (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
GdkDisplay *gtk_clipboard_get_display (GtkClipboard *clipboard);