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.
This commit is contained in:
Benjamin Otte 2017-11-17 00:28:53 +01:00
parent 49d02eff93
commit c863ac0f90
27 changed files with 110 additions and 247 deletions

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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"
};

View File

@ -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, };

View File

@ -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 ***/

View File

@ -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);

View File

@ -68,7 +68,7 @@
*
* Some of the datatypes defined this section are used in
* the #GtkClipboard and drag-and-drop APIs 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,15 +221,15 @@ 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,
gtk_target_list_new (const char **targets,
guint ntargets)
{
GtkTargetList *result = g_slice_new (GtkTargetList);
@ -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);
tmp_list = tmp_list->next;
}
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 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);
}
}
@ -523,18 +504,14 @@ gtk_target_list_merge (GtkTargetList *target,
**/
void
gtk_target_list_add_table (GtkTargetList *list,
const GtkTargetEntry *targets,
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));
}
}
@ -549,33 +526,15 @@ void
gtk_target_list_remove (GtkTargetList *list,
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;
}

View File

@ -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,

View File

@ -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,

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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 {

View File

@ -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]);

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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*

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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 *

View File

@ -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

View File

@ -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));