[gtk+] gtk/gtkcolorsel.c: Use accessor functions to access GtkSelectionData



commit 1a2d9c368ee073e4d0bb678f32e81e3e4bb3aa8a
Author: Javier Jardón <jjardon gnome org>
Date:   Wed Dec 15 23:55:59 2010 +0000

    gtk/gtkcolorsel.c: Use accessor functions to access GtkSelectionData

 gtk/gtkcolorsel.c |   30 ++++++++++++++++++------------
 1 files changed, 18 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtkcolorsel.c b/gtk/gtkcolorsel.c
index 2ed6482..d0debfc 100644
--- a/gtk/gtkcolorsel.c
+++ b/gtk/gtkcolorsel.c
@@ -808,6 +808,7 @@ color_sample_drop_handle (GtkWidget        *widget,
 {
   GtkColorSelection *colorsel = data;
   GtkColorSelectionPrivate *priv;
+  gint length;
   guint16 *vals;
   gdouble color[4];
   priv = colorsel->private_data;
@@ -818,21 +819,23 @@ color_sample_drop_handle (GtkWidget        *widget,
    * B
    * opacity
    */
-  
-  if (selection_data->length < 0)
+
+  length = gtk_selection_data_get_length (selection_data);
+
+  if (length < 0)
     return;
   
   /* We accept drops with the wrong format, since the KDE color
    * chooser incorrectly drops application/x-color with format 8.
    */
-  if (selection_data->length != 8)
+  if (length != 8)
     {
       g_warning ("Received invalid color data\n");
       return;
     }
-  
-  vals = (guint16 *)selection_data->data;
-  
+
+  vals = (guint16 *) gtk_selection_data_get_data (selection_data);
+
   if (widget == priv->cur_sample)
     {
       color[0] = (gdouble)vals[0] / 0xffff;
@@ -1533,23 +1536,26 @@ palette_drop_handle (GtkWidget        *widget,
 		     gpointer          data)
 {
   GtkColorSelection *colorsel = GTK_COLOR_SELECTION (data);
+  gint length;
   guint16 *vals;
   gdouble color[4];
-  
-  if (selection_data->length < 0)
+
+  length = gtk_selection_data_get_length (selection_data);
+
+  if (length < 0)
     return;
   
   /* We accept drops with the wrong format, since the KDE color
    * chooser incorrectly drops application/x-color with format 8.
    */
-  if (selection_data->length != 8)
+  if (length != 8)
     {
       g_warning ("Received invalid color data\n");
       return;
     }
-  
-  vals = (guint16 *)selection_data->data;
-  
+
+  vals = (guint16 *) gtk_selection_data_get_data (selection_data);
+
   color[0] = (gdouble)vals[0] / 0xffff;
   color[1] = (gdouble)vals[1] / 0xffff;
   color[2] = (gdouble)vals[2] / 0xffff;



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