#include "gtkmarshalers.h"
#include "gtktextbufferrichtext.h"
#include "gtkintl.h"
-#include "gtkalias.h"
#ifdef GDK_WINDOWING_X11
#include "x11/gdkx.h"
GdkAtom *cached_targets;
gint n_cached_targets;
- guint notify_signal_id;
+ gulong notify_signal_id;
gboolean storing_selection;
GMainLoop *store_loop;
guint store_timeout;
* if your application called "Foo" has a special-purpose
* clipboard, you might call it "_FOO_SPECIAL_CLIPBOARD".
*
- * Return value: the appropriate clipboard object. If no
+ * Return value: (transfer none): the appropriate clipboard object. If no
* clipboard already exists, a new one will
* be created. Once a clipboard object has
* been created, it is persistent and, since
/**
- * gtk_clipboard_get():
- * @selection: a #GdkAtom which identifies the clipboard
- * to use.
- *
+ * gtk_clipboard_get:
+ * @selection: a #GdkAtom which identifies the clipboard to use
+ *
* Returns the clipboard object for the given selection.
* See gtk_clipboard_get_for_display() for complete details.
- *
- * Return value: the appropriate clipboard object. If no
- * clipboard already exists, a new one will
- * be created. Once a clipboard object has
- * been created, it is persistent and, since
- * it is owned by GTK+, must not be freed or
- * unrefd.
- **/
+ *
+ * Return value: (transfer none): the appropriate clipboard object. If no clipboard
+ * already exists, a new one will be created. Once a clipboard
+ * object has been created, it is persistent and, since it is
+ * owned by GTK+, must not be freed or unreffed.
+ */
GtkClipboard *
gtk_clipboard_get (GdkAtom selection)
{
if (timestamp == GDK_CURRENT_TIME)
{
#ifdef GDK_WINDOWING_X11
- timestamp = gdk_x11_get_server_time (clipboard_widget->window);
+ timestamp = gdk_x11_get_server_time (gtk_widget_get_window (clipboard_widget));
#elif defined GDK_WINDOWING_WIN32
timestamp = GetMessageTime ();
#endif
/**
* gtk_clipboard_set_with_data:
- * @clipboard: a #GtkClipboard
- * @targets: array containing information about the available forms for the
- * clipboard data
- * @n_targets: number of elements in @targets
- * @get_func: function to call to get the actual clipboard data
- * @clear_func: when the clipboard contents are set again, this function will
- * be called, and @get_func will not be subsequently called.
- * @user_data: user data to pass to @get_func and @clear_func.
- *
+ * @clipboard: a #GtkClipboard
+ * @targets: array containing information about the available forms for the
+ * clipboard data
+ * @n_targets: number of elements in @targets
+ * @get_func: (scope async): function to call to get the actual clipboard data
+ * @clear_func: (scope async): when the clipboard contents are set again,
+ * this function will be called, and @get_func will not be subsequently
+ * called.
+ * @user_data: user data to pass to @get_func and @clear_func.
+ *
* Virtually sets the contents of the specified clipboard by providing
* a list of supported formats for the clipboard data and a function
* to call to get the actual data when it is requested.
- *
- * Return value: %TRUE if setting the clipboard data succeeded. If setting
- * the clipboard data failed the provided callback functions
- * will be ignored.
+ *
+ * Return value: %TRUE if setting the clipboard data succeeded.
+ * If setting the clipboard data failed the provided callback
+ * functions will be ignored.
**/
gboolean
gtk_clipboard_set_with_data (GtkClipboard *clipboard,
/**
* gtk_clipboard_set_with_owner:
- * @clipboard: a #GtkClipboard
- * @targets: array containing information about the available forms for the
- * clipboard data
- * @n_targets: number of elements in @targets
- * @get_func: function to call to get the actual clipboard data
- * @clear_func: when the clipboard contents are set again, this function will
- * be called, and @get_func will not be subsequently called.
- * @owner: an object that "owns" the data. This object will be passed
- * to the callbacks when called.
- *
+ * @clipboard: a #GtkClipboard
+ * @targets: array containing information about the available forms for
+ * the clipboard data
+ * @n_targets: number of elements in @targets
+ * @get_func: (scope async): function to call to get the actual clipboard data
+ * @clear_func: (scope async): when the clipboard contents are set again,
+ * this function will be called, and @get_func will not be subsequently
+ * called
+ * @owner: an object that "owns" the data. This object will be passed
+ * to the callbacks when called
+ *
* Virtually sets the contents of the specified clipboard by providing
* a list of supported formats for the clipboard data and a function
* to call to get the actual data when it is requested.
*
* The difference between this function and gtk_clipboard_set_with_data()
* is that instead of an generic @user_data pointer, a #GObject is passed
- * in.
- *
- * Return value: %TRUE if setting the clipboard data succeeded. If setting
- * the clipboard data failed the provided callback functions
- * will be ignored.
+ * in.
+ *
+ * Return value: %TRUE if setting the clipboard data succeeded.
+ * If setting the clipboard data failed the provided callback
+ * functions will be ignored.
**/
gboolean
gtk_clipboard_set_with_owner (GtkClipboard *clipboard,
/**
* gtk_clipboard_get_owner:
* @clipboard: a #GtkClipboard
- *
- * If the clipboard contents callbacks were set with
- * gtk_clipboard_set_with_owner(), and the gtk_clipboard_set_with_data() or
- * gtk_clipboard_clear() has not subsequently called, returns the owner set
+ *
+ * If the clipboard contents callbacks were set with
+ * gtk_clipboard_set_with_owner(), and the gtk_clipboard_set_with_data() or
+ * gtk_clipboard_clear() has not subsequently called, returns the owner set
* by gtk_clipboard_set_with_owner().
- *
- * Return value: the owner of the clipboard, if any; otherwise %NULL.
+ *
+ * Return value: (transfer none): the owner of the clipboard, if any;
+ * otherwise %NULL.
**/
GObject *
gtk_clipboard_get_owner (GtkClipboard *clipboard)
/**
* gtk_clipboard_request_contents:
* @clipboard: a #GtkClipboard
- * @target: an atom representing the form into which the clipboard
- * owner should convert the selection.
- * @callback: A function to call when the results are received
- * (or the retrieval fails). If the retrieval fails
- * the length field of @selection_data will be
- * negative.
+ * @target: an atom representing the form into which the clipboard
+ * owner should convert the selection.
+ * @callback: (scope async): A function to call when the results are received
+ * (or the retrieval fails). If the retrieval fails the length field of
+ * @selection_data will be negative.
* @user_data: user data to pass to @callback
- *
+ *
* Requests the contents of clipboard as the given target.
* When the results of the result are later received the supplied callback
* will be called.
/**
* gtk_clipboard_request_text:
* @clipboard: a #GtkClipboard
- * @callback: a function to call when the text is received,
- * or the retrieval fails. (It will always be called
- * one way or the other.)
+ * @callback: (scope async): a function to call when the text is received,
+ * or the retrieval fails. (It will always be called one way or the other.)
* @user_data: user data to pass to @callback.
- *
+ *
* Requests the contents of the clipboard as text. When the text is
* later received, it will be converted to UTF-8 if necessary, and
- * @callback will be called.
+ * @callback will be called.
*
* The @text parameter to @callback will contain the resulting text if
* the request succeeded, or %NULL if it failed. This could happen for
/**
* gtk_clipboard_request_rich_text:
* @clipboard: a #GtkClipboard
- * @buffer: a #GtkTextBuffer
- * @callback: a function to call when the text is received,
- * or the retrieval fails. (It will always be called
- * one way or the other.)
+ * @buffer: a #GtkTextBuffer
+ * @callback: (scope async): a function to call when the text is received,
+ * or the retrieval fails. (It will always be called one way or the other.)
* @user_data: user data to pass to @callback.
*
* Requests the contents of the clipboard as rich text. When the rich
/**
* gtk_clipboard_request_image:
* @clipboard: a #GtkClipboard
- * @callback: a function to call when the image is received,
- * or the retrieval fails. (It will always be called
- * one way or the other.)
+ * @callback: (scope async): a function to call when the image is received,
+ * or the retrieval fails. (It will always be called one way or the other.)
* @user_data: user data to pass to @callback.
- *
+ *
* Requests the contents of the clipboard as image. When the image is
* later received, it will be converted to a #GdkPixbuf, and
- * @callback will be called.
+ * @callback will be called.
*
- * The @pixbuf parameter to @callback will contain the resulting
- * #GdkPixbuf if the request succeeded, or %NULL if it failed. This
- * could happen for various reasons, in particular if the clipboard
- * was empty or if the contents of the clipboard could not be
+ * The @pixbuf parameter to @callback will contain the resulting
+ * #GdkPixbuf if the request succeeded, or %NULL if it failed. This
+ * could happen for various reasons, in particular if the clipboard
+ * was empty or if the contents of the clipboard could not be
* converted into an image.
*
* Since: 2.6
/**
* gtk_clipboard_request_uris:
* @clipboard: a #GtkClipboard
- * @callback: a function to call when the URIs are received,
- * or the retrieval fails. (It will always be called
- * one way or the other.)
+ * @callback: (scope async): a function to call when the URIs are received,
+ * or the retrieval fails. (It will always be called one way or the other.)
* @user_data: user data to pass to @callback.
- *
+ *
* Requests the contents of the clipboard as URIs. When the URIs are
* later received @callback will be called.
*
/**
* gtk_clipboard_request_targets:
* @clipboard: a #GtkClipboard
- * @callback: a function to call when the targets are received,
- * or the retrieval fails. (It will always be called
- * one way or the other.)
+ * @callback: (scope async): a function to call when the targets are
+ * received, or the retrieval fails. (It will always be called
+ * one way or the other.)
* @user_data: user data to pass to @callback.
- *
- * Requests the contents of the clipboard as list of supported targets.
- * When the list is later received, @callback will be called.
+ *
+ * Requests the contents of the clipboard as list of supported targets.
+ * When the list is later received, @callback will be called.
*
* The @targets parameter to @callback will contain the resulting targets if
* the request succeeded, or %NULL if it failed.
/**
* gtk_clipboard_wait_for_image:
* @clipboard: a #GtkClipboard
- *
+ *
* Requests the contents of the clipboard as image and converts
* the result to a #GdkPixbuf. This function waits for
* the data to be received using the main loop, so events,
* timeouts, etc, may be dispatched during the wait.
- *
- * Return value: a newly-allocated #GdkPixbuf object which must
- * be disposed with g_object_unref(), or %NULL if
- * retrieving the selection data failed. (This
- * could happen for various reasons, in particular
- * if the clipboard was empty or if the contents of
- * the clipboard could not be converted into an image.)
+ *
+ * Return value: (transfer full): a newly-allocated #GdkPixbuf
+ * object which must be disposed with g_object_unref(), or
+ * %NULL if retrieving the selection data failed. (This could
+ * happen for various reasons, in particular if the clipboard
+ * was empty or if the contents of the clipboard could not be
+ * converted into an image.)
*
* Since: 2.6
**/
* Requests the contents of the clipboard as URIs. This function waits
* for the data to be received using the main loop, so events,
* timeouts, etc, may be dispatched during the wait.
- *
- * Return value: a newly-allocated %NULL-terminated array of strings which must
+ *
+ * Return value: (array zero-terminated=1) (element-type utf8) (transfer full): a newly-allocated
+ * %NULL-terminated array of strings which must
* be freed with g_strfreev(), or %NULL if
- * retrieving the selection data failed. (This
- * could happen for various reasons, in particular
- * if the clipboard was empty or if the contents of
+ * retrieving the selection data failed. (This
+ * could happen for various reasons, in particular
+ * if the clipboard was empty or if the contents of
* the clipboard could not be converted into URI form.)
*
* Since: 2.14
*
* Gets the #GdkDisplay associated with @clipboard
*
- * Return value: the #GdkDisplay associated with @clipboard
+ * Return value: (transfer none): the #GdkDisplay associated with @clipboard
*
* Since: 2.2
**/
GdkDisplay *display;
GtkClipboard *clipboard;
- display = gdk_drawable_get_display (event->window);
+ display = gdk_window_get_display (event->window);
clipboard = clipboard_peek (display, event->selection, TRUE);
if (clipboard)
/**
* gtk_clipboard_set_can_store:
* @clipboard: a #GtkClipboard
- * @targets: array containing information about which forms should be stored
- * or %NULL to indicate that all forms should be stored.
+ * @targets: (allow-none): array containing information about which forms
+ * should be stored or %NULL to indicate that all forms should
+ * be stored.
* @n_targets: number of elements in @targets
*
* Hints that the clipboard data should be stored somewhere when the
clipboard);
gdk_display_store_clipboard (clipboard->display,
- clipboard_widget->window,
+ gtk_widget_get_window (clipboard_widget),
clipboard_get_timestamp (clipboard),
clipboard->storable_targets,
clipboard->n_storable_targets);
g_slist_free (displays);
}
-
-#define __GTK_CLIPBOARD_C__
-#include "gtkaliasdef.c"