[gtk/dnd-gestures-2: 145/175] Drop GTK content formats apis
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/dnd-gestures-2: 145/175] Drop GTK content formats apis
- Date: Wed, 8 Jan 2020 16:50:02 +0000 (UTC)
commit f589e33ad217fe1259db8acf1cb9f0aa404d6e82
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Jan 7 00:55:34 2020 -0500
Drop GTK content formats apis
These functions have been superseded by better
facilities in GDK.
gtk/gtkselection.c | 131 ++---------------------------------------------------
gtk/gtkselection.h | 7 ---
2 files changed, 5 insertions(+), 133 deletions(-)
---
diff --git a/gtk/gtkselection.c b/gtk/gtkselection.c
index dfa8511966..e5b520eba2 100644
--- a/gtk/gtkselection.c
+++ b/gtk/gtkselection.c
@@ -143,130 +143,6 @@ init_atoms (void)
}
}
-/**
- * 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.
- **/
-GdkContentFormats *
-gtk_content_formats_add_text_targets (GdkContentFormats *list)
-{
- GdkContentFormatsBuilder *builder;
-
- g_return_val_if_fail (list != NULL, NULL);
-
- init_atoms ();
-
- builder = gdk_content_formats_builder_new ();
- gdk_content_formats_builder_add_formats (builder, list);
- gdk_content_formats_unref (list);
-
- /* Keep in sync with gtk_selection_data_targets_include_text()
- */
- gdk_content_formats_builder_add_mime_type (builder, utf8_atom);
- gdk_content_formats_builder_add_mime_type (builder, ctext_atom);
- gdk_content_formats_builder_add_mime_type (builder, text_atom);
- gdk_content_formats_builder_add_mime_type (builder, g_intern_static_string ("STRING"));
- gdk_content_formats_builder_add_mime_type (builder, text_plain_utf8_atom);
- if (!g_get_charset (NULL))
- gdk_content_formats_builder_add_mime_type (builder, text_plain_locale_atom);
- gdk_content_formats_builder_add_mime_type (builder, text_plain_atom);
-
- return gdk_content_formats_builder_free_to_formats (builder);
-}
-
-/**
- * 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
- *
- * Appends the image targets supported by #GtkSelectionData to
- * the target list. All targets are added with the same @info.
- **/
-GdkContentFormats *
-gtk_content_formats_add_image_targets (GdkContentFormats *list,
- gboolean writable)
-{
- GdkContentFormatsBuilder *builder;
- GSList *formats, *f;
- gchar **mimes, **m;
-
- g_return_val_if_fail (list != NULL, NULL);
-
- builder = gdk_content_formats_builder_new ();
- gdk_content_formats_builder_add_formats (builder, list);
- gdk_content_formats_unref (list);
-
- formats = gdk_pixbuf_get_formats ();
-
- /* Make sure png comes first */
- for (f = formats; f; f = f->next)
- {
- GdkPixbufFormat *fmt = f->data;
- gchar *name;
-
- name = gdk_pixbuf_format_get_name (fmt);
- if (strcmp (name, "png") == 0)
- {
- formats = g_slist_delete_link (formats, f);
- formats = g_slist_prepend (formats, fmt);
-
- g_free (name);
-
- break;
- }
-
- g_free (name);
- }
-
- for (f = formats; f; f = f->next)
- {
- GdkPixbufFormat *fmt = f->data;
-
- if (writable && !gdk_pixbuf_format_is_writable (fmt))
- continue;
-
- mimes = gdk_pixbuf_format_get_mime_types (fmt);
- for (m = mimes; *m; m++)
- {
- gdk_content_formats_builder_add_mime_type (builder, *m);
- }
- g_strfreev (mimes);
- }
-
- g_slist_free (formats);
-
- return gdk_content_formats_builder_free_to_formats (builder);
-}
-
-/**
- * gtk_content_formats_add_uri_targets:
- * @list: a #GdkContentFormats
- *
- * Appends the URI targets supported by #GtkSelectionData to
- * the target list. All targets are added with the same @info.
- **/
-GdkContentFormats *
-gtk_content_formats_add_uri_targets (GdkContentFormats *list)
-{
- GdkContentFormatsBuilder *builder;
-
- g_return_val_if_fail (list != NULL, NULL);
-
- init_atoms ();
-
- builder = gdk_content_formats_builder_new ();
- gdk_content_formats_builder_add_formats (builder, list);
- gdk_content_formats_unref (list);
-
- gdk_content_formats_builder_add_mime_type (builder, text_uri_list_atom);
-
- return gdk_content_formats_builder_free_to_formats (builder);
-}
-
/**
* gtk_selection_data_get_target:
* @selection_data: a pointer to a #GtkSelectionData-struct.
@@ -1158,8 +1034,11 @@ gtk_targets_include_image (GdkAtom *targets,
g_return_val_if_fail (targets != NULL || n_targets == 0, FALSE);
- list = gdk_content_formats_new (NULL, 0);
- list = gtk_content_formats_add_image_targets (list, writable);
+ list = gdk_content_formats_new_for_gtype (GDK_TYPE_TEXTURE);
+ if (writable)
+ list = gdk_content_formats_union_serialize_mime_types (list);
+ else
+ list = gdk_content_formats_union_deserialize_mime_types (list);
for (i = 0; i < n_targets && !result; i++)
{
if (gdk_content_formats_contain_mime_type (list, targets[i]))
diff --git a/gtk/gtkselection.h b/gtk/gtkselection.h
index 2fc9026c6d..983a0b398d 100644
--- a/gtk/gtkselection.h
+++ b/gtk/gtkselection.h
@@ -36,13 +36,6 @@ G_BEGIN_DECLS
#define GTK_TYPE_SELECTION_DATA (gtk_selection_data_get_type ())
-GDK_AVAILABLE_IN_ALL
-GdkContentFormats * gtk_content_formats_add_text_targets (GdkContentFormats *list)
G_GNUC_WARN_UNUSED_RESULT;
-GDK_AVAILABLE_IN_ALL
-GdkContentFormats * gtk_content_formats_add_image_targets (GdkContentFormats *list,
- gboolean writable)
G_GNUC_WARN_UNUSED_RESULT;
-GDK_AVAILABLE_IN_ALL
-GdkContentFormats * gtk_content_formats_add_uri_targets (GdkContentFormats *list)
G_GNUC_WARN_UNUSED_RESULT;
GDK_AVAILABLE_IN_ALL
GdkAtom gtk_selection_data_get_target (const GtkSelectionData *selection_data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]