[gtk+] clipboard: Add get_default() helper
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] clipboard: Add get_default() helper
- Date: Tue, 27 Jan 2015 17:11:44 +0000 (UTC)
commit 1442299b4838d38de81285cf007b871cf867ed69
Author: Jonas Danielsson <jonas threetimestwo org>
Date: Wed Nov 20 17:25:59 2013 +0100
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
docs/reference/gtk/gtk3-sections.txt | 1 +
gtk/gtkclipboard.c | 20 ++++++++++++++++++++
gtk/gtkclipboard.h | 3 +++
3 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt
index be4e632..748f1be 100644
--- a/docs/reference/gtk/gtk3-sections.txt
+++ b/docs/reference/gtk/gtk3-sections.txt
@@ -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
diff --git a/gtk/gtkclipboard.c b/gtk/gtkclipboard.c
index 302f7f7..d2381be 100644
--- a/gtk/gtkclipboard.c
+++ b/gtk/gtkclipboard.c
@@ -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,
diff --git a/gtk/gtkclipboard.h b/gtk/gtkclipboard.h
index e59a450..5470de4 100644
--- a/gtk/gtkclipboard.h
+++ b/gtk/gtkclipboard.h
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]