[gtk+] Add a function to get the selection of a clipboard



commit 100cf2442e40d29e4b83a5eae663e30ad58eaf09
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Mar 26 23:30:21 2016 -0400

    Add a function to get the selection of a clipboard
    
    This was requested in
    http://bugzilla.gnome.org/show_bug.cgi?id=730821

 docs/reference/gtk/gtk3-sections.txt |    1 +
 gtk/gtkclipboard.c                   |   18 ++++++++++++++++++
 gtk/gtkclipboard.h                   |    2 ++
 3 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt
index d8688da..36b3bac 100644
--- a/docs/reference/gtk/gtk3-sections.txt
+++ b/docs/reference/gtk/gtk3-sections.txt
@@ -6625,6 +6625,7 @@ gtk_clipboard_wait_for_targets
 gtk_clipboard_wait_is_target_available
 gtk_clipboard_set_can_store
 gtk_clipboard_store
+gtk_clipboard_get_selection
 <SUBSECTION Standard>
 GTK_CLIPBOARD
 GTK_TYPE_CLIPBOARD
diff --git a/gtk/gtkclipboard.c b/gtk/gtkclipboard.c
index 5f53d8c..59cca40 100644
--- a/gtk/gtkclipboard.c
+++ b/gtk/gtkclipboard.c
@@ -2208,3 +2208,21 @@ _gtk_clipboard_store_all (void)
   g_slist_free (displays);
   
 }
+
+/**
+ * gtk_clipboard_get_selection:
+ * @clipboard: a #GtkClipboard
+ *
+ * Gets the sleection that this clipboard is for.
+ *
+ * Returns: the selection
+ *
+ * Since: 3.22
+ */
+GdkAtom
+gtk_clipboard_get_selection (GtkClipboard *clipboard)
+{
+  g_return_val_if_fail (GTK_IS_CLIPBOARD (clipboard), GDK_NONE);
+
+  return clipboard->selection;
+}
diff --git a/gtk/gtkclipboard.h b/gtk/gtkclipboard.h
index ffd801f..655c18f 100644
--- a/gtk/gtkclipboard.h
+++ b/gtk/gtkclipboard.h
@@ -290,6 +290,8 @@ void gtk_clipboard_set_can_store (GtkClipboard         *clipboard,
 GDK_AVAILABLE_IN_ALL
 void gtk_clipboard_store         (GtkClipboard   *clipboard);
 
+GDK_AVAILABLE_IN_3_22
+GdkAtom gtk_clipboard_get_selection (GtkClipboard *clipboard);
 
 G_END_DECLS
 


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