[gtk+] gdk: Move GtkTargetList to GDK
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gdk: Move GtkTargetList to GDK
- Date: Mon, 20 Nov 2017 22:24:03 +0000 (UTC)
commit 0638bbb5d58d783519fd07dc548996d405398f4f
Author: Benjamin Otte <otte redhat com>
Date: Fri Nov 17 17:31:59 2017 +0100
gdk: Move GtkTargetList to GDK
It's gonna be renamed next, so put it in the right source file already.
For now retain the old name to keep the diff small.
gdk/gdk-autocleanup.h | 1 +
gdk/gdk.h | 1 +
gdk/gdkcontentformats.c | 299 ++++++++++++++++++++++++++++++++++++++++
gdk/gdkcontentformats.h | 80 +++++++++++
gdk/gdkcontentformatsprivate.h | 33 +++++
gdk/meson.build | 2 +
gtk/gtk-autocleanups.h | 1 -
gtk/gtkselection.c | 226 +-----------------------------
gtk/gtkselection.h | 38 -----
9 files changed, 420 insertions(+), 261 deletions(-)
---
diff --git a/gdk/gdk-autocleanup.h b/gdk/gdk-autocleanup.h
index 4941827..76660c9 100644
--- a/gdk/gdk-autocleanup.h
+++ b/gdk/gdk-autocleanup.h
@@ -33,6 +33,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkGLContext, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkKeymap, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkWindow, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTargetList, gtk_target_list_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkEvent, gdk_event_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkFrameTimings, gdk_frame_timings_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkRGBA, gdk_rgba_free)
diff --git a/gdk/gdk.h b/gdk/gdk.h
index fc18b74..296720c 100644
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -31,6 +31,7 @@
#include <gdk/gdkversionmacros.h>
#include <gdk/gdkapplaunchcontext.h>
#include <gdk/gdkcairo.h>
+#include <gdk/gdkcontentformats.h>
#include <gdk/gdkcursor.h>
#include <gdk/gdkdevice.h>
#include <gdk/gdkdevicepad.h>
diff --git a/gdk/gdkcontentformats.c b/gdk/gdkcontentformats.c
new file mode 100644
index 0000000..00f87e4
--- /dev/null
+++ b/gdk/gdkcontentformats.c
@@ -0,0 +1,299 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* This file implements most of the work of the ICCCM selection protocol.
+ * The code was written after an intensive study of the equivalent part
+ * of John Ousterhout’s Tk toolkit, and does many things in much the
+ * same way.
+ *
+ * The one thing in the ICCCM that isn’t fully supported here (or in Tk)
+ * is side effects targets. For these to be handled properly, MULTIPLE
+ * targets need to be done in the order specified. This cannot be
+ * guaranteed with the way we do things, since if we are doing INCR
+ * transfers, the order will depend on the timing of the requestor.
+ *
+ * By Owen Taylor <owt1 cornell edu> 8/16/97
+ */
+
+/* Terminology note: when not otherwise specified, the term "incr" below
+ * refers to the _sending_ part of the INCR protocol. The receiving
+ * portion is referred to just as “retrieval”. (Terminology borrowed
+ * from Tk, because there is no good opposite to “retrieval” in English.
+ * “send” can’t be made into a noun gracefully and we’re already using
+ * “emission” for something else ....)
+ */
+
+/* The MOTIF entry widget seems to ask for the TARGETS target, then
+ (regardless of the reply) ask for the TEXT target. It's slightly
+ possible though that it somehow thinks we are responding negatively
+ to the TARGETS request, though I don't really think so ... */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+/**
+ * SECTION:gtkselection
+ * @Title: Selections
+ * @Short_description: Functions for handling inter-process communication
+ * via selections
+ * @See_also: #GtkWidget - Much of the operation of selections happens via
+ * signals for #GtkWidget. In particular, if you are using the functions
+ * in this section, you may need to pay attention to
+ * #GtkWidget::selection-get, #GtkWidget::selection-received and
+ * #GtkWidget::selection-clear-event signals
+ *
+ * The selection mechanism provides the basis for different types
+ * of communication between processes. In particular, drag and drop and
+ * #GtkClipboard work via selections. You will very seldom or
+ * never need to use most of the functions in this section directly;
+ * #GtkClipboard provides a nicer interface to the same functionality.
+ *
+ * Some of the datatypes defined this section are used in
+ * the #GtkClipboard and drag-and-drop API’s as well. The
+ * #GtkTargetList 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
+ * associated information.
+ */
+
+#include "config.h"
+
+#include "gdkcontentformats.h"
+#include "gdkcontentformatsprivate.h"
+
+#include "gdkproperty.h"
+
+struct _GtkTargetList
+{
+ /*< private >*/
+ GList *list;
+ guint ref_count;
+};
+
+
+/**
+ * gtk_target_list_new:
+ * @targets: (array length=ntargets) (allow-none): Pointer to an array
+ * of char *
+ * @ntargets: number of entries in @targets.
+ *
+ * Creates a new #GtkTargetList from an array of mime types.
+ *
+ * Returns: (transfer full): the new #GtkTargetList.
+ **/
+GtkTargetList *
+gtk_target_list_new (const char **targets,
+ guint ntargets)
+{
+ GtkTargetList *result = g_slice_new (GtkTargetList);
+ result->list = NULL;
+ result->ref_count = 1;
+
+ if (targets)
+ gtk_target_list_add_table (result, targets, ntargets);
+
+ return result;
+}
+
+/**
+ * gtk_target_list_ref:
+ * @list: a #GtkTargetList
+ *
+ * Increases the reference count of a #GtkTargetList by one.
+ *
+ * Returns: the passed in #GtkTargetList.
+ **/
+GtkTargetList *
+gtk_target_list_ref (GtkTargetList *list)
+{
+ g_return_val_if_fail (list != NULL, NULL);
+
+ list->ref_count++;
+
+ return list;
+}
+
+/**
+ * gtk_target_list_unref:
+ * @list: a #GtkTargetList
+ *
+ * Decreases the reference count of a #GtkTargetList by one.
+ * If the resulting reference count is zero, frees the list.
+ **/
+void
+gtk_target_list_unref (GtkTargetList *list)
+{
+ g_return_if_fail (list != NULL);
+ g_return_if_fail (list->ref_count > 0);
+
+ list->ref_count--;
+ if (list->ref_count > 0)
+ return;
+
+ g_list_free (list->list);
+ g_slice_free (GtkTargetList, list);
+}
+
+/**
+ * gtk_target_list_add:
+ * @list: a #GtkTargetList
+ * @target: the mime type of the target
+ *
+ * Appends another target to a #GtkTargetList.
+ **/
+void
+gtk_target_list_add (GtkTargetList *list,
+ const char *target)
+{
+ g_return_if_fail (list != NULL);
+
+ list->list = g_list_append (list->list, (gpointer) gdk_atom_intern (target, FALSE));
+}
+
+/**
+ * gtk_target_list_merge:
+ * @target: the #GtkTargetList to merge into
+ * @source: the #GtkTargeList to merge from
+ *
+ * Merges all targets from @source into @target.
+ */
+void
+gtk_target_list_merge (GtkTargetList *target,
+ const GtkTargetList *source)
+{
+ GList *l;
+
+ g_return_if_fail (target != NULL);
+ g_return_if_fail (source != NULL);
+
+ for (l = source->list; l; l = l->next)
+ {
+ target->list = g_list_prepend (target->list, l->data);
+ }
+}
+
+/**
+ * gtk_target_list_intersects:
+ * @first: the primary #GtkTargetList to intersect
+ * @second: the #GtkTargeList to intersect with
+ *
+ * Finds the first element from @first that is also contained
+ * in @second.
+ *
+ * Returns: The first matching #GdkAtom or %NULL if the lists
+ * do not intersect.
+ */
+GdkAtom
+gtk_target_list_intersects (const GtkTargetList *first,
+ const GtkTargetList *second)
+{
+ GList *l;
+
+ g_return_val_if_fail (first != NULL, NULL);
+ g_return_val_if_fail (second != NULL, NULL);
+
+ for (l = first->list; l; l = l->next)
+ {
+ if (g_list_find (second->list, l->data))
+ return l->data;
+ }
+
+ return NULL;
+}
+
+/**
+ * gtk_target_list_add_table:
+ * @list: a #GtkTargetList
+ * @targets: (array length=ntargets): the table of #GtkTargetEntry
+ * @ntargets: number of targets in the table
+ *
+ * Prepends a table of #GtkTargetEntry to a target list.
+ **/
+void
+gtk_target_list_add_table (GtkTargetList *list,
+ const char **targets,
+ guint ntargets)
+{
+ gint i;
+
+ for (i=ntargets-1; i >= 0; i--)
+ {
+ list->list = g_list_prepend (list->list, (gpointer) gdk_atom_intern (targets[i], FALSE));
+ }
+}
+
+/**
+ * gtk_target_list_remove:
+ * @list: a #GtkTargetList
+ * @target: the interned atom representing the target
+ *
+ * Removes a target from a target list.
+ **/
+void
+gtk_target_list_remove (GtkTargetList *list,
+ GdkAtom target)
+{
+ g_return_if_fail (list != NULL);
+
+ list->list = g_list_remove (list->list, (gpointer) target);
+}
+
+/**
+ * gtk_target_list_find:
+ * @list: a #GtkTargetList
+ * @target: a string representing the target to search for
+ *
+ * Looks up a given target in a #GtkTargetList.
+ *
+ * Returns: %TRUE if the target was found, otherwise %FALSE
+ **/
+gboolean
+gtk_target_list_find (GtkTargetList *list,
+ const char *target)
+{
+ g_return_val_if_fail (list != NULL, FALSE);
+ g_return_val_if_fail (target != NULL, FALSE);
+
+ return g_list_find (list->list, (gpointer) gdk_atom_intern (target, FALSE)) != NULL;
+}
+
+GdkAtom *
+gtk_target_list_get_atoms (GtkTargetList *list,
+ guint *n_atoms)
+{
+ GdkAtom *atoms;
+ GList *l;
+ guint i, n;
+
+ n = g_list_length (list->list);
+ atoms = g_new (GdkAtom, n);
+
+ i = 0;
+ for (l = list->list; l; l = l->next)
+ atoms[i++] = l->data;
+
+ if (n_atoms)
+ *n_atoms = n;
+
+ return atoms;
+}
+
diff --git a/gdk/gdkcontentformats.h b/gdk/gdkcontentformats.h
new file mode 100644
index 0000000..39c7240
--- /dev/null
+++ b/gdk/gdkcontentformats.h
@@ -0,0 +1,80 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __GTK_CONTENT_FORMATS_H__
+#define __GTK_CONTENT_FORMATS_H__
+
+#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
+#error "Only <gdk/gdk.h> can be included directly."
+#endif
+
+
+#include <gdk/gdkversionmacros.h>
+#include <gdk/gdktypes.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GtkTargetList:
+ *
+ * A #GtkTargetList-struct is a reference counted list
+ * of #GtkTargetPair and should be treated as
+ * opaque.
+ */
+typedef struct _GtkTargetList GtkTargetList;
+
+#define GTK_TYPE_TARGET_LIST (gtk_target_list_get_type ())
+
+GDK_AVAILABLE_IN_ALL
+GType gtk_target_list_get_type (void) G_GNUC_CONST;
+GDK_AVAILABLE_IN_ALL
+GtkTargetList *gtk_target_list_new (const char **targets,
+ guint ntargets);
+GDK_AVAILABLE_IN_ALL
+GtkTargetList *gtk_target_list_ref (GtkTargetList *list);
+GDK_AVAILABLE_IN_ALL
+void gtk_target_list_unref (GtkTargetList *list);
+GDK_AVAILABLE_IN_3_94
+void gtk_target_list_merge (GtkTargetList *target,
+ const GtkTargetList *source);
+GDK_AVAILABLE_IN_3_94
+GdkAtom gtk_target_list_intersects(const GtkTargetList *first,
+ const GtkTargetList *second);
+GDK_AVAILABLE_IN_ALL
+void gtk_target_list_add (GtkTargetList *list,
+ const char *target);
+GDK_AVAILABLE_IN_ALL
+void gtk_target_list_add_table (GtkTargetList *list,
+ const char **targets,
+ guint ntargets);
+GDK_AVAILABLE_IN_ALL
+void gtk_target_list_remove (GtkTargetList *list,
+ const char *target);
+GDK_AVAILABLE_IN_ALL
+gboolean gtk_target_list_find (GtkTargetList *list,
+ const char *target);
+
+G_END_DECLS
+
+#endif /* __GTK_CONTENT_FORMATS_H__ */
diff --git a/gdk/gdkcontentformatsprivate.h b/gdk/gdkcontentformatsprivate.h
new file mode 100644
index 0000000..b8f0a87
--- /dev/null
+++ b/gdk/gdkcontentformatsprivate.h
@@ -0,0 +1,33 @@
+/* GTK - The GIMP Toolkit
+ *
+ * Copyright (C) 2017 Benjamin Otte
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef __GTK_CONTENT_FORMATS_PRIVATE_H__
+#define __GTK_CONTENT_FORMATS_PRIVATE_H__
+
+#include "gdkcontentformats.h"
+
+G_BEGIN_DECLS
+
+GdkAtom *gtk_target_list_get_atoms (GtkTargetList *targets,
+ guint *n_atoms);
+
+
+G_END_DECLS
+
+#endif /* __GTK_CONTENT_FORMATS_PRIVATE_H__ */
diff --git a/gdk/meson.build b/gdk/meson.build
index 5b93ff8..9b34ee4 100644
--- a/gdk/meson.build
+++ b/gdk/meson.build
@@ -2,6 +2,7 @@ gdk_public_sources = files([
'gdk.c',
'gdkapplaunchcontext.c',
'gdkcairo.c',
+ 'gdkcontentformats.c',
'gdkcursor.c',
'gdkdevice.c',
'gdkdevicemanager.c',
@@ -41,6 +42,7 @@ gdk_public_headers = files([
'gdk.h',
'gdkapplaunchcontext.h',
'gdkcairo.h',
+ 'gdkcontentformats.h',
'gdkcursor.h',
'gdkdevice.h',
'gdkdevicemanager.h',
diff --git a/gtk/gtk-autocleanups.h b/gtk/gtk-autocleanups.h
index ecddaf9..75abbaa 100644
--- a/gtk/gtk-autocleanups.h
+++ b/gtk/gtk-autocleanups.h
@@ -189,7 +189,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkVolumeButton, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkPaperSize, gtk_paper_size_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkSelectionData, gtk_selection_data_free)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTargetList, gtk_target_list_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTextIter, gtk_text_iter_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTreeIter, gtk_tree_iter_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTreeRowReference, gtk_tree_row_reference_free)
diff --git a/gtk/gtkselection.c b/gtk/gtkselection.c
index 4dc11b1..8f107cc 100644
--- a/gtk/gtkselection.c
+++ b/gtk/gtkselection.c
@@ -154,13 +154,6 @@ struct _GtkIncrConversion
* left to send */
};
-struct _GtkTargetList
-{
- /*< private >*/
- GList *list;
- guint ref_count;
-};
-
struct _GtkIncrInfo
{
GdkWindow *requestor; /* Requestor window - we create a GdkWindow
@@ -225,85 +218,6 @@ static const char gtk_selection_handler_key[] = "gtk-selection-handlers";
*/
-/**
- * gtk_target_list_new:
- * @targets: (array length=ntargets) (allow-none): Pointer to an array
- * of char *
- * @ntargets: number of entries in @targets.
- *
- * Creates a new #GtkTargetList from an array of mime types.
- *
- * Returns: (transfer full): the new #GtkTargetList.
- **/
-GtkTargetList *
-gtk_target_list_new (const char **targets,
- guint ntargets)
-{
- GtkTargetList *result = g_slice_new (GtkTargetList);
- result->list = NULL;
- result->ref_count = 1;
-
- if (targets)
- gtk_target_list_add_table (result, targets, ntargets);
-
- return result;
-}
-
-/**
- * gtk_target_list_ref:
- * @list: a #GtkTargetList
- *
- * Increases the reference count of a #GtkTargetList by one.
- *
- * Returns: the passed in #GtkTargetList.
- **/
-GtkTargetList *
-gtk_target_list_ref (GtkTargetList *list)
-{
- g_return_val_if_fail (list != NULL, NULL);
-
- list->ref_count++;
-
- return list;
-}
-
-/**
- * gtk_target_list_unref:
- * @list: a #GtkTargetList
- *
- * Decreases the reference count of a #GtkTargetList by one.
- * If the resulting reference count is zero, frees the list.
- **/
-void
-gtk_target_list_unref (GtkTargetList *list)
-{
- g_return_if_fail (list != NULL);
- g_return_if_fail (list->ref_count > 0);
-
- list->ref_count--;
- if (list->ref_count > 0)
- return;
-
- g_list_free (list->list);
- g_slice_free (GtkTargetList, list);
-}
-
-/**
- * gtk_target_list_add:
- * @list: a #GtkTargetList
- * @target: the mime type of the target
- *
- * Appends another target to a #GtkTargetList.
- **/
-void
-gtk_target_list_add (GtkTargetList *list,
- const char *target)
-{
- g_return_if_fail (list != NULL);
-
- list->list = g_list_append (list->list, (gpointer) gdk_atom_intern (target, FALSE));
-}
-
static GdkAtom utf8_atom;
static GdkAtom text_atom;
static GdkAtom ctext_atom;
@@ -480,134 +394,6 @@ gtk_target_list_add_uri_targets (GtkTargetList *list)
}
/**
- * gtk_target_list_merge:
- * @target: the #GtkTargetList to merge into
- * @source: the #GtkTargeList to merge from
- *
- * Merges all targets from @source into @target.
- */
-void
-gtk_target_list_merge (GtkTargetList *target,
- const GtkTargetList *source)
-{
- GList *l;
-
- g_return_if_fail (target != NULL);
- g_return_if_fail (source != NULL);
-
- for (l = source->list; l; l = l->next)
- {
- target->list = g_list_prepend (target->list, l->data);
- }
-}
-
-/**
- * gtk_target_list_intersects:
- * @first: the primary #GtkTargetList to intersect
- * @second: the #GtkTargeList to intersect with
- *
- * Finds the first element from @first that is also contained
- * in @second.
- *
- * Returns: The first matching #GdkAtom or %NULL if the lists
- * do not intersect.
- */
-GdkAtom
-gtk_target_list_intersects (const GtkTargetList *first,
- const GtkTargetList *second)
-{
- GList *l;
-
- g_return_val_if_fail (first != NULL, NULL);
- g_return_val_if_fail (second != NULL, NULL);
-
- for (l = first->list; l; l = l->next)
- {
- if (g_list_find (second->list, l->data))
- return l->data;
- }
-
- return NULL;
-}
-
-/**
- * gtk_target_list_add_table:
- * @list: a #GtkTargetList
- * @targets: (array length=ntargets): the table of #GtkTargetEntry
- * @ntargets: number of targets in the table
- *
- * Prepends a table of #GtkTargetEntry to a target list.
- **/
-void
-gtk_target_list_add_table (GtkTargetList *list,
- const char **targets,
- guint ntargets)
-{
- gint i;
-
- for (i=ntargets-1; i >= 0; i--)
- {
- list->list = g_list_prepend (list->list, (gpointer) gdk_atom_intern (targets[i], FALSE));
- }
-}
-
-/**
- * gtk_target_list_remove:
- * @list: a #GtkTargetList
- * @target: the interned atom representing the target
- *
- * Removes a target from a target list.
- **/
-void
-gtk_target_list_remove (GtkTargetList *list,
- GdkAtom target)
-{
- g_return_if_fail (list != NULL);
-
- list->list = g_list_remove (list->list, (gpointer) target);
-}
-
-/**
- * gtk_target_list_find:
- * @list: a #GtkTargetList
- * @target: a string representing the target to search for
- *
- * Looks up a given target in a #GtkTargetList.
- *
- * Returns: %TRUE if the target was found, otherwise %FALSE
- **/
-gboolean
-gtk_target_list_find (GtkTargetList *list,
- const char *target)
-{
- g_return_val_if_fail (list != NULL, FALSE);
- g_return_val_if_fail (target != NULL, FALSE);
-
- return g_list_find (list->list, (gpointer) gdk_atom_intern (target, FALSE)) != NULL;
-}
-
-GdkAtom *
-gtk_target_list_get_atoms (GtkTargetList *list,
- guint *n_atoms)
-{
- GdkAtom *atoms;
- GList *l;
- guint i, n;
-
- n = g_list_length (list->list);
- atoms = g_new (GdkAtom, n);
-
- i = 0;
- for (l = list->list; l; l = l->next)
- atoms[i++] = l->data;
-
- if (n_atoms)
- *n_atoms = n;
-
- return atoms;
-}
-
-/**
* gtk_selection_owner_set_for_display:
* @display: the #GdkDisplay where the selection is set
* @widget: (allow-none): new selection owner (a #GtkWidget), or %NULL.
@@ -2073,7 +1859,6 @@ gtk_targets_include_image (GdkAtom *targets,
gboolean writable)
{
GtkTargetList *list;
- GList *l;
gint i;
gboolean result = FALSE;
@@ -2083,13 +1868,10 @@ gtk_targets_include_image (GdkAtom *targets,
gtk_target_list_add_image_targets (list, writable);
for (i = 0; i < n_targets && !result; i++)
{
- for (l = list->list; l; l = l->next)
- {
- if ((GdkAtom) l->data == targets[i])
- {
- result = TRUE;
- break;
- }
+ if (gtk_target_list_find (list, targets[i]))
+ {
+ result = TRUE;
+ break;
}
}
gtk_target_list_unref (list);
diff --git a/gtk/gtkselection.h b/gtk/gtkselection.h
index ee718e2..bc93e9c 100644
--- a/gtk/gtkselection.h
+++ b/gtk/gtkselection.h
@@ -34,37 +34,9 @@
G_BEGIN_DECLS
-/**
- * GtkTargetList:
- *
- * A #GtkTargetList-struct is a reference counted list
- * of #GtkTargetPair and should be treated as
- * opaque.
- */
-typedef struct _GtkTargetList GtkTargetList;
-
#define GTK_TYPE_SELECTION_DATA (gtk_selection_data_get_type ())
-#define GTK_TYPE_TARGET_LIST (gtk_target_list_get_type ())
GDK_AVAILABLE_IN_ALL
-GType gtk_target_list_get_type (void) G_GNUC_CONST;
-GDK_AVAILABLE_IN_ALL
-GtkTargetList *gtk_target_list_new (const char **targets,
- guint ntargets);
-GDK_AVAILABLE_IN_ALL
-GtkTargetList *gtk_target_list_ref (GtkTargetList *list);
-GDK_AVAILABLE_IN_ALL
-void gtk_target_list_unref (GtkTargetList *list);
-GDK_AVAILABLE_IN_3_94
-void gtk_target_list_merge (GtkTargetList *target,
- const GtkTargetList *source);
-GDK_AVAILABLE_IN_3_94
-GdkAtom gtk_target_list_intersects(const GtkTargetList *first,
- const GtkTargetList *second);
-GDK_AVAILABLE_IN_ALL
-void gtk_target_list_add (GtkTargetList *list,
- const char *target);
-GDK_AVAILABLE_IN_ALL
void gtk_target_list_add_text_targets (GtkTargetList *list);
GDK_AVAILABLE_IN_ALL
void gtk_target_list_add_rich_text_targets (GtkTargetList *list,
@@ -75,16 +47,6 @@ void gtk_target_list_add_image_targets (GtkTargetList *list,
gboolean writable);
GDK_AVAILABLE_IN_ALL
void gtk_target_list_add_uri_targets (GtkTargetList *list);
-GDK_AVAILABLE_IN_ALL
-void gtk_target_list_add_table (GtkTargetList *list,
- const char **targets,
- guint ntargets);
-GDK_AVAILABLE_IN_ALL
-void gtk_target_list_remove (GtkTargetList *list,
- const char *target);
-GDK_AVAILABLE_IN_ALL
-gboolean gtk_target_list_find (GtkTargetList *list,
- const char *target);
GDK_AVAILABLE_IN_ALL
gboolean gtk_selection_owner_set (GtkWidget *widget,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]