[gtk+] dnd: Remove GtkTargetEntry and GtkTargetFlags



commit c863ac0f90dfdeea5e17293594686063187d689c
Author: Benjamin Otte <otte redhat com>
Date:   Fri Nov 17 00:28:53 2017 +0100

    dnd: Remove GtkTargetEntry and GtkTargetFlags
    
    warning: We don't do any same-app checks anymore so you currently can
    copy local data into external apps.
    
    This will be fixed later.

 demos/icon-browser/iconbrowserwin.c |    4 +-
 gtk/gtkcolorbutton.c                |    2 +-
 gtk/gtkcolorswatch.c                |    4 +-
 gtk/gtkdnd.c                        |   14 +---
 gtk/gtkdragdest.c                   |   15 +----
 gtk/gtkiconview.c                   |    4 +-
 gtk/gtklinkbutton.c                 |    6 +-
 gtk/gtknotebook.c                   |   10 ++--
 gtk/gtkplacessidebar.c              |    8 +-
 gtk/gtkselection.c                  |  130 ++++++++++-------------------------
 gtk/gtkselection.h                  |   73 ++------------------
 gtk/gtktextbuffer.c                 |    3 +-
 gtk/gtktoolpalette.c                |   22 +++---
 gtk/gtktoolpalette.h                |    4 +-
 gtk/gtktreeview.c                   |    4 +-
 gtk/gtkwindow.c                     |    4 +-
 tests/testdnd.c                     |    8 +-
 tests/testiconview.c                |    4 +-
 tests/testkineticscrolling.c        |    4 +-
 tests/testlist3.c                   |    4 +-
 tests/testnotebookdnd.c             |    4 +-
 tests/testselection.c               |    8 +-
 tests/testtoolbar.c                 |    4 +-
 tests/testtreecolumns.c             |    4 +-
 tests/testtreednd.c                 |    4 +-
 tests/testtreeview.c                |    4 +-
 testsuite/gtk/clipboard.c           |    2 +-
 27 files changed, 110 insertions(+), 247 deletions(-)
---
diff --git a/demos/icon-browser/iconbrowserwin.c b/demos/icon-browser/iconbrowserwin.c
index b2ba2fc..1604239 100644
--- a/demos/icon-browser/iconbrowserwin.c
+++ b/demos/icon-browser/iconbrowserwin.c
@@ -5,8 +5,8 @@
 #include <gtk/gtk.h>
 
 /* Drag 'n Drop */
