diff options
author | Benjamin Otte <otte@redhat.com> | 2017-11-18 02:19:53 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2017-11-20 23:12:33 +0100 |
commit | 9a6ec4e9591df1a8ed72bbf8793091a1f325b5ff (patch) | |
tree | a5a8ca3908f228fdfc64acc8a6a7ca3c5508094c /gtk | |
parent | 0638bbb5d58d783519fd07dc548996d405398f4f (diff) | |
download | gtk+-9a6ec4e9591df1a8ed72bbf8793091a1f325b5ff.tar.gz |
contentformats: Rename GtkTargetList
It's now called GdkContentsFormat
Diffstat (limited to 'gtk')
33 files changed, 414 insertions, 420 deletions
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c index eaaf17d0e3..08fd646c66 100644 --- a/gtk/gtkcalendar.c +++ b/gtk/gtkcalendar.c @@ -2647,14 +2647,14 @@ gtk_calendar_motion_notify (GtkWidget *widget, x, y)) { GdkDragContext *context; - GtkTargetList *target_list = gtk_target_list_new (NULL, 0); - gtk_target_list_add_text_targets (target_list); + GdkContentFormats *target_list = gdk_content_formats_new (NULL, 0); + gtk_content_formats_add_text_targets (target_list); context = gtk_drag_begin_with_coordinates (widget, target_list, GDK_ACTION_COPY, 1, (GdkEvent *)event, priv->drag_start_x, priv->drag_start_y); priv->in_drag = 0; - gtk_target_list_unref (target_list); + gdk_content_formats_unref (target_list); gtk_drag_set_icon_default (context); } } diff --git a/gtk/gtkclipboard.c b/gtk/gtkclipboard.c index 2e77764652..03151e3f0e 100644 --- a/gtk/gtkclipboard.c +++ b/gtk/gtkclipboard.c @@ -31,6 +31,7 @@ #include "gtkintl.h" #include "gdk/gdk-private.h" +#include "gdk/gdkcontentformatsprivate.h" /** * SECTION:gtkclipboard @@ -153,7 +154,7 @@ static void gtk_clipboard_finalize (GObject *object); static void gtk_clipboard_owner_change (GtkClipboard *clipboard, GdkEventOwnerChange *event); static gboolean gtk_clipboard_set_contents (GtkClipboard *clipboard, - GtkTargetList *targets, + GdkContentFormats *formats, GtkClipboardGetFunc get_func, GtkClipboardClearFunc clear_func, gpointer user_data, @@ -164,7 +165,7 @@ static void gtk_clipboard_real_request_contents (GtkClipboard GtkClipboardReceivedFunc callback, gpointer user_data); static void gtk_clipboard_real_set_can_store (GtkClipboard *clipboard, - GtkTargetList *targets); + GdkContentFormats *formats); static void gtk_clipboard_real_store (GtkClipboard *clipboard); @@ -268,8 +269,8 @@ gtk_clipboard_finalize (GObject *object) if (clipboard_widget != NULL && clipboard->notify_signal_id != 0) g_signal_handler_disconnect (clipboard_widget, clipboard->notify_signal_id); - g_free (clipboard->storable_targets); - g_free (clipboard->cached_targets); + g_free (clipboard->storable_formats); + g_free (clipboard->cached_formats); G_OBJECT_CLASS (gtk_clipboard_parent_class)->finalize (object); } @@ -546,7 +547,7 @@ clipboard_remove_owner_notify (GtkClipboard *clipboard) static gboolean gtk_clipboard_set_contents (GtkClipboard *clipboard, - GtkTargetList *targets, + GdkContentFormats *formats, GtkClipboardGetFunc get_func, GtkClipboardClearFunc clear_func, gpointer user_data, @@ -561,11 +562,11 @@ gtk_clipboard_set_contents (GtkClipboard *clipboard, { clipboard->have_selection = TRUE; - if (clipboard->n_cached_targets != -1) + if (clipboard->n_cached_formats != -1) { - g_free (clipboard->cached_targets); - clipboard->cached_targets = NULL; - clipboard->n_cached_targets = -1; + g_free (clipboard->cached_formats); + clipboard->cached_formats = NULL; + clipboard->n_cached_formats = -1; } if (!(clipboard->have_owner && have_owner) || @@ -583,7 +584,7 @@ gtk_clipboard_set_contents (GtkClipboard *clipboard, clipboard->clear_func = clear_func; gtk_selection_clear_targets (clipboard_widget, clipboard->selection); - gtk_selection_add_targets (clipboard_widget, clipboard->selection, targets); + gtk_selection_add_targets (clipboard_widget, clipboard->selection, formats); return TRUE; } @@ -594,7 +595,7 @@ gtk_clipboard_set_contents (GtkClipboard *clipboard, /** * gtk_clipboard_set_with_data: (skip) * @clipboard: a #GtkClipboard - * @targets: The targets (data formats) in which the + * @formats: The targets (data formats) in which the * functions can provide the data * @get_func: (scope async): function to call to get the actual clipboard data * @clear_func: (scope async): when the clipboard contents are set again, @@ -612,17 +613,17 @@ gtk_clipboard_set_contents (GtkClipboard *clipboard, **/ gboolean gtk_clipboard_set_with_data (GtkClipboard *clipboard, - GtkTargetList *targets, + GdkContentFormats *formats, GtkClipboardGetFunc get_func, GtkClipboardClearFunc clear_func, gpointer user_data) { g_return_val_if_fail (clipboard != NULL, FALSE); - g_return_val_if_fail (targets != NULL, FALSE); + g_return_val_if_fail (formats != NULL, FALSE); g_return_val_if_fail (get_func != NULL, FALSE); return GTK_CLIPBOARD_GET_CLASS (clipboard)->set_contents (clipboard, - targets, + formats, get_func, clear_func, user_data, @@ -632,7 +633,7 @@ gtk_clipboard_set_with_data (GtkClipboard *clipboard, /** * gtk_clipboard_set_with_owner: (skip) * @clipboard: a #GtkClipboard - * @targets: The targets (data formats) in which the + * @formats: The targets (data formats) in which the * functions can provide the data * @get_func: (scope async): function to call to get the actual clipboard data * @clear_func: (scope async): when the clipboard contents are set again, @@ -655,18 +656,18 @@ gtk_clipboard_set_with_data (GtkClipboard *clipboard, **/ gboolean gtk_clipboard_set_with_owner (GtkClipboard *clipboard, - GtkTargetList *targets, + GdkContentFormats *formats, GtkClipboardGetFunc get_func, GtkClipboardClearFunc clear_func, GObject *owner) { g_return_val_if_fail (clipboard != NULL, FALSE); - g_return_val_if_fail (targets != NULL, FALSE); + g_return_val_if_fail (formats != NULL, FALSE); g_return_val_if_fail (get_func != NULL, FALSE); g_return_val_if_fail (G_IS_OBJECT (owner), FALSE); return GTK_CLIPBOARD_GET_CLASS (clipboard)->set_contents (clipboard, - targets, + formats, get_func, clear_func, owner, @@ -702,12 +703,12 @@ clipboard_unset (GtkClipboard *clipboard) GtkClipboardClearFunc old_clear_func; gpointer old_data; gboolean old_have_owner; - gint old_n_storable_targets; + gint old_n_storable_formats; old_clear_func = clipboard->clear_func; old_data = clipboard->user_data; old_have_owner = clipboard->have_owner; - old_n_storable_targets = clipboard->n_storable_targets; + old_n_storable_formats = clipboard->n_storable_formats; if (old_have_owner) { @@ -715,9 +716,9 @@ clipboard_unset (GtkClipboard *clipboard) clipboard->have_owner = FALSE; } - clipboard->n_storable_targets = -1; - g_free (clipboard->storable_targets); - clipboard->storable_targets = NULL; + clipboard->n_storable_formats = -1; + g_free (clipboard->storable_formats); + clipboard->storable_formats = NULL; clipboard->get_func = NULL; clipboard->clear_func = NULL; @@ -730,7 +731,7 @@ clipboard_unset (GtkClipboard *clipboard) * unref the owner */ if (old_have_owner && - old_n_storable_targets != -1) + old_n_storable_formats != -1) g_object_unref (old_data); } @@ -795,24 +796,24 @@ gtk_clipboard_set_text (GtkClipboard *clipboard, const gchar *text, gint len) { - GtkTargetList *targets; + GdkContentFormats *formats; g_return_if_fail (clipboard != NULL); g_return_if_fail (text != NULL); - targets = gtk_target_list_new (NULL, 0); - gtk_target_list_add_text_targets (targets); + formats = gdk_content_formats_new (NULL, 0); + gtk_content_formats_add_text_targets (formats); if (len < 0) len = strlen (text); gtk_clipboard_set_with_data (clipboard, - targets, + formats, text_get_func, text_clear_func, g_strndup (text, len)); gtk_clipboard_set_can_store (clipboard, NULL); - gtk_target_list_unref (targets); + gdk_content_formats_unref (formats); } static void @@ -846,21 +847,21 @@ void gtk_clipboard_set_image (GtkClipboard *clipboard, GdkPixbuf *pixbuf) { - GtkTargetList *targets; + GdkContentFormats *formats; g_return_if_fail (clipboard != NULL); g_return_if_fail (GDK_IS_PIXBUF (pixbuf)); - targets = gtk_target_list_new (NULL, 0); - gtk_target_list_add_image_targets (targets, TRUE); + formats = gdk_content_formats_new (NULL, 0); + gtk_content_formats_add_image_targets (formats, TRUE); gtk_clipboard_set_with_data (clipboard, - targets, + formats, pixbuf_get_func, pixbuf_clear_func, g_object_ref (pixbuf)); gtk_clipboard_set_can_store (clipboard, NULL); - gtk_target_list_unref (targets); + gdk_content_formats_unref (formats); } /** @@ -1278,34 +1279,34 @@ gtk_clipboard_request_uris (GtkClipboard *clipboard, } static void -request_targets_received_func (GtkClipboard *clipboard, +request_formats_received_func (GtkClipboard *clipboard, GtkSelectionData *selection_data, gpointer data) { RequestTargetsInfo *info = data; - GdkAtom *targets = NULL; - gint n_targets = 0; + GdkAtom *formats = NULL; + gint n_formats = 0; - gtk_selection_data_get_targets (selection_data, &targets, &n_targets); + gtk_selection_data_get_targets (selection_data, &formats, &n_formats); - info->callback (clipboard, targets, n_targets, info->user_data); + info->callback (clipboard, formats, n_formats, info->user_data); g_free (info); - g_free (targets); + g_free (formats); } /** - * gtk_clipboard_request_targets: + * gtk_clipboard_request_formats: * @clipboard: a #GtkClipboard - * @callback: (scope async): a function to call when the targets are + * @callback: (scope async): a function to call when the formats 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. + * Requests the contents of the clipboard as list of supported formats. * When the list is later received, @callback will be called. * - * The @targets parameter to @callback will contain the resulting targets if + * The @formats parameter to @callback will contain the resulting formats if * the request succeeded, or %NULL if it failed. * * Since: 2.4 @@ -1320,11 +1321,11 @@ gtk_clipboard_request_targets (GtkClipboard *clipboard, g_return_if_fail (clipboard != NULL); g_return_if_fail (callback != NULL); - /* If the display supports change notification we cache targets */ + /* If the display supports change notification we cache formats */ if (gdk_display_supports_selection_notification (gtk_clipboard_get_display (clipboard)) && - clipboard->n_cached_targets != -1) + clipboard->n_cached_formats != -1) { - (* callback) (clipboard, clipboard->cached_targets, clipboard->n_cached_targets, user_data); + (* callback) (clipboard, clipboard->cached_formats, clipboard->n_cached_formats, user_data); return; } @@ -1333,7 +1334,7 @@ gtk_clipboard_request_targets (GtkClipboard *clipboard, info->user_data = user_data; gtk_clipboard_request_contents (clipboard, gdk_atom_intern_static_string ("TARGETS"), - request_targets_received_func, + request_formats_received_func, info); } @@ -1717,7 +1718,7 @@ gtk_clipboard_get_display (GtkClipboard *clipboard) * * Test to see if there is text available to be pasted * This is done by requesting the TARGETS atom and checking - * if it contains any of the supported text targets. This function + * if it contains any of the supported text formats. This function * waits for the data to be received using the main loop, so events, * timeouts, etc, may be dispatched during the wait. * @@ -1750,7 +1751,7 @@ gtk_clipboard_wait_is_text_available (GtkClipboard *clipboard) * * Test to see if there is rich text available to be pasted * This is done by requesting the TARGETS atom and checking - * if it contains any of the supported rich text targets. This function + * if it contains any of the supported rich text formats. This function * waits for the data to be received using the main loop, so events, * timeouts, etc, may be dispatched during the wait. * @@ -1788,7 +1789,7 @@ gtk_clipboard_wait_is_rich_text_available (GtkClipboard *clipboard, * * Test to see if there is an image available to be pasted * This is done by requesting the TARGETS atom and checking - * if it contains any of the supported image targets. This function + * if it contains any of the supported image formats. This function * waits for the data to be received using the main loop, so events, * timeouts, etc, may be dispatched during the wait. * @@ -1823,7 +1824,7 @@ gtk_clipboard_wait_is_image_available (GtkClipboard *clipboard) * * Test to see if there is a list of URIs available to be pasted * This is done by requesting the TARGETS atom and checking - * if it contains the URI targets. This function + * if it contains the URI formats. This function * waits for the data to be received using the main loop, so events, * timeouts, etc, may be dispatched during the wait. * @@ -1853,77 +1854,77 @@ gtk_clipboard_wait_is_uris_available (GtkClipboard *clipboard) } /** - * gtk_clipboard_wait_for_targets: + * gtk_clipboard_wait_for_formats: * @clipboard: a #GtkClipboard - * @targets: (out) (array length=n_targets) (transfer container): location - * to store an array of targets. The result stored here must + * @formats: (out) (array length=n_formats) (transfer container): location + * to store an array of formats. The result stored here must * be freed with g_free(). - * @n_targets: (out): location to store number of items in @targets. + * @n_formats: (out): location to store number of items in @formats. * - * Returns a list of targets that are present on the clipboard, or %NULL - * if there aren’t any targets available. The returned list must be + * Returns a list of formats that are present on the clipboard, or %NULL + * if there aren’t any formats available. The returned list must be * freed with g_free(). * This function waits for the data to be received using the main * loop, so events, timeouts, etc, may be dispatched during the wait. * - * Returns: %TRUE if any targets are present on the clipboard, + * Returns: %TRUE if any formats are present on the clipboard, * otherwise %FALSE. * * Since: 2.4 */ gboolean gtk_clipboard_wait_for_targets (GtkClipboard *clipboard, - GdkAtom **targets, - gint *n_targets) + GdkAtom **formats, + gint *n_formats) { GtkSelectionData *data; gboolean result = FALSE; g_return_val_if_fail (clipboard != NULL, FALSE); - /* If the display supports change notification we cache targets */ + /* If the display supports change notification we cache formats */ if (gdk_display_supports_selection_notification (gtk_clipboard_get_display (clipboard)) && - clipboard->n_cached_targets != -1) + clipboard->n_cached_formats != -1) { - if (n_targets) - *n_targets = clipboard->n_cached_targets; + if (n_formats) + *n_formats = clipboard->n_cached_formats; - if (targets) - *targets = g_memdup (clipboard->cached_targets, - clipboard->n_cached_targets * sizeof (GdkAtom)); + if (formats) + *formats = g_memdup (clipboard->cached_formats, + clipboard->n_cached_formats * sizeof (GdkAtom)); return TRUE; } - if (n_targets) - *n_targets = 0; + if (n_formats) + *n_formats = 0; - if (targets) - *targets = NULL; + if (formats) + *formats = NULL; data = gtk_clipboard_wait_for_contents (clipboard, gdk_atom_intern_static_string ("TARGETS")); if (data) { - GdkAtom *tmp_targets; - gint tmp_n_targets; + GdkAtom *tmp_formats; + gint tmp_n_formats; - result = gtk_selection_data_get_targets (data, &tmp_targets, &tmp_n_targets); + result = gtk_selection_data_get_targets (data, &tmp_formats, &tmp_n_formats); if (gdk_display_supports_selection_notification (gtk_clipboard_get_display (clipboard))) { - clipboard->n_cached_targets = tmp_n_targets; - clipboard->cached_targets = g_memdup (tmp_targets, - tmp_n_targets * sizeof (GdkAtom)); + clipboard->n_cached_formats = tmp_n_formats; + clipboard->cached_formats = g_memdup (tmp_formats, + tmp_n_formats * sizeof (GdkAtom)); } - if (n_targets) - *n_targets = tmp_n_targets; + if (n_formats) + *n_formats = tmp_n_formats; - if (targets) - *targets = tmp_targets; + if (formats) + *formats = tmp_formats; else - g_free (tmp_targets); + g_free (tmp_formats); gtk_selection_data_free (data); } @@ -1961,8 +1962,8 @@ clipboard_peek (GdkDisplay *display, clipboard->selection = selection; clipboard->display = display; - clipboard->n_cached_targets = -1; - clipboard->n_storable_targets = -1; + clipboard->n_cached_formats = -1; + clipboard->n_storable_formats = -1; clipboards = g_slist_prepend (clipboards, clipboard); g_object_set_data (G_OBJECT (display), I_("gtk-clipboard-list"), clipboards); g_signal_connect (display, "closed", @@ -1977,11 +1978,11 @@ static void gtk_clipboard_owner_change (GtkClipboard *clipboard, GdkEventOwnerChange *event) { - if (clipboard->n_cached_targets != -1) + if (clipboard->n_cached_formats != -1) { - g_free (clipboard->cached_targets); - clipboard->cached_targets = NULL; - clipboard->n_cached_targets = -1; + g_free (clipboard->cached_formats); + clipboard->cached_formats = NULL; + clipboard->n_cached_formats = -1; } } @@ -2005,23 +2006,23 @@ gboolean gtk_clipboard_wait_is_target_available (GtkClipboard *clipboard, GdkAtom target) { - GdkAtom *targets; - gint i, n_targets; + GdkAtom *formats; + gint i, n_formats; gboolean retval = FALSE; - if (!gtk_clipboard_wait_for_targets (clipboard, &targets, &n_targets)) + if (!gtk_clipboard_wait_for_targets (clipboard, &formats, &n_formats)) return FALSE; - for (i = 0; i < n_targets; i++) + for (i = 0; i < n_formats; i++) { - if (targets[i] == target) + if (formats[i] == target) { retval = TRUE; break; } } - g_free (targets); + g_free (formats); return retval; } @@ -2061,10 +2062,10 @@ gtk_clipboard_store_timeout (GtkClipboard *clipboard) /** * gtk_clipboard_set_can_store: * @clipboard: a #GtkClipboard - * @targets: (allow-none): The targets (data formats) in which the + * @formats: (allow-none): The targets (data formats) in which the * functions can provide the data or %NULL * to indicate that all forms should be stored. - * @n_targets: number of elements in @targets + * @n_formats: number of elements in @formats * * Hints that the clipboard data should be stored somewhere when the * application exits or when gtk_clipboard_store () is called. @@ -2077,16 +2078,16 @@ gtk_clipboard_store_timeout (GtkClipboard *clipboard) */ void gtk_clipboard_set_can_store (GtkClipboard *clipboard, - GtkTargetList *targets) + GdkContentFormats *formats) { g_return_if_fail (GTK_IS_CLIPBOARD (clipboard)); - GTK_CLIPBOARD_GET_CLASS (clipboard)->set_can_store (clipboard, targets); + GTK_CLIPBOARD_GET_CLASS (clipboard)->set_can_store (clipboard, formats); } static void -gtk_clipboard_real_set_can_store (GtkClipboard *clipboard, - GtkTargetList *targets) +gtk_clipboard_real_set_can_store (GtkClipboard *clipboard, + GdkContentFormats *formats) { GtkWidget *clipboard_widget; guint n_atoms; @@ -2094,16 +2095,16 @@ gtk_clipboard_real_set_can_store (GtkClipboard *clipboard, if (clipboard->selection != GDK_SELECTION_CLIPBOARD) return; - g_free (clipboard->storable_targets); + g_free (clipboard->storable_formats); clipboard_widget = get_clipboard_widget (clipboard->display); - /* n_storable_targets being -1 means that + /* n_storable_formats being -1 means that * gtk_clipboard_set_can_store hasn't been called since the * clipboard owner changed. We only want to add SAVE_TARGETS and * ref the owner once , so we do that here */ - if (clipboard->n_storable_targets == -1) + if (clipboard->n_storable_formats == -1) { gtk_selection_add_target (clipboard_widget, clipboard->selection, @@ -2114,15 +2115,15 @@ gtk_clipboard_real_set_can_store (GtkClipboard *clipboard, g_object_ref (clipboard->user_data); } - if (targets) + if (formats) { - clipboard->storable_targets = gtk_target_list_get_atoms (targets, &n_atoms); - clipboard->n_storable_targets = n_atoms; + clipboard->storable_formats = gdk_content_formats_get_atoms (formats, &n_atoms); + clipboard->n_storable_formats = n_atoms; } else { - clipboard->storable_targets = NULL; - clipboard->n_storable_targets = 0; + clipboard->storable_formats = NULL; + clipboard->n_storable_formats = 0; } } @@ -2163,7 +2164,7 @@ gtk_clipboard_real_store (GtkClipboard *clipboard) { GtkWidget *clipboard_widget; - if (clipboard->n_storable_targets < 0) + if (clipboard->n_storable_formats < 0) return; if (!gdk_display_supports_clipboard_persistence (clipboard->display)) @@ -2180,8 +2181,8 @@ gtk_clipboard_real_store (GtkClipboard *clipboard) gdk_display_store_clipboard (clipboard->display, gtk_widget_get_window (clipboard_widget), clipboard_get_timestamp (clipboard), - clipboard->storable_targets, - clipboard->n_storable_targets); + clipboard->storable_formats, + clipboard->n_storable_formats); clipboard->storing_selection = TRUE; diff --git a/gtk/gtkclipboard.h b/gtk/gtkclipboard.h index e80a20bdd1..ecc49bee10 100644 --- a/gtk/gtkclipboard.h +++ b/gtk/gtkclipboard.h @@ -194,13 +194,13 @@ GdkDisplay *gtk_clipboard_get_display (GtkClipboard *clipboard); GDK_AVAILABLE_IN_ALL gboolean gtk_clipboard_set_with_data (GtkClipboard *clipboard, - GtkTargetList *targets, + GdkContentFormats *formats, GtkClipboardGetFunc get_func, GtkClipboardClearFunc clear_func, gpointer user_data); GDK_AVAILABLE_IN_ALL gboolean gtk_clipboard_set_with_owner (GtkClipboard *clipboard, - GtkTargetList *targets, + GdkContentFormats *formats, GtkClipboardGetFunc get_func, GtkClipboardClearFunc clear_func, GObject *owner); @@ -283,7 +283,7 @@ gboolean gtk_clipboard_wait_is_target_available (GtkClipboard *clipboard, GDK_AVAILABLE_IN_ALL void gtk_clipboard_set_can_store (GtkClipboard *clipboard, - GtkTargetList *targets); + GdkContentFormats *targets); GDK_AVAILABLE_IN_ALL void gtk_clipboard_store (GtkClipboard *clipboard); diff --git a/gtk/gtkclipboardprivate.h b/gtk/gtkclipboardprivate.h index d4c0b1857d..c001866c96 100644 --- a/gtk/gtkclipboardprivate.h +++ b/gtk/gtkclipboardprivate.h @@ -46,15 +46,15 @@ struct _GtkClipboard gboolean have_selection; GdkDisplay *display; - GdkAtom *cached_targets; - gint n_cached_targets; + GdkAtom *cached_formats; + gint n_cached_formats; gulong notify_signal_id; gboolean storing_selection; GMainLoop *store_loop; guint store_timeout; - gint n_storable_targets; - GdkAtom *storable_targets; + gint n_storable_formats; + GdkAtom *storable_formats; }; struct _GtkClipboardClass @@ -63,7 +63,7 @@ struct _GtkClipboardClass /* vfuncs */ gboolean (* set_contents) (GtkClipboard *clipboard, - GtkTargetList *targets, + GdkContentFormats *formats, GtkClipboardGetFunc get_func, GtkClipboardClearFunc clear_func, gpointer user_data, @@ -74,7 +74,7 @@ struct _GtkClipboardClass GtkClipboardReceivedFunc callback, gpointer user_data); void (* set_can_store) (GtkClipboard *clipboard, - GtkTargetList *targets); + GdkContentFormats *formats); void (* store) (GtkClipboard *clipboard); /* signals */ diff --git a/gtk/gtkcolorbutton.c b/gtk/gtkcolorbutton.c index 9e042ee410..3f2de5124b 100644 --- a/gtk/gtkcolorbutton.c +++ b/gtk/gtkcolorbutton.c @@ -384,7 +384,7 @@ gtk_color_button_init (GtkColorButton *button) PangoLayout *layout; PangoRectangle rect; GtkStyleContext *context; - GtkTargetList *targets; + GdkContentFormats *targets; gtk_widget_set_has_window (GTK_WIDGET (button), FALSE); @@ -413,7 +413,7 @@ gtk_color_button_init (GtkColorButton *button) priv->rgba.alpha = 1; priv->use_alpha = FALSE; - targets = gtk_target_list_new (drop_types, G_N_ELEMENTS (drop_types)); + targets = gdk_content_formats_new (drop_types, G_N_ELEMENTS (drop_types)); gtk_drag_dest_set (priv->button, GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_HIGHLIGHT | @@ -424,7 +424,7 @@ gtk_color_button_init (GtkColorButton *button) GDK_BUTTON1_MASK|GDK_BUTTON3_MASK, targets, GDK_ACTION_COPY); - gtk_target_list_unref (targets); + gdk_content_formats_unref (targets); g_signal_connect (priv->button, "drag-begin", G_CALLBACK (gtk_color_button_drag_begin), button); g_signal_connect (priv->button, "drag-data-received", diff --git a/gtk/gtkcolorswatch.c b/gtk/gtkcolorswatch.c index e9f023dd14..f12eb1a06c 100644 --- a/gtk/gtkcolorswatch.c +++ b/gtk/gtkcolorswatch.c @@ -618,12 +618,12 @@ gtk_color_swatch_set_rgba (GtkColorSwatch *swatch, if (!swatch->priv->has_color) { - GtkTargetList *targets = gtk_target_list_new (dnd_targets, G_N_ELEMENTS (dnd_targets)); + GdkContentFormats *targets = gdk_content_formats_new (dnd_targets, G_N_ELEMENTS (dnd_targets)); gtk_drag_source_set (GTK_WIDGET (swatch), GDK_BUTTON1_MASK | GDK_BUTTON3_MASK, targets, GDK_ACTION_COPY | GDK_ACTION_MOVE); - gtk_target_list_unref (targets); + gdk_content_formats_unref (targets); } swatch->priv->has_color = TRUE; @@ -681,14 +681,14 @@ gtk_color_swatch_set_can_drop (GtkColorSwatch *swatch, { if (can_drop) { - GtkTargetList *targets = gtk_target_list_new (dnd_targets, G_N_ELEMENTS (dnd_targets)); + GdkContentFormats *targets = gdk_content_formats_new (dnd_targets, G_N_ELEMENTS (dnd_targets)); gtk_drag_dest_set (GTK_WIDGET (swatch), GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP, targets, GDK_ACTION_COPY); - gtk_target_list_unref (targets); + gdk_content_formats_unref (targets); } else { diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c index 11f4cb3be8..45e693201b 100644 --- a/gtk/gtkdnd.c +++ b/gtk/gtkdnd.c @@ -34,6 +34,8 @@ #include "gdk/gdk.h" +#include "gdk/gdkcontentformatsprivate.h" + #ifdef GDK_WINDOWING_X11 #include <X11/Xlib.h> #include <X11/keysym.h> @@ -93,7 +95,7 @@ typedef enum struct _GtkDragSourceInfo { GtkWidget *widget; - GtkTargetList *target_list; /* Targets for drag data */ + GdkContentFormats *target_list; /* Targets for drag data */ GdkDragAction possible_actions; /* Actions allowed by source */ GdkDragContext *context; /* drag context */ GtkWidget *icon_window; /* Window for drag */ @@ -816,8 +818,7 @@ gtk_drag_selection_received (GtkWidget *widget, if (site && site->target_list) { - if (gtk_target_list_find (site->target_list, - target)) + if (gdk_content_formats_contains (site->target_list, target)) { if (!(site->flags & GTK_DEST_DEFAULT_DROP) || gtk_selection_data_get_length (selection_data) >= 0) @@ -1171,7 +1172,7 @@ gtk_drag_is_managed (GtkWidget *source_widget) GdkDragContext * gtk_drag_begin_internal (GtkWidget *widget, GtkImageDefinition *icon, - GtkTargetList *target_list, + GdkContentFormats *target_list, GdkDragAction actions, gint button, const GdkEvent *event, @@ -1262,7 +1263,7 @@ gtk_drag_begin_internal (GtkWidget *widget, gtk_device_grab_add (ipc_widget, pointer, FALSE); } - atoms = gtk_target_list_get_atoms (target_list, &n_atoms); + atoms = gdk_content_formats_get_atoms (target_list, &n_atoms); for (i = 0; i < n_atoms; i++) { targets = g_list_prepend (targets, (gpointer) atoms[i]); @@ -1313,7 +1314,7 @@ gtk_drag_begin_internal (GtkWidget *widget, info->button = button; info->cursor = cursor; info->target_list = target_list; - gtk_target_list_ref (target_list); + gdk_content_formats_ref (target_list); info->possible_actions = actions; @@ -1440,13 +1441,13 @@ gtk_drag_begin_internal (GtkWidget *widget, * Since: 3.10 */ GdkDragContext * -gtk_drag_begin_with_coordinates (GtkWidget *widget, - GtkTargetList *targets, - GdkDragAction actions, - gint button, - GdkEvent *event, - gint x, - gint y) +gtk_drag_begin_with_coordinates (GtkWidget *widget, + GdkContentFormats *targets, + GdkDragAction actions, + gint button, + GdkEvent *event, + gint x, + gint y) { g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); g_return_val_if_fail (gtk_widget_get_realized (widget), NULL); @@ -1852,9 +1853,9 @@ gtk_drag_drop (GtkDragSourceInfo *info, /* GTK+ traditionally has used application/x-rootwin-drop, but the * XDND spec specifies x-rootwindow-drop. */ - if (gtk_target_list_find (info->target_list, "application/x-rootwindow-drop")) + if (gdk_content_formats_contains (info->target_list, "application/x-rootwindow-drop")) found = gdk_atom_intern ("application/x-rootwindow-drop", FALSE); - if (gtk_target_list_find (info->target_list, "application/x-rootwin-drop")) + if (gdk_content_formats_contains (info->target_list, "application/x-rootwin-drop")) found = gdk_atom_intern ("application/x-rootwin-drop", FALSE); else found = NULL; @@ -1913,8 +1914,8 @@ gtk_drag_selection_get (GtkWidget *widget, info->context); gtk_selection_data_set (selection_data, null_atom, 8, NULL, 0); } - else if (gtk_target_list_find (info->target_list, - gtk_selection_data_get_target (selection_data))) + else if (gdk_content_formats_contains (info->target_list, + gtk_selection_data_get_target (selection_data))) { g_signal_emit_by_name (info->widget, "drag-data-get", info->context, @@ -1993,7 +1994,7 @@ gtk_drag_source_info_destroy (GtkDragSourceInfo *info) source_widgets = g_slist_remove (source_widgets, info->ipc_widget); gtk_drag_release_ipc_widget (info->ipc_widget); - gtk_target_list_unref (info->target_list); + gdk_content_formats_unref (info->target_list); if (info->drop_timeout) g_source_remove (info->drop_timeout); diff --git a/gtk/gtkdnd.h b/gtk/gtkdnd.h index 53fb73a93d..b08a8a83ab 100644 --- a/gtk/gtkdnd.h +++ b/gtk/gtkdnd.h @@ -62,7 +62,7 @@ void gtk_drag_unhighlight (GtkWidget *widget); GDK_AVAILABLE_IN_3_10 GdkDragContext *gtk_drag_begin_with_coordinates (GtkWidget *widget, - GtkTargetList *targets, + GdkContentFormats *formats, GdkDragAction actions, gint button, GdkEvent *event, diff --git a/gtk/gtkdndprivate.h b/gtk/gtkdndprivate.h index 86e1c236cc..69d49d35bf 100644 --- a/gtk/gtkdndprivate.h +++ b/gtk/gtkdndprivate.h @@ -30,7 +30,7 @@ typedef struct _GtkDragDestSite GtkDragDestSite; struct _GtkDragDestSite { GtkDestDefaults flags; - GtkTargetList *target_list; + GdkContentFormats *target_list; GdkDragAction actions; guint do_proxy : 1; guint proxy_coords : 1; @@ -42,7 +42,7 @@ G_BEGIN_DECLS GdkDragContext * gtk_drag_begin_internal (GtkWidget *widget, GtkImageDefinition *icon, - GtkTargetList *target_list, + GdkContentFormats *target_list, GdkDragAction actions, gint button, const GdkEvent *event, diff --git a/gtk/gtkdragdest.c b/gtk/gtkdragdest.c index 482a5d2a84..cd9ee3c5f4 100644 --- a/gtk/gtkdragdest.c +++ b/gtk/gtkdragdest.c @@ -57,7 +57,7 @@ gtk_drag_dest_site_destroy (gpointer data) GtkDragDestSite *site = data; if (site->target_list) - gtk_target_list_unref (site->target_list); + gdk_content_formats_unref (site->target_list); g_slice_free (GtkDragDestSite, site); } @@ -143,10 +143,10 @@ gtk_drag_dest_set_internal (GtkWidget *widget, * ]| */ void -gtk_drag_dest_set (GtkWidget *widget, - GtkDestDefaults flags, - GtkTargetList *targets, - GdkDragAction actions) +gtk_drag_dest_set (GtkWidget *widget, + GtkDestDefaults flags, + GdkContentFormats *targets, + GdkDragAction actions) { GtkDragDestSite *site; @@ -157,7 +157,7 @@ gtk_drag_dest_set (GtkWidget *widget, site->flags = flags; site->have_drag = FALSE; if (targets) - site->target_list = gtk_target_list_ref (targets); + site->target_list = gdk_content_formats_ref (targets); else site->target_list = NULL; site->actions = actions; @@ -202,9 +202,9 @@ gtk_drag_dest_unset (GtkWidget *widget) * Returns the list of targets this widget can accept from * drag-and-drop. * - * Returns: (nullable) (transfer none): the #GtkTargetList, or %NULL if none + * Returns: (nullable) (transfer none): the #GdkContentFormats, or %NULL if none */ -GtkTargetList * +GdkContentFormats * gtk_drag_dest_get_target_list (GtkWidget *widget) { GtkDragDestSite *site; @@ -227,7 +227,7 @@ gtk_drag_dest_get_target_list (GtkWidget *widget) */ void gtk_drag_dest_set_target_list (GtkWidget *widget, - GtkTargetList *target_list) + GdkContentFormats *target_list) { GtkDragDestSite *site; @@ -243,10 +243,10 @@ gtk_drag_dest_set_target_list (GtkWidget *widget, } if (target_list) - gtk_target_list_ref (target_list); + gdk_content_formats_ref (target_list); if (site->target_list) - gtk_target_list_unref (site->target_list); + gdk_content_formats_unref (site->target_list); site->target_list = target_list; } @@ -266,16 +266,16 @@ gtk_drag_dest_set_target_list (GtkWidget *widget, void gtk_drag_dest_add_text_targets (GtkWidget *widget) { - GtkTargetList *target_list; + GdkContentFormats *target_list; target_list = gtk_drag_dest_get_target_list (widget); if (target_list) - gtk_target_list_ref (target_list); + gdk_content_formats_ref (target_list); else - target_list = gtk_target_list_new (NULL, 0); - gtk_target_list_add_text_targets (target_list); + target_list = gdk_content_formats_new (NULL, 0); + gtk_content_formats_add_text_targets (target_list); gtk_drag_dest_set_target_list (widget, target_list); - gtk_target_list_unref (target_list); + gdk_content_formats_unref (target_list); } /** @@ -293,16 +293,16 @@ gtk_drag_dest_add_text_targets (GtkWidget *widget) void gtk_drag_dest_add_image_targets (GtkWidget *widget) { - GtkTargetList *target_list; + GdkContentFormats *target_list; target_list = gtk_drag_dest_get_target_list (widget); if (target_list) - gtk_target_list_ref (target_list); + gdk_content_formats_ref (target_list); else - target_list = gtk_target_list_new (NULL, 0); - gtk_target_list_add_image_targets (target_list, FALSE); + target_list = gdk_content_formats_new (NULL, 0); + gtk_content_formats_add_image_targets (target_list, FALSE); gtk_drag_dest_set_target_list (widget, target_list); - gtk_target_list_unref (target_list); + gdk_content_formats_unref (target_list); } /** @@ -320,16 +320,16 @@ gtk_drag_dest_add_image_targets (GtkWidget *widget) void gtk_drag_dest_add_uri_targets (GtkWidget *widget) { - GtkTargetList *target_list; + GdkContentFormats *target_list; target_list = gtk_drag_dest_get_target_list (widget); if (target_list) - gtk_target_list_ref (target_list); + gdk_content_formats_ref (target_list); else - target_list = gtk_target_list_new (NULL, 0); - gtk_target_list_add_uri_targets (target_list); + target_list = gdk_content_formats_new (NULL, 0); + gtk_content_formats_add_uri_targets (target_list); gtk_drag_dest_set_target_list (widget, target_list); - gtk_target_list_unref (target_list); + gdk_content_formats_unref (target_list); } /** @@ -407,11 +407,11 @@ gtk_drag_dest_get_track_motion (GtkWidget *widget) * and the dest can accept, or %NULL */ GdkAtom -gtk_drag_dest_find_target (GtkWidget *widget, - GdkDragContext *context, - GtkTargetList *target_list) +gtk_drag_dest_find_target (GtkWidget *widget, + GdkDragContext *context, + GdkContentFormats *target_list) { - GtkTargetList *source_list; + GdkContentFormats *source_list; GList *tmp_source; GdkAtom result; @@ -424,17 +424,17 @@ gtk_drag_dest_find_target (GtkWidget *widget, if (target_list == NULL) return NULL; - source_list = gtk_target_list_new (NULL, 0); + source_list = gdk_content_formats_new (NULL, 0); for (tmp_source = gdk_drag_context_list_targets (context); tmp_source != NULL; tmp_source = tmp_source->next) { - gtk_target_list_add (source_list, tmp_source->data); + gdk_content_formats_add (source_list, tmp_source->data); } - result = gtk_target_list_intersects (target_list, source_list); + result = gdk_content_formats_intersects (target_list, source_list); - gtk_target_list_unref (source_list); + gdk_content_formats_unref (source_list); return result; } diff --git a/gtk/gtkdragdest.h b/gtk/gtkdragdest.h index 609a32ebe3..84a65a5eae 100644 --- a/gtk/gtkdragdest.h +++ b/gtk/gtkdragdest.h @@ -40,14 +40,14 @@ G_BEGIN_DECLS /** * GtkDestDefaults: * @GTK_DEST_DEFAULT_MOTION: If set for a widget, GTK+, during a drag over this - * widget will check if the drag matches this widget’s list of possible targets + * widget will check if the drag matches this widget’s list of possible formats * and actions. * GTK+ will then call gdk_drag_status() as appropriate. * @GTK_DEST_DEFAULT_HIGHLIGHT: If set for a widget, GTK+ will draw a highlight on * this widget as long as a drag is over this widget and the widget drag format * and action are acceptable. * @GTK_DEST_DEFAULT_DROP: If set for a widget, when a drop occurs, GTK+ will - * will check if the drag matches this widget’s list of possible targets and + * will check if the drag matches this widget’s list of possible formats and * actions. If so, GTK+ will call gtk_drag_get_data() on behalf of the widget. * Whether or not the drop is successful, GTK+ will call gtk_drag_finish(). If * the action was a move, then if the drag was successful, then %TRUE will be @@ -69,21 +69,21 @@ typedef enum { GDK_AVAILABLE_IN_ALL void gtk_drag_dest_set (GtkWidget *widget, GtkDestDefaults flags, - GtkTargetList *targets, + GdkContentFormats *formats, GdkDragAction actions); GDK_AVAILABLE_IN_ALL void gtk_drag_dest_unset (GtkWidget *widget); GDK_AVAILABLE_IN_ALL -GdkAtom gtk_drag_dest_find_target (GtkWidget *widget, - GdkDragContext *context, - GtkTargetList *target_list); +GdkAtom gtk_drag_dest_find_target (GtkWidget *widget, + GdkDragContext *context, + GdkContentFormats *target_list); GDK_AVAILABLE_IN_ALL -GtkTargetList* gtk_drag_dest_get_target_list (GtkWidget *widget); +GdkContentFormats* gtk_drag_dest_get_target_list (GtkWidget *widget); GDK_AVAILABLE_IN_ALL void gtk_drag_dest_set_target_list (GtkWidget *widget, - GtkTargetList *target_list); + GdkContentFormats *target_list); GDK_AVAILABLE_IN_ALL void gtk_drag_dest_add_text_targets (GtkWidget *widget); GDK_AVAILABLE_IN_ALL diff --git a/gtk/gtkdragsource.c b/gtk/gtkdragsource.c index 6a22db646d..cab952cbc5 100644 --- a/gtk/gtkdragsource.c +++ b/gtk/gtkdragsource.c @@ -38,7 +38,7 @@ typedef struct _GtkDragSourceSite GtkDragSourceSite; struct _GtkDragSourceSite { GdkModifierType start_button_mask; - GtkTargetList *target_list; /* Targets for drag data */ + GdkContentFormats *target_list; /* Targets for drag data */ GdkDragAction actions; /* Possible actions */ GtkImageDefinition *image_def; @@ -114,7 +114,7 @@ gtk_drag_source_site_destroy (gpointer data) GtkDragSourceSite *site = data; if (site->target_list) - gtk_target_list_unref (site->target_list); + gdk_content_formats_unref (site->target_list); gtk_image_definition_unref (site->image_def); g_clear_object (&site->drag_gesture); @@ -133,10 +133,10 @@ gtk_drag_source_site_destroy (gpointer data) * clicks and drags on the widget. The widget must have a window. */ void -gtk_drag_source_set (GtkWidget *widget, - GdkModifierType start_button_mask, - GtkTargetList *targets, - GdkDragAction actions) +gtk_drag_source_set (GtkWidget *widget, + GdkModifierType start_button_mask, + GdkContentFormats *targets, + GdkDragAction actions) { GtkDragSourceSite *site; @@ -147,7 +147,7 @@ gtk_drag_source_set (GtkWidget *widget, if (site) { if (site->target_list) - gtk_target_list_unref (site->target_list); + gdk_content_formats_unref (site->target_list); } else { @@ -178,7 +178,7 @@ gtk_drag_source_set (GtkWidget *widget, site->start_button_mask = start_button_mask; if (targets) - site->target_list = gtk_target_list_ref (targets); + site->target_list = gdk_content_formats_ref (targets); else site->target_list = NULL; @@ -216,11 +216,11 @@ gtk_drag_source_unset (GtkWidget *widget) * Gets the list of targets this widget can provide for * drag-and-drop. * - * Returns: (nullable) (transfer none): the #GtkTargetList, or %NULL if none + * Returns: (nullable) (transfer none): the #GdkContentFormats, or %NULL if none * * Since: 2.4 */ -GtkTargetList * +GdkContentFormats * gtk_drag_source_get_target_list (GtkWidget *widget) { GtkDragSourceSite *site; @@ -244,8 +244,8 @@ gtk_drag_source_get_target_list (GtkWidget *widget) * Since: 2.4 */ void -gtk_drag_source_set_target_list (GtkWidget *widget, - GtkTargetList *target_list) +gtk_drag_source_set_target_list (GtkWidget *widget, + GdkContentFormats *target_list) { GtkDragSourceSite *site; @@ -260,10 +260,10 @@ gtk_drag_source_set_target_list (GtkWidget *widget, } if (target_list) - gtk_target_list_ref (target_list); + gdk_content_formats_ref (target_list); if (site->target_list) - gtk_target_list_unref (site->target_list); + gdk_content_formats_unref (site->target_list); site->target_list = target_list; } @@ -275,7 +275,7 @@ gtk_drag_source_set_target_list (GtkWidget *widget, * Add the text targets supported by #GtkSelectionData to * the target list of the drag source. The targets * are added with @info = 0. If you need another value, - * use gtk_target_list_add_text_targets() and + * use gtk_content_formats_add_text_targets() and * gtk_drag_source_set_target_list(). * * Since: 2.6 @@ -283,16 +283,16 @@ gtk_drag_source_set_target_list (GtkWidget *widget, void gtk_drag_source_add_text_targets (GtkWidget *widget) { - GtkTargetList *target_list; + GdkContentFormats *target_list; target_list = gtk_drag_source_get_target_list (widget); if (target_list) - gtk_target_list_ref (target_list); + gdk_content_formats_ref (target_list); else - target_list = gtk_target_list_new (NULL, 0); - gtk_target_list_add_text_targets (target_list); + target_list = gdk_content_formats_new (NULL, 0); + gtk_content_formats_add_text_targets (target_list); gtk_drag_source_set_target_list (widget, target_list); - gtk_target_list_unref (target_list); + gdk_content_formats_unref (target_list); } /** @@ -310,16 +310,16 @@ gtk_drag_source_add_text_targets (GtkWidget *widget) void gtk_drag_source_add_image_targets (GtkWidget *widget) { - GtkTargetList *target_list; + GdkContentFormats *target_list; target_list = gtk_drag_source_get_target_list (widget); if (target_list) - gtk_target_list_ref (target_list); + gdk_content_formats_ref (target_list); else - target_list = gtk_target_list_new (NULL, 0); - gtk_target_list_add_image_targets (target_list, TRUE); + target_list = gdk_content_formats_new (NULL, 0); + gtk_content_formats_add_image_targets (target_list, TRUE); gtk_drag_source_set_target_list (widget, target_list); - gtk_target_list_unref (target_list); + gdk_content_formats_unref (target_list); } /** @@ -329,7 +329,7 @@ gtk_drag_source_add_image_targets (GtkWidget *widget) * Add the URI targets supported by #GtkSelectionData to * the target list of the drag source. The targets * are added with @info = 0. If you need another value, - * use gtk_target_list_add_uri_targets() and + * use gtk_content_formats_add_uri_targets() and * gtk_drag_source_set_target_list(). * * Since: 2.6 @@ -337,16 +337,16 @@ gtk_drag_source_add_image_targets (GtkWidget *widget) void gtk_drag_source_add_uri_targets (GtkWidget *widget) { - GtkTargetList *target_list; + GdkContentFormats *target_list; target_list = gtk_drag_source_get_target_list (widget); if (target_list) - gtk_target_list_ref (target_list); + gdk_content_formats_ref (target_list); else - target_list = gtk_target_list_new (NULL, 0); - gtk_target_list_add_uri_targets (target_list); + target_list = gdk_content_formats_new (NULL, 0); + gtk_content_formats_add_uri_targets (target_list); gtk_drag_source_set_target_list (widget, target_list); - gtk_target_list_unref (target_list); + gdk_content_formats_unref (target_list); } /** diff --git a/gtk/gtkdragsource.h b/gtk/gtkdragsource.h index 8c1c6a2276..513d794350 100644 --- a/gtk/gtkdragsource.h +++ b/gtk/gtkdragsource.h @@ -40,17 +40,17 @@ G_BEGIN_DECLS GDK_AVAILABLE_IN_ALL void gtk_drag_source_set (GtkWidget *widget, GdkModifierType start_button_mask, - GtkTargetList *targets, + GdkContentFormats *formats, GdkDragAction actions); GDK_AVAILABLE_IN_ALL void gtk_drag_source_unset (GtkWidget *widget); GDK_AVAILABLE_IN_ALL -GtkTargetList* gtk_drag_source_get_target_list (GtkWidget *widget); +GdkContentFormats * gtk_drag_source_get_target_list (GtkWidget *widget); GDK_AVAILABLE_IN_ALL -void gtk_drag_source_set_target_list (GtkWidget *widget, - GtkTargetList *target_list); +void gtk_drag_source_set_target_list (GtkWidget *widget, + GdkContentFormats *target_list); GDK_AVAILABLE_IN_ALL void gtk_drag_source_add_text_targets (GtkWidget *widget); GDK_AVAILABLE_IN_ALL diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index bb1209a165..d1dd6548ee 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -281,7 +281,7 @@ struct _EntryIconInfo guint pressed : 1; GdkDragAction actions; - GtkTargetList *target_list; + GdkContentFormats *target_list; GdkEventSequence *current_sequence; GdkDevice *device; }; @@ -2703,7 +2703,7 @@ gtk_entry_finalize (GObject *object) continue; if (icon_info->target_list != NULL) - gtk_target_list_unref (icon_info->target_list); + gdk_content_formats_unref (icon_info->target_list); gtk_widget_unparent (icon_info->widget); @@ -3904,11 +3904,11 @@ gtk_entry_drag_gesture_update (GtkGestureDrag *gesture, { gint *ranges; gint n_ranges; - GtkTargetList *target_list = gtk_target_list_new (NULL, 0); + GdkContentFormats *target_list = gdk_content_formats_new (NULL, 0); guint actions = priv->editable ? GDK_ACTION_COPY | GDK_ACTION_MOVE : GDK_ACTION_COPY; guint button; - gtk_target_list_add_text_targets (target_list); + gtk_content_formats_add_text_targets (target_list); gtk_entry_get_pixel_ranges (entry, &ranges, &n_ranges); @@ -3921,7 +3921,7 @@ gtk_entry_drag_gesture_update (GtkGestureDrag *gesture, priv->in_drag = FALSE; - gtk_target_list_unref (target_list); + gdk_content_formats_unref (target_list); } } else @@ -6581,15 +6581,15 @@ primary_clear_cb (GtkClipboard *clipboard, static void gtk_entry_update_primary_selection (GtkEntry *entry) { - GtkTargetList *list; + GdkContentFormats *list; GtkClipboard *clipboard; gint start, end; if (!gtk_widget_get_realized (GTK_WIDGET (entry))) return; - list = gtk_target_list_new (NULL, 0); - gtk_target_list_add_text_targets (list); + list = gdk_content_formats_new (NULL, 0); + gtk_content_formats_add_text_targets (list); clipboard = gtk_widget_get_clipboard (GTK_WIDGET (entry), GDK_SELECTION_PRIMARY); @@ -6604,7 +6604,7 @@ gtk_entry_update_primary_selection (GtkEntry *entry) gtk_clipboard_clear (clipboard); } - gtk_target_list_unref (list); + gdk_content_formats_unref (list); } static void @@ -8013,7 +8013,7 @@ gtk_entry_get_icon_at_pos (GtkEntry *entry, * gtk_entry_set_icon_drag_source: * @entry: a #GtkEntry * @icon_pos: icon position - * @target_list: the targets (data formats) in which the data can be provided + * @formats: the targets (data formats) in which the data can be provided * @actions: a bitmask of the allowed drag actions * * Sets up the icon at the given position so that GTK+ will start a drag @@ -8035,7 +8035,7 @@ gtk_entry_get_icon_at_pos (GtkEntry *entry, void gtk_entry_set_icon_drag_source (GtkEntry *entry, GtkEntryIconPosition icon_pos, - GtkTargetList *target_list, + GdkContentFormats *formats, GdkDragAction actions) { GtkEntryPrivate *priv; @@ -8050,10 +8050,10 @@ gtk_entry_set_icon_drag_source (GtkEntry *entry, icon_info = construct_icon_info (GTK_WIDGET (entry), icon_pos); if (icon_info->target_list) - gtk_target_list_unref (icon_info->target_list); - icon_info->target_list = target_list; + gdk_content_formats_unref (icon_info->target_list); + icon_info->target_list = formats; if (icon_info->target_list) - gtk_target_list_ref (icon_info->target_list); + gdk_content_formats_ref (icon_info->target_list); icon_info->actions = actions; } diff --git a/gtk/gtkentry.h b/gtk/gtkentry.h index ac37bc5fc8..256140db28 100644 --- a/gtk/gtkentry.h +++ b/gtk/gtkentry.h @@ -342,7 +342,7 @@ gchar * gtk_entry_get_icon_tooltip_markup (GtkEntry * GDK_AVAILABLE_IN_ALL void gtk_entry_set_icon_drag_source (GtkEntry *entry, GtkEntryIconPosition icon_pos, - GtkTargetList *target_list, + GdkContentFormats *formats, GdkDragAction actions); GDK_AVAILABLE_IN_ALL gint gtk_entry_get_current_icon_drag_source (GtkEntry *entry); diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c index ab7e041cae..095352a01b 100644 --- a/gtk/gtkfilechooserbutton.c +++ b/gtk/gtkfilechooserbutton.c @@ -477,7 +477,7 @@ gtk_file_chooser_button_init (GtkFileChooserButton *button) GtkFileChooserButtonPrivate *priv; GtkWidget *box; GtkWidget *icon; - GtkTargetList *target_list; + GdkContentFormats *target_list; gtk_widget_set_has_window (GTK_WIDGET (button), FALSE); @@ -538,14 +538,14 @@ gtk_file_chooser_button_init (GtkFileChooserButton *button) NULL, NULL); /* DnD */ - target_list = gtk_target_list_new (NULL, 0); - gtk_target_list_add_uri_targets (target_list); - gtk_target_list_add_text_targets (target_list); + target_list = gdk_content_formats_new (NULL, 0); + gtk_content_formats_add_uri_targets (target_list); + gtk_content_formats_add_text_targets (target_list); gtk_drag_dest_set (GTK_WIDGET (button), (GTK_DEST_DEFAULT_ALL), target_list, GDK_ACTION_COPY); - gtk_target_list_unref (target_list); + gdk_content_formats_unref (target_list); } diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index b29fe3d790..6b0da2ac68 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -1724,20 +1724,20 @@ copy_file_location_cb (GSimpleAction *action, if (selected_files) { GtkClipboard *clipboard; - GtkTargetList *target_list; + GdkContentFormats *target_list; clipboard = gtk_widget_get_clipboard (GTK_WIDGET (impl), GDK_SELECTION_CLIPBOARD); - target_list = gtk_target_list_new (NULL, 0); - gtk_target_list_add_text_targets (target_list); - gtk_target_list_add_uri_targets (target_list); + target_list = gdk_content_formats_new (NULL, 0); + gtk_content_formats_add_text_targets (target_list); + gtk_content_formats_add_uri_targets (target_list); gtk_clipboard_set_with_data (clipboard, target_list, copy_file_get_cb, copy_file_clear_cb, selected_files); - gtk_target_list_unref (target_list); + gdk_content_formats_unref (target_list); } } diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c index fa8d55f698..8a7b2595a6 100644 --- a/gtk/gtkiconview.c +++ b/gtk/gtkiconview.c @@ -6276,7 +6276,7 @@ gtk_icon_view_drag_data_get (GtkWidget *widget, return; /* We can implement the GTK_TREE_MODEL_ROW target generically for - * any model; for DragSource models there are some other targets + * any model; for DragSource models there are some other formats * we also support. */ @@ -6551,7 +6551,7 @@ gtk_icon_view_drag_data_received (GtkWidget *widget, * gtk_icon_view_enable_model_drag_source: * @icon_view: a #GtkIconView * @start_button_mask: Mask of allowed buttons to start drag - * @targets: the targets that the drag will support + * @formats: the formats that the drag will support * @actions: the bitmask of possible actions for a drag from this * widget * @@ -6563,12 +6563,12 @@ gtk_icon_view_drag_data_received (GtkWidget *widget, void gtk_icon_view_enable_model_drag_source (GtkIconView *icon_view, GdkModifierType start_button_mask, - GtkTargetList *targets, + GdkContentFormats *formats, GdkDragAction actions) { g_return_if_fail (GTK_IS_ICON_VIEW (icon_view)); - gtk_drag_source_set (GTK_WIDGET (icon_view), 0, targets, actions); + gtk_drag_source_set (GTK_WIDGET (icon_view), 0, formats, actions); icon_view->priv->start_button_mask = start_button_mask; icon_view->priv->source_actions = actions; @@ -6581,7 +6581,7 @@ gtk_icon_view_enable_model_drag_source (GtkIconView *icon_view, /** * gtk_icon_view_enable_model_drag_dest: * @icon_view: a #GtkIconView - * @targets: the targets that the drag will support + * @formats: the formats that the drag will support * @actions: the bitmask of possible actions for a drag to this * widget * @@ -6591,13 +6591,13 @@ gtk_icon_view_enable_model_drag_source (GtkIconView *icon_view, * Since: 2.8 **/ void -gtk_icon_view_enable_model_drag_dest (GtkIconView *icon_view, - GtkTargetList *targets, - GdkDragAction actions) +gtk_icon_view_enable_model_drag_dest (GtkIconView *icon_view, + GdkContentFormats *formats, + GdkDragAction actions) { g_return_if_fail (GTK_IS_ICON_VIEW (icon_view)); - gtk_drag_dest_set (GTK_WIDGET (icon_view), 0, targets, actions); + gtk_drag_dest_set (GTK_WIDGET (icon_view), 0, formats, actions); icon_view->priv->dest_actions = actions; @@ -6895,7 +6895,7 @@ gtk_icon_view_get_reorderable (GtkIconView *icon_view) return icon_view->priv->reorderable; } -static const char *item_targets[] = { +static const char *item_formats[] = { "GTK_TREE_MODEL_ROW" }; @@ -6933,15 +6933,15 @@ gtk_icon_view_set_reorderable (GtkIconView *icon_view, if (reorderable) { - GtkTargetList *targets = gtk_target_list_new (item_targets, G_N_ELEMENTS (item_targets)); + GdkContentFormats *formats = gdk_content_formats_new (item_formats, G_N_ELEMENTS (item_formats)); gtk_icon_view_enable_model_drag_source (icon_view, GDK_BUTTON1_MASK, - targets, + formats, GDK_ACTION_MOVE); gtk_icon_view_enable_model_drag_dest (icon_view, - targets, + formats, GDK_ACTION_MOVE); - gtk_target_list_unref (targets); + gdk_content_formats_unref (formats); } else { diff --git a/gtk/gtkiconview.h b/gtk/gtkiconview.h index fc402c285f..fb5ae6648b 100644 --- a/gtk/gtkiconview.h +++ b/gtk/gtkiconview.h @@ -253,11 +253,11 @@ void gtk_icon_view_scroll_to_path (GtkIconView *icon_ GDK_AVAILABLE_IN_ALL void gtk_icon_view_enable_model_drag_source (GtkIconView *icon_view, GdkModifierType start_button_mask, - GtkTargetList *targets, + GdkContentFormats *formats, GdkDragAction actions); GDK_AVAILABLE_IN_ALL void gtk_icon_view_enable_model_drag_dest (GtkIconView *icon_view, - GtkTargetList *targets, + GdkContentFormats *formats, GdkDragAction actions); GDK_AVAILABLE_IN_ALL void gtk_icon_view_unset_model_drag_source (GtkIconView *icon_view); diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index ea73ded7f2..af3a08b2a9 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -4774,11 +4774,11 @@ gtk_label_drag_gesture_update (GtkGestureDrag *gesture, info->drag_start_y, x, y)) { - GtkTargetList *target_list = gtk_target_list_new (NULL, 0); + GdkContentFormats *target_list = gdk_content_formats_new (NULL, 0); const GdkEvent *event; event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence); - gtk_target_list_add_text_targets (target_list); + gtk_content_formats_add_text_targets (target_list); g_signal_connect (widget, "drag-begin", G_CALLBACK (drag_begin_cb), NULL); @@ -4790,7 +4790,7 @@ gtk_label_drag_gesture_update (GtkGestureDrag *gesture, info->in_drag = FALSE; - gtk_target_list_unref (target_list); + gdk_content_formats_unref (target_list); } } else @@ -5226,10 +5226,10 @@ gtk_label_select_region_index (GtkLabel *label, if (anchor_index != end_index) { - GtkTargetList *list; + GdkContentFormats *list; - list = gtk_target_list_new (NULL, 0); - gtk_target_list_add_text_targets (list); + list = gdk_content_formats_new (NULL, 0); + gtk_content_formats_add_text_targets (list); if (clipboard) gtk_clipboard_set_with_owner (clipboard, @@ -5238,7 +5238,7 @@ gtk_label_select_region_index (GtkLabel *label, clear_text_callback, G_OBJECT (label)); - gtk_target_list_unref (list); + gdk_content_formats_unref (list); if (!priv->select_info->selection_node) { diff --git a/gtk/gtklinkbutton.c b/gtk/gtklinkbutton.c index ee52cb1d88..d4cb05ab89 100644 --- a/gtk/gtklinkbutton.c +++ b/gtk/gtklinkbutton.c @@ -217,7 +217,7 @@ gtk_link_button_init (GtkLinkButton *link_button) { GtkLinkButtonPrivate *priv = gtk_link_button_get_instance_private (link_button); GtkStyleContext *context; - GtkTargetList *targets; + GdkContentFormats *targets; link_button->priv = priv; @@ -232,12 +232,12 @@ gtk_link_button_init (GtkLinkButton *link_button) G_CALLBACK (gtk_link_button_query_tooltip_cb), NULL); /* enable drag source */ - targets = gtk_target_list_new (link_drop_types, G_N_ELEMENTS (link_drop_types)); + targets = gdk_content_formats_new (link_drop_types, G_N_ELEMENTS (link_drop_types)); gtk_drag_source_set (GTK_WIDGET (link_button), GDK_BUTTON1_MASK, targets, GDK_ACTION_COPY); - gtk_target_list_unref (targets); + gdk_content_formats_unref (targets); priv->click_gesture = gtk_gesture_multi_press_new (GTK_WIDGET (link_button)); gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (priv->click_gesture), FALSE); diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index 4adb599709..1901ed5727 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -169,7 +169,7 @@ struct _GtkNotebookPrivate GtkNotebookDragOperation operation; GtkNotebookPage *cur_page; GtkNotebookPage *detached_tab; - GtkTargetList *source_targets; + GdkContentFormats *source_targets; GtkWidget *action_widget[N_ACTION_WIDGETS]; GtkWidget *dnd_child; GtkWidget *menu; @@ -1048,7 +1048,7 @@ static void gtk_notebook_init (GtkNotebook *notebook) { GtkNotebookPrivate *priv; - GtkTargetList *targets; + GdkContentFormats *targets; gtk_widget_set_can_focus (GTK_WIDGET (notebook), TRUE); gtk_widget_set_has_window (GTK_WIDGET (notebook), FALSE); @@ -1075,7 +1075,7 @@ gtk_notebook_init (GtkNotebook *notebook) priv->pressed_button = 0; priv->dnd_timer = 0; priv->switch_tab_timer = 0; - priv->source_targets = gtk_target_list_new (src_notebook_targets, + priv->source_targets = gdk_content_formats_new (src_notebook_targets, G_N_ELEMENTS (src_notebook_targets)); priv->operation = DRAG_OPERATION_NONE; priv->detached_tab = NULL; @@ -1086,11 +1086,11 @@ gtk_notebook_init (GtkNotebook *notebook) else priv->tabs_reversed = FALSE; - targets = gtk_target_list_new (dst_notebook_targets, G_N_ELEMENTS (dst_notebook_targets)); + targets = gdk_content_formats_new (dst_notebook_targets, G_N_ELEMENTS (dst_notebook_targets)); gtk_drag_dest_set (GTK_WIDGET (notebook), 0, targets, GDK_ACTION_MOVE); - gtk_target_list_unref (targets); + gdk_content_formats_unref (targets); gtk_drag_dest_set_track_motion (GTK_WIDGET (notebook), TRUE); @@ -1591,7 +1591,7 @@ gtk_notebook_destroy (GtkWidget *widget) if (priv->source_targets) { - gtk_target_list_unref (priv->source_targets); + gdk_content_formats_unref (priv->source_targets); priv->source_targets = NULL; } diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c index c37f870fb5..2faf2f000f 100644 --- a/gtk/gtkplacessidebar.c +++ b/gtk/gtkplacessidebar.c @@ -151,7 +151,7 @@ struct _GtkPlacesSidebar { GList *drag_list; /* list of GFile */ gint drag_data_info; gboolean dragging_over; - GtkTargetList *source_targets; + GdkContentFormats *source_targets; GtkWidget *drag_row; gint drag_row_height; gint drag_row_x; @@ -4020,7 +4020,7 @@ shell_shows_desktop_changed (GtkSettings *settings, static void gtk_places_sidebar_init (GtkPlacesSidebar *sidebar) { - GtkTargetList *target_list; + GdkContentFormats *target_list; gboolean show_desktop; GtkStyleContext *context; @@ -4073,12 +4073,12 @@ gtk_places_sidebar_init (GtkPlacesSidebar *sidebar) 0, NULL, GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_LINK); - target_list = gtk_target_list_new (dnd_drop_targets, G_N_ELEMENTS (dnd_drop_targets)); - gtk_target_list_add_uri_targets (target_list); + target_list = gdk_content_formats_new (dnd_drop_targets, G_N_ELEMENTS (dnd_drop_targets)); + gtk_content_formats_add_uri_targets (target_list); gtk_drag_dest_set_target_list (sidebar->list_box, target_list); - gtk_target_list_unref (target_list); - sidebar->source_targets = gtk_target_list_new (dnd_source_targets, G_N_ELEMENTS (dnd_source_targets)); - gtk_target_list_add_text_targets (sidebar->source_targets); + gdk_content_formats_unref (target_list); + sidebar->source_targets = gdk_content_formats_new (dnd_source_targets, G_N_ELEMENTS (dnd_source_targets)); + gtk_content_formats_add_text_targets (sidebar->source_targets); g_signal_connect (sidebar->list_box, "motion-notify-event", G_CALLBACK (on_motion_notify_event), sidebar); @@ -4339,7 +4339,7 @@ gtk_places_sidebar_dispose (GObject *object) if (sidebar->source_targets) { - gtk_target_list_unref (sidebar->source_targets); + gdk_content_formats_unref (sidebar->source_targets); sidebar->source_targets = NULL; } diff --git a/gtk/gtkselection.c b/gtk/gtkselection.c index 8f107cc6c0..159c4dc214 100644 --- a/gtk/gtkselection.c +++ b/gtk/gtkselection.c @@ -68,7 +68,7 @@ * * Some of the datatypes defined this section are used in * the #GtkClipboard and drag-and-drop API’s as well. The - * #GtkTargetList object represents + * #GdkContentFormats object represents * lists of data types that are supported when sending or * receiving data. The #GtkSelectionData object is used to * store a chunk of data along with the data type and other @@ -90,6 +90,8 @@ #include "gtkintl.h" #include "gdk-pixbuf/gdk-pixbuf.h" +#include "gdk/gdkcontentformatsprivate.h" + #ifdef GDK_WINDOWING_X11 #include "x11/gdkx.h" #endif @@ -249,8 +251,8 @@ init_atoms (void) } /** - * gtk_target_list_add_text_targets: - * @list: a #GtkTargetList + * gtk_content_formats_add_text_targets: + * @list: a #GdkContentFormats * * Appends the text targets supported by #GtkSelectionData to * the target list. All targets are added with the same @info. @@ -258,7 +260,7 @@ init_atoms (void) * Since: 2.6 **/ void -gtk_target_list_add_text_targets (GtkTargetList *list) +gtk_content_formats_add_text_targets (GdkContentFormats *list) { g_return_if_fail (list != NULL); @@ -266,19 +268,19 @@ gtk_target_list_add_text_targets (GtkTargetList *list) /* Keep in sync with gtk_selection_data_targets_include_text() */ - gtk_target_list_add (list, utf8_atom); - gtk_target_list_add (list, ctext_atom); - gtk_target_list_add (list, text_atom); - gtk_target_list_add (list, GDK_TARGET_STRING); - gtk_target_list_add (list, text_plain_utf8_atom); + gdk_content_formats_add (list, utf8_atom); + gdk_content_formats_add (list, ctext_atom); + gdk_content_formats_add (list, text_atom); + gdk_content_formats_add (list, GDK_TARGET_STRING); + gdk_content_formats_add (list, text_plain_utf8_atom); if (!g_get_charset (NULL)) - gtk_target_list_add (list, text_plain_locale_atom); - gtk_target_list_add (list, text_plain_atom); + gdk_content_formats_add (list, text_plain_locale_atom); + gdk_content_formats_add (list, text_plain_atom); } /** - * gtk_target_list_add_rich_text_targets: - * @list: a #GtkTargetList + * gtk_content_formats_add_rich_text_targets: + * @list: a #GdkContentFormats * @deserializable: if %TRUE, then deserializable rich text formats * will be added, serializable formats otherwise. * @buffer: a #GtkTextBuffer. @@ -291,9 +293,9 @@ gtk_target_list_add_text_targets (GtkTargetList *list) * Since: 2.10 **/ void -gtk_target_list_add_rich_text_targets (GtkTargetList *list, - gboolean deserializable, - GtkTextBuffer *buffer) +gtk_content_formats_add_rich_text_targets (GdkContentFormats *list, + gboolean deserializable, + GtkTextBuffer *buffer) { GdkAtom *atoms; gint n_atoms; @@ -308,14 +310,14 @@ gtk_target_list_add_rich_text_targets (GtkTargetList *list, atoms = gtk_text_buffer_get_serialize_formats (buffer, &n_atoms); for (i = 0; i < n_atoms; i++) - gtk_target_list_add (list, atoms[i]); + gdk_content_formats_add (list, atoms[i]); g_free (atoms); } /** - * gtk_target_list_add_image_targets: - * @list: a #GtkTargetList + * gtk_content_formats_add_image_targets: + * @list: a #GdkContentFormats * @writable: whether to add only targets for which GTK+ knows * how to convert a pixbuf into the format * @@ -325,8 +327,8 @@ gtk_target_list_add_rich_text_targets (GtkTargetList *list, * Since: 2.6 **/ void -gtk_target_list_add_image_targets (GtkTargetList *list, - gboolean writable) +gtk_content_formats_add_image_targets (GdkContentFormats *list, + gboolean writable) { GSList *formats, *f; gchar **mimes, **m; @@ -365,7 +367,7 @@ gtk_target_list_add_image_targets (GtkTargetList *list, mimes = gdk_pixbuf_format_get_mime_types (fmt); for (m = mimes; *m; m++) { - gtk_target_list_add (list, *m); + gdk_content_formats_add (list, *m); } g_strfreev (mimes); } @@ -374,8 +376,8 @@ gtk_target_list_add_image_targets (GtkTargetList *list, } /** - * gtk_target_list_add_uri_targets: - * @list: a #GtkTargetList + * gtk_content_formats_add_uri_targets: + * @list: a #GdkContentFormats * @info: an ID that will be passed back to the application * * Appends the URI targets supported by #GtkSelectionData to @@ -384,13 +386,13 @@ gtk_target_list_add_image_targets (GtkTargetList *list, * Since: 2.6 **/ void -gtk_target_list_add_uri_targets (GtkTargetList *list) +gtk_content_formats_add_uri_targets (GdkContentFormats *list) { g_return_if_fail (list != NULL); init_atoms (); - gtk_target_list_add (list, text_uri_list_atom); + gdk_content_formats_add (list, text_uri_list_atom); } /** @@ -532,10 +534,10 @@ typedef struct _GtkSelectionTargetList GtkSelectionTargetList; struct _GtkSelectionTargetList { GdkAtom selection; - GtkTargetList *list; + GdkContentFormats *list; }; -static GtkTargetList * +static GdkContentFormats * gtk_selection_target_list_get (GtkWidget *widget, GdkAtom selection) { @@ -556,7 +558,7 @@ gtk_selection_target_list_get (GtkWidget *widget, sellist = g_slice_new (GtkSelectionTargetList); sellist->selection = selection; - sellist->list = gtk_target_list_new (NULL, 0); + sellist->list = gdk_content_formats_new (NULL, 0); lists = g_list_prepend (lists, sellist); g_object_set_data (G_OBJECT (widget), I_(gtk_selection_handler_key), lists); @@ -578,7 +580,7 @@ gtk_selection_target_list_remove (GtkWidget *widget) { sellist = tmp_list->data; - gtk_target_list_unref (sellist->list); + gdk_content_formats_unref (sellist->list); g_slice_free (GtkSelectionTargetList, sellist); tmp_list = tmp_list->next; @@ -618,7 +620,7 @@ gtk_selection_clear_targets (GtkWidget *widget, if (sellist->selection == selection) { lists = g_list_delete_link (lists, tmp_list); - gtk_target_list_unref (sellist->list); + gdk_content_formats_unref (sellist->list); g_slice_free (GtkSelectionTargetList, sellist); break; @@ -644,13 +646,13 @@ gtk_selection_add_target (GtkWidget *widget, GdkAtom selection, GdkAtom target) { - GtkTargetList *list; + GdkContentFormats *list; g_return_if_fail (GTK_IS_WIDGET (widget)); g_return_if_fail (selection != NULL); list = gtk_selection_target_list_get (widget, selection); - gtk_target_list_add (list, target); + gdk_content_formats_add (list, target); gdk_selection_add_targets (gtk_widget_get_window (widget), selection, &target, 1); } @@ -666,9 +668,9 @@ gtk_selection_add_target (GtkWidget *widget, void gtk_selection_add_targets (GtkWidget *widget, GdkAtom selection, - GtkTargetList *targets) + GdkContentFormats *targets) { - GtkTargetList *list; + GdkContentFormats *list; GdkAtom *atoms; guint n_targets; @@ -677,9 +679,9 @@ gtk_selection_add_targets (GtkWidget *widget, g_return_if_fail (targets != NULL); list = gtk_selection_target_list_get (widget, selection); - gtk_target_list_merge (list, targets); + gdk_content_formats_union (list, targets); - atoms = gtk_target_list_get_atoms (targets, &n_targets); + atoms = gdk_content_formats_get_atoms (targets, &n_targets); gdk_selection_add_targets (gtk_widget_get_window (widget), selection, atoms, n_targets); g_free (atoms); } @@ -1697,7 +1699,7 @@ gtk_targets_include_text (GdkAtom *targets, g_return_val_if_fail (targets != NULL || n_targets == 0, FALSE); - /* Keep in sync with gtk_target_list_add_text_targets() + /* Keep in sync with gdk_content_formats_add_text_targets() */ init_atoms (); @@ -1858,23 +1860,23 @@ gtk_targets_include_image (GdkAtom *targets, gint n_targets, gboolean writable) { - GtkTargetList *list; + GdkContentFormats *list; gint i; gboolean result = FALSE; g_return_val_if_fail (targets != NULL || n_targets == 0, FALSE); - list = gtk_target_list_new (NULL, 0); - gtk_target_list_add_image_targets (list, writable); + list = gdk_content_formats_new (NULL, 0); + gtk_content_formats_add_image_targets (list, writable); for (i = 0; i < n_targets && !result; i++) { - if (gtk_target_list_find (list, targets[i])) + if (gdk_content_formats_contains (list, targets[i])) { result = TRUE; break; } } - gtk_target_list_unref (list); + gdk_content_formats_unref (list); return result; } @@ -1937,7 +1939,7 @@ gtk_targets_include_uri (GdkAtom *targets, g_return_val_if_fail (targets != NULL || n_targets == 0, FALSE); - /* Keep in sync with gtk_target_list_add_uri_targets() + /* Keep in sync with gdk_content_formats_add_uri_targets() */ init_atoms (); @@ -2837,14 +2839,14 @@ gtk_selection_invoke_handler (GtkWidget *widget, GtkSelectionData *data, guint time) { - GtkTargetList *target_list; + GdkContentFormats *target_list; g_return_if_fail (widget != NULL); target_list = gtk_selection_target_list_get (widget, data->selection); if (data->target != gtk_selection_atoms[SAVE_TARGETS] && target_list && - gtk_target_list_find (target_list, data->target)) + gdk_content_formats_contains (target_list, data->target)) { g_signal_emit_by_name (widget, "selection-get", @@ -2905,11 +2907,11 @@ gtk_selection_default_handler (GtkWidget *widget, /* List of all targets supported for this widget/selection pair */ GdkAtom *p, *atoms; guint count, i; - GtkTargetList *target_list; + GdkContentFormats *target_list; target_list = gtk_selection_target_list_get (widget, data->selection); - atoms = gtk_target_list_get_atoms (target_list, &count); + atoms = gdk_content_formats_get_atoms (target_list, &count); data->type = GDK_SELECTION_TYPE_ATOM; data->format = 32; @@ -2991,10 +2993,6 @@ G_DEFINE_BOXED_TYPE (GtkSelectionData, gtk_selection_data, gtk_selection_data_copy, gtk_selection_data_free) -G_DEFINE_BOXED_TYPE (GtkTargetList, gtk_target_list, - gtk_target_list_ref, - gtk_target_list_unref) - static int gtk_selection_bytes_per_item (gint format) { diff --git a/gtk/gtkselection.h b/gtk/gtkselection.h index bc93e9c250..3d24f0105c 100644 --- a/gtk/gtkselection.h +++ b/gtk/gtkselection.h @@ -37,16 +37,16 @@ G_BEGIN_DECLS #define GTK_TYPE_SELECTION_DATA (gtk_selection_data_get_type ()) GDK_AVAILABLE_IN_ALL -void gtk_target_list_add_text_targets (GtkTargetList *list); +void gtk_content_formats_add_text_targets (GdkContentFormats *list); GDK_AVAILABLE_IN_ALL -void gtk_target_list_add_rich_text_targets (GtkTargetList *list, - gboolean deserializable, - GtkTextBuffer *buffer); +void gtk_content_formats_add_rich_text_targets (GdkContentFormats *list, + gboolean deserializable, + GtkTextBuffer *buffer); GDK_AVAILABLE_IN_ALL -void gtk_target_list_add_image_targets (GtkTargetList *list, - gboolean writable); +void gtk_content_formats_add_image_targets (GdkContentFormats *list, + gboolean writable); GDK_AVAILABLE_IN_ALL -void gtk_target_list_add_uri_targets (GtkTargetList *list); +void gtk_content_formats_add_uri_targets (GdkContentFormats *list); GDK_AVAILABLE_IN_ALL gboolean gtk_selection_owner_set (GtkWidget *widget, @@ -65,7 +65,7 @@ void gtk_selection_add_target (GtkWidget *widget, GDK_AVAILABLE_IN_ALL void gtk_selection_add_targets (GtkWidget *widget, GdkAtom selection, - GtkTargetList *targets); + GdkContentFormats *targets); GDK_AVAILABLE_IN_ALL void gtk_selection_clear_targets (GtkWidget *widget, GdkAtom selection); diff --git a/gtk/gtkselectionprivate.h b/gtk/gtkselectionprivate.h index 9ada28f997..72f748c097 100644 --- a/gtk/gtkselectionprivate.h +++ b/gtk/gtkselectionprivate.h @@ -47,9 +47,6 @@ struct _GtkSelectionData GdkDisplay *display; }; -GdkAtom *gtk_target_list_get_atoms (GtkTargetList *targets, - guint *n_atoms); - gboolean _gtk_selection_clear (GtkWidget *widget, GdkEventSelection *event); gboolean _gtk_selection_request (GtkWidget *widget, diff --git a/gtk/gtktextbuffer.c b/gtk/gtktextbuffer.c index c141c595a3..67d7c0e053 100644 --- a/gtk/gtktextbuffer.c +++ b/gtk/gtktextbuffer.c @@ -56,8 +56,8 @@ typedef struct _GtkTextLogAttrCache GtkTextLogAttrCache; struct _GtkTextBufferPrivate { - GtkTargetList *copy_target_list; - GtkTargetList *paste_target_list; + GdkContentFormats *copy_target_list; + GdkContentFormats *paste_target_list; GtkTextTagTable *tag_table; GtkTextBTree *btree; @@ -257,7 +257,7 @@ gtk_text_buffer_class_init (GtkTextBufferClass *klass) g_param_spec_boxed ("copy-target-list", P_("Copy target list"), P_("The list of targets this buffer supports for clipboard copying and DND source"), - GTK_TYPE_TARGET_LIST, + GDK_TYPE_CONTENT_FORMATS, GTK_PARAM_READABLE); /** @@ -272,7 +272,7 @@ gtk_text_buffer_class_init (GtkTextBufferClass *klass) g_param_spec_boxed ("paste-target-list", P_("Paste target list"), P_("The list of targets this buffer supports for clipboard pasting and DND destination"), - GTK_TYPE_TARGET_LIST, + GDK_TYPE_CONTENT_FORMATS, GTK_PARAM_READABLE); g_object_class_install_properties (object_class, LAST_PROP, text_buffer_props); @@ -3996,28 +3996,28 @@ gtk_text_buffer_free_target_lists (GtkTextBuffer *buffer) { GtkTextBufferPrivate *priv = buffer->priv; - g_clear_pointer (&priv->copy_target_list, gtk_target_list_unref); - g_clear_pointer (&priv->paste_target_list, gtk_target_list_unref); + g_clear_pointer (&priv->copy_target_list, gdk_content_formats_unref); + g_clear_pointer (&priv->paste_target_list, gdk_content_formats_unref); } -static GtkTargetList * +static GdkContentFormats * gtk_text_buffer_get_target_list (GtkTextBuffer *buffer, gboolean deserializable, gboolean include_local) { - GtkTargetList *target_list; + GdkContentFormats *target_list; - target_list = gtk_target_list_new (NULL, 0); + target_list = gdk_content_formats_new (NULL, 0); if (include_local) - gtk_target_list_add (target_list, + gdk_content_formats_add (target_list, gdk_atom_intern_static_string ("GTK_TEXT_BUFFER_CONTENTS")); - gtk_target_list_add_rich_text_targets (target_list, - deserializable, - buffer); + gtk_content_formats_add_rich_text_targets (target_list, + deserializable, + buffer); - gtk_target_list_add_text_targets (target_list); + gtk_content_formats_add_text_targets (target_list); return target_list; } @@ -4080,11 +4080,11 @@ cut_or_copy (GtkTextBuffer *buffer, } else { - GtkTargetList *list; + GdkContentFormats *list; list = gtk_text_buffer_get_target_list (buffer, FALSE, FALSE); gtk_clipboard_set_can_store (clipboard, list); - gtk_target_list_unref (list); + gdk_content_formats_unref (list); } if (delete_region_after) @@ -4221,14 +4221,14 @@ gtk_text_buffer_end_user_action (GtkTextBuffer *buffer) * This function returns the list of targets this text buffer can * provide for copying and as DND source. The targets in the list are * added with @info values from the #GtkTextBufferTargetInfo enum, - * using gtk_target_list_add_rich_text_targets() and - * gtk_target_list_add_text_targets(). + * using gdk_content_formats_add_rich_text_targets() and + * gdk_content_formats_add_text_targets(). * - * Returns: (transfer none): the #GtkTargetList + * Returns: (transfer none): the #GdkContentFormats * * Since: 2.10 **/ -GtkTargetList * +GdkContentFormats * gtk_text_buffer_get_copy_target_list (GtkTextBuffer *buffer) { GtkTextBufferPrivate *priv; @@ -4251,14 +4251,14 @@ gtk_text_buffer_get_copy_target_list (GtkTextBuffer *buffer) * This function returns the list of targets this text buffer supports * for pasting and as DND destination. The targets in the list are * added with @info values from the #GtkTextBufferTargetInfo enum, - * using gtk_target_list_add_rich_text_targets() and - * gtk_target_list_add_text_targets(). + * using gtk_content_formats_add_rich_text_targets() and + * gtk_content_formats_add_text_targets(). * - * Returns: (transfer none): the #GtkTargetList + * Returns: (transfer none): the #GdkContentFormats * * Since: 2.10 **/ -GtkTargetList * +GdkContentFormats * gtk_text_buffer_get_paste_target_list (GtkTextBuffer *buffer) { GtkTextBufferPrivate *priv; diff --git a/gtk/gtktextbuffer.h b/gtk/gtktextbuffer.h index 3183d3c391..eab07b5fc4 100644 --- a/gtk/gtktextbuffer.h +++ b/gtk/gtktextbuffer.h @@ -464,9 +464,9 @@ GDK_AVAILABLE_IN_ALL void gtk_text_buffer_end_user_action (GtkTextBuffer *buffer); GDK_AVAILABLE_IN_ALL -GtkTargetList * gtk_text_buffer_get_copy_target_list (GtkTextBuffer *buffer); +GdkContentFormats * gtk_text_buffer_get_copy_target_list (GtkTextBuffer *buffer); GDK_AVAILABLE_IN_ALL -GtkTargetList * gtk_text_buffer_get_paste_target_list (GtkTextBuffer *buffer); +GdkContentFormats * gtk_text_buffer_get_paste_target_list (GtkTextBuffer *buffer); G_END_DECLS diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 6e625b63d0..e6c5df7b44 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -1630,7 +1630,7 @@ static void gtk_text_view_init (GtkTextView *text_view) { GtkWidget *widget = GTK_WIDGET (text_view); - GtkTargetList *target_list; + GdkContentFormats *target_list; GtkTextViewPrivate *priv; GtkStyleContext *context; @@ -1660,9 +1660,9 @@ gtk_text_view_init (GtkTextView *text_view) gtk_drag_dest_set (widget, 0, NULL, GDK_ACTION_COPY | GDK_ACTION_MOVE); - target_list = gtk_target_list_new (NULL, 0); + target_list = gdk_content_formats_new (NULL, 0); gtk_drag_dest_set_target_list (widget, target_list); - gtk_target_list_unref (target_list); + gdk_content_formats_unref (target_list); priv->virtual_cursor_x = -1; priv->virtual_cursor_y = -1; @@ -7806,7 +7806,7 @@ gtk_text_view_start_selection_dnd (GtkTextView *text_view, gint x, gint y) { - GtkTargetList *target_list; + GdkContentFormats *target_list; target_list = gtk_text_buffer_get_copy_target_list (get_buffer (text_view)); diff --git a/gtk/gtktoolpalette.c b/gtk/gtktoolpalette.c index d5427b9025..242397e546 100644 --- a/gtk/gtktoolpalette.c +++ b/gtk/gtktoolpalette.c @@ -1458,7 +1458,7 @@ gtk_tool_palette_add_drag_dest (GtkToolPalette *palette, { const char *entries[G_N_ELEMENTS (dnd_targets)]; gint n_entries = 0; - GtkTargetList *list; + GdkContentFormats *list; g_return_if_fail (GTK_IS_TOOL_PALETTE (palette)); g_return_if_fail (GTK_IS_WIDGET (widget)); @@ -1471,9 +1471,9 @@ gtk_tool_palette_add_drag_dest (GtkToolPalette *palette, if (targets & GTK_TOOL_PALETTE_DRAG_GROUPS) entries[n_entries++] = dnd_targets[1]; - list = gtk_target_list_new (entries, n_entries); + list = gdk_content_formats_new (entries, n_entries); gtk_drag_dest_set (widget, flags, list, actions); - gtk_target_list_unref (list); + gdk_content_formats_unref (list); } void @@ -1571,7 +1571,7 @@ _gtk_tool_palette_child_set_drag_source (GtkWidget *child, if (GTK_IS_TOOL_ITEM (child) && (palette->priv->drag_source & GTK_TOOL_PALETTE_DRAG_ITEMS)) { - GtkTargetList *targets; + GdkContentFormats *targets; /* Connect to child instead of the item itself, * to work arround bug 510377. @@ -1582,10 +1582,10 @@ _gtk_tool_palette_child_set_drag_source (GtkWidget *child, if (!child) return; - targets = gtk_target_list_new (&dnd_targets[0], 1); + targets = gdk_content_formats_new (&dnd_targets[0], 1); gtk_drag_source_set (child, GDK_BUTTON1_MASK | GDK_BUTTON3_MASK, targets, GDK_ACTION_COPY | GDK_ACTION_MOVE); - gtk_target_list_unref (targets); + gdk_content_formats_unref (targets); g_signal_connect (child, "drag-data-get", G_CALLBACK (gtk_tool_palette_item_drag_data_get), @@ -1594,12 +1594,12 @@ _gtk_tool_palette_child_set_drag_source (GtkWidget *child, else if (GTK_IS_BUTTON (child) && (palette->priv->drag_source & GTK_TOOL_PALETTE_DRAG_GROUPS)) { - GtkTargetList *targets; + GdkContentFormats *targets; - targets = gtk_target_list_new (&dnd_targets[1], 1); + targets = gdk_content_formats_new (&dnd_targets[1], 1); gtk_drag_source_set (child, GDK_BUTTON1_MASK | GDK_BUTTON3_MASK, targets, GDK_ACTION_COPY | GDK_ACTION_MOVE); - gtk_target_list_unref (targets); + gdk_content_formats_unref (targets); g_signal_connect (child, "drag-data-get", G_CALLBACK (gtk_tool_palette_child_drag_data_get), diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 1606abe5f0..31da0d890a 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -292,11 +292,8 @@ typedef struct _TreeViewDragInfo TreeViewDragInfo; struct _TreeViewDragInfo { GdkModifierType start_button_mask; - GtkTargetList *_unused_source_target_list; GdkDragAction source_actions; - GtkTargetList *_unused_dest_target_list; - guint source_set : 1; guint dest_set : 1; }; @@ -12545,17 +12542,18 @@ gtk_tree_view_set_reorderable (GtkTreeView *tree_view, const char *row_targets[] = { "GTK_TREE_MODEL_ROW" }; - GtkTargetList *targets; + GdkContentFormats *formats; - targets = gtk_target_list_new (row_targets, G_N_ELEMENTS (row_targets)); + formats = gdk_content_formats_new (row_targets, G_N_ELEMENTS (row_targets)); gtk_tree_view_enable_model_drag_source (tree_view, GDK_BUTTON1_MASK, - targets, + formats, GDK_ACTION_MOVE); gtk_tree_view_enable_model_drag_dest (tree_view, - targets, + formats, GDK_ACTION_MOVE); + gdk_content_formats_unref (formats); } else { @@ -13531,7 +13529,7 @@ unset_reorderable (GtkTreeView *tree_view) * gtk_tree_view_enable_model_drag_source: * @tree_view: a #GtkTreeView * @start_button_mask: Mask of allowed buttons to start drag - * @targets: the targets that the drag will support + * @formats: the target formats that the drag will support * @actions: the bitmask of possible actions for a drag from this * widget * @@ -13539,10 +13537,10 @@ unset_reorderable (GtkTreeView *tree_view) * method sets #GtkTreeView:reorderable to %FALSE. **/ void -gtk_tree_view_enable_model_drag_source (GtkTreeView *tree_view, - GdkModifierType start_button_mask, - GtkTargetList *targets, - GdkDragAction actions) +gtk_tree_view_enable_model_drag_source (GtkTreeView *tree_view, + GdkModifierType start_button_mask, + GdkContentFormats *formats, + GdkDragAction actions) { TreeViewDragInfo *di; @@ -13550,7 +13548,7 @@ gtk_tree_view_enable_model_drag_source (GtkTreeView *tree_view, gtk_drag_source_set (GTK_WIDGET (tree_view), 0, - targets, + formats, actions); di = ensure_info (tree_view); @@ -13565,8 +13563,7 @@ gtk_tree_view_enable_model_drag_source (GtkTreeView *tree_view, /** * gtk_tree_view_enable_model_drag_dest: * @tree_view: a #GtkTreeView - * @targets: the targets that the drag will support - * @n_targets: the number of items in @targets + * @formats: the target formats that the drag will support * @actions: the bitmask of possible actions for a drag from this * widget * @@ -13574,9 +13571,9 @@ gtk_tree_view_enable_model_drag_source (GtkTreeView *tree_view, * this method sets #GtkTreeView:reorderable to %FALSE. **/ void -gtk_tree_view_enable_model_drag_dest (GtkTreeView *tree_view, - GtkTargetList *targets, - GdkDragAction actions) +gtk_tree_view_enable_model_drag_dest (GtkTreeView *tree_view, + GdkContentFormats *formats, + GdkDragAction actions) { TreeViewDragInfo *di; @@ -13584,7 +13581,7 @@ gtk_tree_view_enable_model_drag_dest (GtkTreeView *tree_view, gtk_drag_dest_set (GTK_WIDGET (tree_view), 0, - targets, + formats, actions); di = ensure_info (tree_view); diff --git a/gtk/gtktreeview.h b/gtk/gtktreeview.h index 147e568753..c4c0879a77 100644 --- a/gtk/gtktreeview.h +++ b/gtk/gtktreeview.h @@ -382,11 +382,11 @@ gboolean gtk_tree_view_is_blank_at_pos (GtkTreeView GDK_AVAILABLE_IN_ALL void gtk_tree_view_enable_model_drag_source (GtkTreeView *tree_view, GdkModifierType start_button_mask, - GtkTargetList *targets, + GdkContentFormats *formats, GdkDragAction actions); GDK_AVAILABLE_IN_ALL void gtk_tree_view_enable_model_drag_dest (GtkTreeView *tree_view, - GtkTargetList *targets, + GdkContentFormats *formats, GdkDragAction actions); GDK_AVAILABLE_IN_ALL void gtk_tree_view_unset_rows_drag_source (GtkTreeView *tree_view); diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 5021607c89..9144ce6f0a 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -1844,7 +1844,7 @@ gtk_window_init (GtkWindow *window) GtkWidget *widget; GtkCssNode *widget_node; GdkSeat *seat; - GtkTargetList *targets; + GdkContentFormats *targets; widget = GTK_WIDGET (window); @@ -1906,12 +1906,12 @@ gtk_window_init (GtkWindow *window) priv->scale = gtk_widget_get_scale_factor (widget); - targets = gtk_target_list_new (dnd_dest_targets, G_N_ELEMENTS (dnd_dest_targets)); + targets = gdk_content_formats_new (dnd_dest_targets, G_N_ELEMENTS (dnd_dest_targets)); gtk_drag_dest_set (GTK_WIDGET (window), GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP, targets, GDK_ACTION_MOVE); - gtk_target_list_unref (targets); + gdk_content_formats_unref (targets); seat = gdk_display_get_default_seat (gtk_widget_get_display (widget)); g_signal_connect (seat, "device-removed", |