From 265a072dab29839e7e195470f49e7f9980afc838 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 5 Aug 2010 15:53:33 +0100 Subject: Cast away constness of strings in GtkTargetEntry structs This stops gcc warning us about GTK+'s broken API which uses non-const string fields in a static struct. --- libempathy-gtk/empathy-individual-view.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c index 239eda7d0..ed7c68b5a 100644 --- a/libempathy-gtk/empathy-individual-view.c +++ b/libempathy-gtk/empathy-individual-view.c @@ -108,23 +108,28 @@ enum DndDragType DND_DRAG_TYPE_STRING, }; +#define DRAG_TYPE(T,I) \ + { (gchar *)T, 0, I } + static const GtkTargetEntry drag_types_dest[] = { - {"text/path-list", 0, DND_DRAG_TYPE_URI_LIST}, - {"text/uri-list", 0, DND_DRAG_TYPE_URI_LIST}, - {"text/contact-id", 0, DND_DRAG_TYPE_INDIVIDUAL_ID}, - {"text/plain", 0, DND_DRAG_TYPE_STRING}, - {"STRING", 0, DND_DRAG_TYPE_STRING}, + DRAG_TYPE ("text/path-list", DND_DRAG_TYPE_URI_LIST), + DRAG_TYPE ("text/uri-list", DND_DRAG_TYPE_URI_LIST), + DRAG_TYPE ("text/contact-id", DND_DRAG_TYPE_INDIVIDUAL_ID), + DRAG_TYPE ("text/plain", DND_DRAG_TYPE_STRING), + DRAG_TYPE ("STRING", DND_DRAG_TYPE_STRING), }; static const GtkTargetEntry drag_types_dest_file[] = { - {"text/path-list", 0, DND_DRAG_TYPE_URI_LIST}, - {"text/uri-list", 0, DND_DRAG_TYPE_URI_LIST}, + DRAG_TYPE ("text/path-list", DND_DRAG_TYPE_URI_LIST), + DRAG_TYPE ("text/uri-list", DND_DRAG_TYPE_URI_LIST), }; static const GtkTargetEntry drag_types_source[] = { - {"text/contact-id", 0, DND_DRAG_TYPE_INDIVIDUAL_ID}, + DRAG_TYPE ("text/contact-id", DND_DRAG_TYPE_INDIVIDUAL_ID), }; +#undef DRAG_TYPE + static GdkAtom drag_atoms_dest[G_N_ELEMENTS (drag_types_dest)]; static GdkAtom drag_atoms_source[G_N_ELEMENTS (drag_types_source)]; -- cgit v1.2.3