-static GtkTargetEntry target_table[] = {
-  { "text/uri-list", 0 },
+static const char *target_table[] = {
+  "text/uri-list"
 };
 
 typedef struct
diff --git a/gtk/gtkcolorbutton.c b/gtk/gtkcolorbutton.c
index c91a498..9e042ee 100644
--- a/gtk/gtkcolorbutton.c
+++ b/gtk/gtkcolorbutton.c
@@ -129,7 +129,7 @@ static void gtk_color_button_drag_data_received (GtkWidget        *widget,
 
 static guint color_button_signals[LAST_SIGNAL] = { 0 };
 
-static const GtkTargetEntry drop_types[] = { { (char *) "application/x-color", 0 } };
+static const char *drop_types[] = { "application/x-color" };
 
 static void gtk_color_button_iface_init (GtkColorChooserInterface *iface);
 
diff --git a/gtk/gtkcolorswatch.c b/gtk/gtkcolorswatch.c
index 725943f..e9f023d 100644
--- a/gtk/gtkcolorswatch.c
+++ b/gtk/gtkcolorswatch.c
@@ -604,8 +604,8 @@ gtk_color_swatch_new (void)
   return (GtkWidget *) g_object_new (GTK_TYPE_COLOR_SWATCH, NULL);
 }
 
-static const GtkTargetEntry dnd_targets[] = {
-  { (char *) "application/x-color", 0 }
+static const char *dnd_targets[] = {
+  "application/x-color"
 };
 
 void
diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c
index ded6bbe..abd223a 100644
--- a/gtk/gtkdnd.c
+++ b/gtk/gtkdnd.c
@@ -1264,9 +1264,7 @@ gtk_drag_begin_internal (GtkWidget          *widget,
   tmp_list = g_list_last (target_list->list);
   while (tmp_list)
     {
-      GtkTargetPair *pair = tmp_list->data;
-      targets = g_list_prepend (targets, 
-                                GINT_TO_POINTER (pair->target));
+      targets = g_list_prepend (targets, tmp_list->data);
       tmp_list = tmp_list->prev;
     }
 
@@ -1796,11 +1794,9 @@ gtk_drag_source_check_selection (GtkDragSourceInfo *info,
   tmp_list = info->target_list->list;
   while (tmp_list)
     {
-      GtkTargetPair *pair = tmp_list->data;
-
       gtk_selection_add_target (info->ipc_widget,
                                 selection,
-                                pair->target);
+                                tmp_list->data);
       tmp_list = tmp_list->next;
     }
 
@@ -1866,12 +1862,10 @@ gtk_drag_drop (GtkDragSourceInfo *info,
       tmp_list = info->target_list->list;
       while (tmp_list)
         {
-          GtkTargetPair *pair = tmp_list->data;
-          
-          if (pair->target == target1 || pair->target == target2)
+          if (tmp_list->data == target1 || tmp_list->data == target2)
             {
               selection_data.selection = NULL;
-              selection_data.target = pair->target;
+              selection_data.target = tmp_list->data;
               selection_data.data = NULL;
               selection_data.length = -1;
 
diff --git a/gtk/gtkdragdest.c b/gtk/gtkdragdest.c
index a7737f0..ea1da8a 100644
--- a/gtk/gtkdragdest.c
+++ b/gtk/gtkdragdest.c
@@ -413,12 +413,10 @@ gtk_drag_dest_find_target (GtkWidget      *widget,
 {
   GList *tmp_target;
   GList *tmp_source = NULL;
-  GtkWidget *source_widget;
 
   g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
   g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
 
-  source_widget = gtk_drag_get_source_widget (context);
   if (target_list == NULL)
     target_list = gtk_drag_dest_get_target_list (widget);
 
@@ -428,20 +426,11 @@ gtk_drag_dest_find_target (GtkWidget      *widget,
   tmp_target = target_list->list;
   while (tmp_target)
     {
-      GtkTargetPair *pair = tmp_target->data;
       tmp_source = gdk_drag_context_list_targets (context);
       while (tmp_source)
         {
-          if (tmp_source->data == GUINT_TO_POINTER (pair->target))
-            {
-              if ((!(pair->flags & GTK_TARGET_SAME_APP) || source_widget) &&
-                  (!(pair->flags & GTK_TARGET_SAME_WIDGET) || (source_widget == widget)) &&
-                  (!(pair->flags & GTK_TARGET_OTHER_APP) || !source_widget) &&
-                  (!(pair->flags & GTK_TARGET_OTHER_WIDGET) || (source_widget != widget)))
-                return pair->target;
-              else
-                break;
-            }
+          if (tmp_source->data == tmp_target->data)
+            return tmp_target->data;
           tmp_source = tmp_source->next;
         }
       tmp_target = tmp_target->next;
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index 3a3c42a..fa8d55f 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -6895,8 +6895,8 @@ gtk_icon_view_get_reorderable (GtkIconView *icon_view)
   return icon_view->priv->reorderable;
 }
 
-static const GtkTargetEntry item_targets[] = {
-  { (char *) "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_WIDGET }
+static const char *item_targets[] = {
+  "GTK_TREE_MODEL_ROW" 
 };
 
 
diff --git a/gtk/gtklinkbutton.c b/gtk/gtklinkbutton.c
index 41e4bbf..ee52cb1 100644
--- a/gtk/gtklinkbutton.c
+++ b/gtk/gtklinkbutton.c
@@ -128,9 +128,9 @@ static gboolean gtk_link_button_activate_link (GtkLinkButton *link_button);
 static void     set_hand_cursor (GtkWidget *widget,
                                 gboolean   show_hand);
 
-static const GtkTargetEntry link_drop_types[] = {
-  { (char *) "text/uri-list", 0 },
-  { (char *) "_NETSCAPE_URL", 0 }
+static const char *link_drop_types[] = {
+  "text/uri-list",
+  "_NETSCAPE_URL"
 };
 
 static guint link_signals[LAST_SIGNAL] = { 0, };
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 1828f97..4adb599 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -308,13 +308,13 @@ struct _GtkNotebookPage
   gulong notify_visible_handler;
 };
 
-static const GtkTargetEntry src_notebook_targets [] = {
-  { (char *) "GTK_NOTEBOOK_TAB", GTK_TARGET_SAME_APP },
-  { (char *) "application/x-rootwindow-drop", 0 },
+static const char *src_notebook_targets [] = {
+  "GTK_NOTEBOOK_TAB",
+  "application/x-rootwindow-drop"
 };
 
-static const GtkTargetEntry dst_notebook_targets [] = {
-  { (char *) "GTK_NOTEBOOK_TAB", GTK_TARGET_SAME_APP },
+static const char *dst_notebook_targets [] = {
+  "GTK_NOTEBOOK_TAB"
 };
 
 /*** GtkNotebook Methods ***/
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index 0ff021d..c37f870 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -313,13 +313,13 @@ enum {
 };
 
 /* Target types for dragging from the shortcuts list */
-static const GtkTargetEntry dnd_source_targets[] = {
-  { (char *) "DND_GTK_SIDEBAR_ROW", GTK_TARGET_SAME_WIDGET }
+static const char *dnd_source_targets[] = {
+  "DND_GTK_SIDEBAR_ROW"
 };
 
 /* Target types for dropping into the shortcuts list */
-static const GtkTargetEntry dnd_drop_targets [] = {
-  { (char *) "DND_GTK_SIDEBAR_ROW", GTK_TARGET_SAME_WIDGET }
+static const char *dnd_drop_targets [] = {
+  "DND_GTK_SIDEBAR_ROW"
 };
 
 G_DEFINE_TYPE (GtkPlacesSidebar, gtk_places_sidebar, GTK_TYPE_SCROLLED_WINDOW);
diff --git a/gtk/gtkselection.c b/gtk/gtkselection.c
index d6495bf..60c4e40 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
- * #GtkTargetEntry and #GtkTargetList objects represent
+ * #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
@@ -221,16 +221,16 @@ 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 #GtkTargetEntry
+ *   of char *
  * @ntargets: number of entries in @targets.
  * 
- * Creates a new #GtkTargetList from an array of #GtkTargetEntry.
+ * Creates a new #GtkTargetList from an array of mime types.
  * 
  * Returns: (transfer full): the new #GtkTargetList.
  **/
 GtkTargetList *
-gtk_target_list_new (const GtkTargetEntry *targets,
-                    guint                 ntargets)
+gtk_target_list_new (const char **targets,
+                    guint        ntargets)
 {
   GtkTargetList *result = g_slice_new (GtkTargetList);
   result->list = NULL;
@@ -274,44 +274,27 @@ gtk_target_list_unref (GtkTargetList *list)
   g_return_if_fail (list->ref_count > 0);
 
   list->ref_count--;
-  if (list->ref_count == 0)
-    {
-      GList *tmp_list = list->list;
-      while (tmp_list)
-       {
-         GtkTargetPair *pair = tmp_list->data;
-         g_slice_free (GtkTargetPair, pair);
+  if (list->ref_count > 0)
+    return;
 
-         tmp_list = tmp_list->next;
-       }
-      
-      g_list_free (list->list);
-      g_slice_free (GtkTargetList, list);
-    }
+  g_list_free (list->list);
+  g_slice_free (GtkTargetList, list);
 }
 
 /**
  * gtk_target_list_add:
  * @list:  a #GtkTargetList
- * @target: the interned atom representing the target
- * @flags: the flags for this target
+ * @target: the mime type of the target
  * 
  * Appends another target to a #GtkTargetList.
  **/
 void 
 gtk_target_list_add (GtkTargetList *list,
-                    GdkAtom        target,
-                    guint          flags)
+                    const char    *target)
 {
-  GtkTargetPair *pair;
-
   g_return_if_fail (list != NULL);
   
-  pair = g_slice_new (GtkTargetPair);
-  pair->target = target;
-  pair->flags = flags;
-
-  list->list = g_list_append (list->list, pair);
+  list->list = g_list_append (list->list, (gpointer) gdk_atom_intern (target, FALSE));
 }
 
 static GdkAtom utf8_atom;
@@ -362,14 +345,14 @@ 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, 0);  
-  gtk_target_list_add (list, ctext_atom, 0);  
-  gtk_target_list_add (list, text_atom, 0);  
-  gtk_target_list_add (list, GDK_TARGET_STRING, 0);  
-  gtk_target_list_add (list, text_plain_utf8_atom, 0);  
+  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);  
   if (!g_get_charset (NULL))
-    gtk_target_list_add (list, text_plain_locale_atom, 0);  
-  gtk_target_list_add (list, text_plain_atom, 0);  
+    gtk_target_list_add (list, text_plain_locale_atom);  
+  gtk_target_list_add (list, text_plain_atom);  
 }
 
 /**
@@ -404,7 +387,7 @@ 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], 0);
+    gtk_target_list_add (list, atoms[i]);
 
   g_free (atoms);
 }
@@ -426,7 +409,6 @@ gtk_target_list_add_image_targets (GtkTargetList *list,
 {
   GSList *formats, *f;
   gchar **mimes, **m;
-  GdkAtom atom;
 
   g_return_if_fail (list != NULL);
 
@@ -462,8 +444,7 @@ gtk_target_list_add_image_targets (GtkTargetList *list,
       mimes = gdk_pixbuf_format_get_mime_types (fmt);
       for (m = mimes; *m; m++)
        {
-         atom = gdk_atom_intern (*m, FALSE);
-         gtk_target_list_add (list, atom, 0);  
+         gtk_target_list_add (list, *m);  
        }
       g_strfreev (mimes);
     }
@@ -488,7 +469,7 @@ gtk_target_list_add_uri_targets (GtkTargetList *list)
   
   init_atoms ();
 
-  gtk_target_list_add (list, text_uri_list_atom, 0);  
+  gtk_target_list_add (list, text_uri_list_atom);  
 }
 
 /**
@@ -509,7 +490,7 @@ gtk_target_list_merge (GtkTargetList       *target,
 
   for (l = source->list; l; l = l->next)
     {
-      target->list = g_list_prepend (target->list, g_slice_dup (GtkTargetPair, l->data));
+      target->list = g_list_prepend (target->list, l->data);
     }
 }
 
@@ -522,19 +503,15 @@ gtk_target_list_merge (GtkTargetList       *target,
  * Prepends a table of #GtkTargetEntry to a target list.
  **/
 void               
-gtk_target_list_add_table (GtkTargetList        *list,
-                          const GtkTargetEntry *targets,
-                          guint                 ntargets)
+gtk_target_list_add_table (GtkTargetList  *list,
+                          const char    **targets,
+                          guint           ntargets)
 {
   gint i;
 
   for (i=ntargets-1; i >= 0; i--)
     {
-      GtkTargetPair *pair = g_slice_new (GtkTargetPair);
-      pair->target = gdk_atom_intern (targets[i].target, FALSE);
-      pair->flags = targets[i].flags;
-      
-      list->list = g_list_prepend (list->list, pair);
+      list->list = g_list_prepend (list->list, (gpointer) gdk_atom_intern (targets[i], FALSE));
     }
 }
 
@@ -547,35 +524,17 @@ gtk_target_list_add_table (GtkTargetList        *list,
  **/
 void 
 gtk_target_list_remove (GtkTargetList *list,
-                       GdkAtom            target)
+                       GdkAtom        target)
 {
-  GList *tmp_list;
-
   g_return_if_fail (list != NULL);
 
-  tmp_list = list->list;
-  while (tmp_list)
-    {
-      GtkTargetPair *pair = tmp_list->data;
-      
-      if (pair->target == target)
-       {
-         g_slice_free (GtkTargetPair, pair);
-
-         list->list = g_list_remove_link (list->list, tmp_list);
-         g_list_free_1 (tmp_list);
-
-         return;
-       }
-      
-      tmp_list = tmp_list->next;
-    }
+  list->list = g_list_remove (list->list, (gpointer) target);
 }
 
 /**
  * gtk_target_list_find:
  * @list: a #GtkTargetList
- * @target: an interned atom representing the target to search for
+ * @target: a string representing the target to search for
  *
  * Looks up a given target in a #GtkTargetList.
  *
@@ -583,24 +542,12 @@ gtk_target_list_remove (GtkTargetList *list,
  **/
 gboolean
 gtk_target_list_find (GtkTargetList *list,
-                     GdkAtom        target)
+                     const char    *target)
 {
-  GList *tmp_list;
-
   g_return_val_if_fail (list != NULL, FALSE);
+  g_return_val_if_fail (target != NULL, FALSE);
 
-  tmp_list = list->list;
-  while (tmp_list)
-    {
-      GtkTargetPair *pair = tmp_list->data;
-
-      if (pair->target == target)
-       return TRUE;
-
-      tmp_list = tmp_list->next;
-    }
-
-  return FALSE;
+  return g_list_find (list->list, (gpointer) gdk_atom_intern (target, FALSE)) != NULL;
 }
 
 GdkAtom *
@@ -616,7 +563,7 @@ gtk_target_list_get_atoms (GtkTargetList *list,
 
   i = 0;
   for (l = list->list; l; l = l->next)
-    atoms[i++] = ((GtkTargetPair *) l->data)->target;
+    atoms[i++] = l->data;
 
   if (n_atoms)
     *n_atoms = n;
@@ -881,7 +828,7 @@ gtk_selection_add_target (GtkWidget     *widget,
   g_return_if_fail (selection != NULL);
 
   list = gtk_selection_target_list_get (widget, selection);
-  gtk_target_list_add (list, target, 0);
+  gtk_target_list_add (list, target);
   gdk_selection_add_targets (gtk_widget_get_window (widget), selection, &target, 1);
 }
 
@@ -2102,8 +2049,7 @@ gtk_targets_include_image (GdkAtom *targets,
     {
       for (l = list->list; l; l = l->next)
        {
-         GtkTargetPair *pair = (GtkTargetPair *)l->data;
-         if (pair->target == targets[i])
+         if ((GdkAtom) l->data == targets[i])
            {
              result = TRUE;
              break;
@@ -3143,7 +3089,6 @@ gtk_selection_default_handler (GtkWidget  *widget,
       guint count;
       GList *tmp_list;
       GtkTargetList *target_list;
-      GtkTargetPair *pair;
       
       target_list = gtk_selection_target_list_get (widget,
                                                   data->selection);
@@ -3166,8 +3111,7 @@ gtk_selection_default_handler (GtkWidget  *widget,
       tmp_list = target_list->list;
       while (tmp_list)
        {
-         pair = (GtkTargetPair *)tmp_list->data;
-         *p++ = pair->target;
+         *p++ = (GdkAtom) tmp_list->data;
          
          tmp_list = tmp_list->next;
        }
diff --git a/gtk/gtkselection.h b/gtk/gtkselection.h
index 9e95c2a..a7de3d6 100644
--- a/gtk/gtkselection.h
+++ b/gtk/gtkselection.h
@@ -34,27 +34,6 @@
 
 G_BEGIN_DECLS
 
-typedef struct _GtkTargetPair GtkTargetPair;
-
-/**
- * GtkTargetPair:
- * @target: #GdkAtom representation of the target type
- * @flags: #GtkTargetFlags for DND
- * @info: an application-assigned integer ID which will
- *     get passed as a parameter to e.g the #GtkWidget::selection-get
- *     signal. It allows the application to identify the target
- *     type without extensive string compares.
- *
- * A #GtkTargetPair is used to represent the same
- * information as a table of #GtkTargetEntry, but in
- * an efficient form.
- */
-struct _GtkTargetPair
-{
-  GdkAtom   target;
-  guint     flags;
-};
-
 /**
  * GtkTargetList:
  *
@@ -63,55 +42,14 @@ struct _GtkTargetPair
  * opaque.
  */
 typedef struct _GtkTargetList  GtkTargetList;
-typedef struct _GtkTargetEntry GtkTargetEntry;
 
 #define GTK_TYPE_SELECTION_DATA (gtk_selection_data_get_type ())
 #define GTK_TYPE_TARGET_LIST    (gtk_target_list_get_type ())
 
-/**
- * GtkTargetFlags:
- * @GTK_TARGET_SAME_APP: If this is set, the target will only be selected
- *   for drags within a single application.
- * @GTK_TARGET_SAME_WIDGET: If this is set, the target will only be selected
- *   for drags within a single widget.
- * @GTK_TARGET_OTHER_APP: If this is set, the target will not be selected
- *   for drags within a single application.
- * @GTK_TARGET_OTHER_WIDGET: If this is set, the target will not be selected
- *   for drags withing a single widget.
- *
- * The #GtkTargetFlags enumeration is used to specify
- * constraints on a #GtkTargetEntry.
- */
-typedef enum {
-  GTK_TARGET_SAME_APP = 1 << 0,    /*< nick=same-app >*/
-  GTK_TARGET_SAME_WIDGET = 1 << 1, /*< nick=same-widget >*/
-  GTK_TARGET_OTHER_APP = 1 << 2,   /*< nick=other-app >*/
-  GTK_TARGET_OTHER_WIDGET = 1 << 3 /*< nick=other-widget >*/
-} GtkTargetFlags;
-
-/**
- * GtkTargetEntry:
- * @target: a string representation of the target type
- * @flags: #GtkTargetFlags for DND
- * @info: an application-assigned integer ID which will
- *     get passed as a parameter to e.g the #GtkWidget::selection-get
- *     signal. It allows the application to identify the target
- *     type without extensive string compares.
- *
- * A #GtkTargetEntry represents a single type of
- * data than can be supplied for by a widget for a selection
- * or for supplied or received during drag-and-drop.
- */
-struct _GtkTargetEntry
-{
-  gchar *target;
-  guint  flags;
-};
-
 GDK_AVAILABLE_IN_ALL
 GType          gtk_target_list_get_type  (void) G_GNUC_CONST;
 GDK_AVAILABLE_IN_ALL
-GtkTargetList *gtk_target_list_new       (const GtkTargetEntry *targets,
+GtkTargetList *gtk_target_list_new       (const char          **targets,
                                           guint                 ntargets);
 GDK_AVAILABLE_IN_ALL
 GtkTargetList *gtk_target_list_ref       (GtkTargetList  *list);
@@ -122,8 +60,7 @@ void           gtk_target_list_merge     (GtkTargetList         *target,
                                           const GtkTargetList   *source);
 GDK_AVAILABLE_IN_ALL
 void           gtk_target_list_add       (GtkTargetList  *list,
-                                          GdkAtom         target,
-                                          guint           flags);
+                                          const char     *target);
 GDK_AVAILABLE_IN_ALL
 void           gtk_target_list_add_text_targets      (GtkTargetList  *list);
 GDK_AVAILABLE_IN_ALL
@@ -137,14 +74,14 @@ 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 GtkTargetEntry *targets,
+                                          const char          **targets,
                                           guint                 ntargets);
 GDK_AVAILABLE_IN_ALL
 void           gtk_target_list_remove    (GtkTargetList  *list,
-                                          GdkAtom         target);
+                                          const char     *target);
 GDK_AVAILABLE_IN_ALL
 gboolean       gtk_target_list_find      (GtkTargetList  *list,
-                                          GdkAtom         target);
+                                          const char     *target);
 
 GDK_AVAILABLE_IN_ALL
 gboolean gtk_selection_owner_set             (GtkWidget  *widget,
diff --git a/gtk/gtktextbuffer.c b/gtk/gtktextbuffer.c
index ef79807..c141c59 100644
--- a/gtk/gtktextbuffer.c
+++ b/gtk/gtktextbuffer.c
@@ -4011,8 +4011,7 @@ gtk_text_buffer_get_target_list (GtkTextBuffer   *buffer,
 
   if (include_local)
     gtk_target_list_add (target_list,
-                         gdk_atom_intern_static_string ("GTK_TEXT_BUFFER_CONTENTS"),
-                         GTK_TARGET_SAME_APP);
+                         gdk_atom_intern_static_string ("GTK_TEXT_BUFFER_CONTENTS"));
 
   gtk_target_list_add_rich_text_targets (target_list,
                                          deserializable,
diff --git a/gtk/gtktoolpalette.c b/gtk/gtktoolpalette.c
index be8d5b0..d5427b9 100644
--- a/gtk/gtktoolpalette.c
+++ b/gtk/gtktoolpalette.c
@@ -179,10 +179,10 @@ struct _GtkToolPaletteDragData
 static GdkAtom dnd_target_atom_item = NULL;
 static GdkAtom dnd_target_atom_group = NULL;
 
-static const GtkTargetEntry dnd_targets[] =
+static const char *dnd_targets[] =
 {
-  { (char *) "application/x-gtk-tool-palette-item", GTK_TARGET_SAME_APP },
-  { (char *) "application/x-gtk-tool-palette-group", GTK_TARGET_SAME_APP },
+  "application/x-gtk-tool-palette-item",
+  "application/x-gtk-tool-palette-group"
 };
 
 static void gtk_tool_palette_set_hadjustment (GtkToolPalette *palette,
@@ -213,8 +213,8 @@ gtk_tool_palette_init (GtkToolPalette *palette)
 
   if (dnd_target_atom_item == NULL)
     {
-      dnd_target_atom_item = gdk_atom_intern_static_string (dnd_targets[0].target);
-      dnd_target_atom_group = gdk_atom_intern_static_string (dnd_targets[1].target);
+      dnd_target_atom_item = gdk_atom_intern_static_string (dnd_targets[0]);
+      dnd_target_atom_group = gdk_atom_intern_static_string (dnd_targets[1]);
     }
 
   gtk_widget_set_has_window (GTK_WIDGET (palette), FALSE);
@@ -1456,7 +1456,7 @@ gtk_tool_palette_add_drag_dest (GtkToolPalette            *palette,
                                 GtkToolPaletteDragTargets  targets,
                                 GdkDragAction              actions)
 {
-  GtkTargetEntry entries[G_N_ELEMENTS (dnd_targets)];
+  const char *entries[G_N_ELEMENTS (dnd_targets)];
   gint n_entries = 0;
   GtkTargetList *list;
 
@@ -1610,16 +1610,16 @@ _gtk_tool_palette_child_set_drag_source (GtkWidget *child,
 /**
  * gtk_tool_palette_get_drag_target_item:
  *
- * Gets the target entry for a dragged #GtkToolItem.
+ * Gets the mime type for a dragged #GtkToolItem.
  *
  * Returns: (transfer none): the #GtkTargetEntry for a dragged item.
  *
  * Since: 2.20
  */
-const GtkTargetEntry*
+const char *
 gtk_tool_palette_get_drag_target_item (void)
 {
-  return &dnd_targets[0];
+  return dnd_targets[0];
 }
 
 /**
@@ -1631,10 +1631,10 @@ gtk_tool_palette_get_drag_target_item (void)
  *
  * Since: 2.20
  */
-const GtkTargetEntry*
+const char *
 gtk_tool_palette_get_drag_target_group (void)
 {
-  return &dnd_targets[1];
+  return dnd_targets[1];
 }
 
 void
diff --git a/gtk/gtktoolpalette.h b/gtk/gtktoolpalette.h
index d803dd3..f717bef 100644
--- a/gtk/gtktoolpalette.h
+++ b/gtk/gtktoolpalette.h
@@ -144,9 +144,9 @@ void                           gtk_tool_palette_add_drag_dest         (GtkToolPa
                                                                        GdkDragAction              actions);
 
 GDK_AVAILABLE_IN_ALL
-const GtkTargetEntry*          gtk_tool_palette_get_drag_target_item  (void) G_GNUC_CONST;
+const char *                   gtk_tool_palette_get_drag_target_item  (void) G_GNUC_CONST;
 GDK_AVAILABLE_IN_ALL
-const GtkTargetEntry*          gtk_tool_palette_get_drag_target_group (void) G_GNUC_CONST;
+const char *                   gtk_tool_palette_get_drag_target_group (void) G_GNUC_CONST;
 
 
 G_END_DECLS
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 4ba520e..1606abe 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -12542,8 +12542,8 @@ gtk_tree_view_set_reorderable (GtkTreeView *tree_view,
 
   if (reorderable)
     {
-      const GtkTargetEntry row_targets[] = {
-        { (char *) "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_WIDGET }
+      const char *row_targets[] = {
+        "GTK_TREE_MODEL_ROW"
       };
       GtkTargetList *targets;
 
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 13a28e2..5021607 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -277,8 +277,8 @@ struct _GtkWindowPrivate
   GList *foci;
 };
 
-static const GtkTargetEntry dnd_dest_targets [] = {
-  { (char *) "application/x-rootwindow-drop", 0 },
+static const char *dnd_dest_targets [] = {
+  "application/x-rootwindow-drop"
 };
 
 enum {
diff --git a/tests/testdnd.c b/tests/testdnd.c
index 1e0a682..0f2d541 100644
--- a/tests/testdnd.c
+++ b/tests/testdnd.c
@@ -289,10 +289,10 @@ GdkPixbuf *trashcan_closed;
 
 gboolean have_drag;
 
-static GtkTargetEntry target_table[] = {
-  { "STRING",     0 },
-  { "text/plain", 0 },
-  { "application/x-rootwindow-drop", 0 }
+static const char *target_table[] = {
+  "STRING",
+  "text/plain",
+  "application/x-rootwindow-drop"
 };
 
 static guint n_targets = sizeof(target_table) / sizeof(target_table[0]);
diff --git a/tests/testiconview.c b/tests/testiconview.c
index 1f8d51e..d2caf6e 100644
--- a/tests/testiconview.c
+++ b/tests/testiconview.c
@@ -411,8 +411,8 @@ popup_menu_handler (GtkWidget *widget)
   return TRUE;
 }
 
-static const GtkTargetEntry item_targets[] = {
-  { "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_APP }
+static const char *item_targets[] = {
+  "GTK_TREE_MODEL_ROW"
 };
        
 gint
diff --git a/tests/testkineticscrolling.c b/tests/testkineticscrolling.c
index d042254..e946e8d 100644
--- a/tests/testkineticscrolling.c
+++ b/tests/testkineticscrolling.c
@@ -1,8 +1,8 @@
 #include <gtk/gtk.h>
 
-static GtkTargetEntry row_targets[] =
+static const char *row_targets[] =
 {
-  { "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_APP }
+  "GTK_TREE_MODEL_ROW"
 };
 
 static void
diff --git a/tests/testlist3.c b/tests/testlist3.c
index 066e364..9683b96 100644
--- a/tests/testlist3.c
+++ b/tests/testlist3.c
@@ -1,7 +1,7 @@
 #include <gtk/gtk.h>
 
-static GtkTargetEntry entries[] = {
-  { "GTK_LIST_BOX_ROW", GTK_TARGET_SAME_APP }
+static const char *entries[] = {
+  "GTK_LIST_BOX_ROW"
 };
 
 static void
diff --git a/tests/testnotebookdnd.c b/tests/testnotebookdnd.c
index 073da6c..72f1dd9 100644
--- a/tests/testnotebookdnd.c
+++ b/tests/testnotebookdnd.c
@@ -55,8 +55,8 @@ gchar *tabs4 [] = {
   NULL
 };
 
-static const GtkTargetEntry button_targets[] = {
-  { "GTK_NOTEBOOK_TAB", GTK_TARGET_SAME_APP },
+static const char *button_targets[] = {
+  "GTK_NOTEBOOK_TAB"
 };
 
 static GtkNotebook*
diff --git a/tests/testselection.c b/tests/testselection.c
index 31a0b12..0634ab2 100644
--- a/tests/testselection.c
+++ b/tests/testselection.c
@@ -384,10 +384,10 @@ main (int argc, char *argv[])
   GtkWidget *hbox;
   GtkWidget *scrolled;
 
-  static GtkTargetEntry targetlist[] = {
-    { "STRING",        0 },
-    { "TEXT",          0 },
-    { "COMPOUND_TEXT", 0 }
+  static const char *targetlist[] = {
+    "STRING",
+    "TEXT",
+    "COMPOUND_TEXT"
   };
   static gint ntargets = sizeof(targetlist) / sizeof(targetlist[0]);
   GtkTargetList *list;
diff --git a/tests/testtoolbar.c b/tests/testtoolbar.c
index 6e097db..6de5a20 100644
--- a/tests/testtoolbar.c
+++ b/tests/testtoolbar.c
@@ -305,8 +305,8 @@ toolbar_drag_drop (GtkWidget *widget, GdkDragContext *context,
   return TRUE;
 }
 
-static GtkTargetEntry target_table[] = {
-  { "application/x-toolbar-item", 0 }
+static const char *target_table[] = {
+  "application/x-toolbar-item"
 };
 
 static void
diff --git a/tests/testtreecolumns.c b/tests/testtreecolumns.c
index 3cec397..4c5bb2d 100644
--- a/tests/testtreecolumns.c
+++ b/tests/testtreecolumns.c
@@ -703,8 +703,8 @@ selection_changed (GtkTreeSelection *selection, GtkWidget *button)
     gtk_widget_set_sensitive (button, FALSE);
 }
 
-static GtkTargetEntry row_targets[] = {
-  { "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_APP }
+static const char *row_targets[] = {
+  "GTK_TREE_MODEL_ROW"
 };
 
 int
diff --git a/tests/testtreednd.c b/tests/testtreednd.c
index 49d19e2..25bf233 100644
--- a/tests/testtreednd.c
+++ b/tests/testtreednd.c
@@ -63,8 +63,8 @@ get_model (void)
   return GTK_TREE_MODEL (model);
 }
 
-static GtkTargetEntry entries[] = {
-  { "text/plain", 0 }
+static const char *entries[] = {
+  "text/plain"
 };
 
 static GtkWidget *
diff --git a/tests/testtreeview.c b/tests/testtreeview.c
index 3dc112f..7215dfa 100644
--- a/tests/testtreeview.c
+++ b/tests/testtreeview.c
@@ -641,8 +641,8 @@ on_row_activated (GtkTreeView       *tree_view,
   g_print ("Row activated\n");
 }
 
-static GtkTargetEntry row_targets[] = {
-  { "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_APP }
+static const char *row_targets[] = {
+  "GTK_TREE_MODEL_ROW"
 };
 
 int
diff --git a/testsuite/gtk/clipboard.c b/testsuite/gtk/clipboard.c
index 08fd4c3..8e0f412 100644
--- a/testsuite/gtk/clipboard.c
+++ b/testsuite/gtk/clipboard.c
@@ -66,7 +66,7 @@ static void
 test_with_data (void)
 {
     GtkClipboard *clipboard = gtk_clipboard_get_for_display (gdk_display_get_default (), 
GDK_SELECTION_CLIPBOARD);
-    GtkTargetEntry entries[] = { { .target = TARGET_TEXT } };
+    const char *entries[] = { TARGET_TEXT };
     GtkTargetList *targets;
 
     targets = gtk_target_list_new (entries, G_N_ELEMENTS(entries));


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