[empathy] Cast away constness of strings in GtkTargetEntry structs



commit 265a072dab29839e7e195470f49e7f9980afc838
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Thu Aug 5 15:53:33 2010 +0100

    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 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c
index 239eda7..ed7c68b 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)];
 



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