gtk/gtktextbuffer: Use accessor functions to access GtkSelectionData

This commit is contained in:
Javier Jardón 2010-12-15 23:53:00 +00:00
parent 2b7afcdd79
commit 1ceddae7da

View File

@ -3156,7 +3156,7 @@ clipboard_get_selection_cb (GtkClipboard *clipboard,
* used within-process * used within-process
*/ */
gtk_selection_data_set (selection_data, gtk_selection_data_set (selection_data,
selection_data->target, gtk_selection_data_get_target (selection_data),
8, /* bytes */ 8, /* bytes */
(void*)&buffer, (void*)&buffer,
sizeof (buffer)); sizeof (buffer));
@ -3167,11 +3167,11 @@ clipboard_get_selection_cb (GtkClipboard *clipboard,
gsize len; gsize len;
str = gtk_text_buffer_serialize (buffer, buffer, str = gtk_text_buffer_serialize (buffer, buffer,
selection_data->target, gtk_selection_data_get_target (selection_data),
&start, &end, &len); &start, &end, &len);
gtk_selection_data_set (selection_data, gtk_selection_data_set (selection_data,
selection_data->target, gtk_selection_data_get_target (selection_data),
8, /* bytes */ 8, /* bytes */
str, len); str, len);
g_free (str); g_free (str);
@ -3226,7 +3226,7 @@ clipboard_get_contents_cb (GtkClipboard *clipboard,
* be used within-process. OK to supply a NULL value for contents. * be used within-process. OK to supply a NULL value for contents.
*/ */
gtk_selection_data_set (selection_data, gtk_selection_data_set (selection_data,
selection_data->target, gtk_selection_data_get_target (selection_data),
8, /* bytes */ 8, /* bytes */
(void*)&contents, (void*)&contents,
sizeof (contents)); sizeof (contents));
@ -3244,11 +3244,11 @@ clipboard_get_contents_cb (GtkClipboard *clipboard,
gtk_text_buffer_get_bounds (contents, &start, &end); gtk_text_buffer_get_bounds (contents, &start, &end);
str = gtk_text_buffer_serialize (clipboard_source_buffer, contents, str = gtk_text_buffer_serialize (clipboard_source_buffer, contents,
selection_data->target, gtk_selection_data_get_target (selection_data),
&start, &end, &len); &start, &end, &len);
gtk_selection_data_set (selection_data, gtk_selection_data_set (selection_data,
selection_data->target, gtk_selection_data_get_target (selection_data),
8, /* bytes */ 8, /* bytes */
str, len); str, len);
g_free (str); g_free (str);
@ -3404,23 +3404,22 @@ selection_data_get_buffer (GtkSelectionData *selection_data,
GtkTextBuffer *src_buffer = NULL; GtkTextBuffer *src_buffer = NULL;
/* If we can get the owner, the selection is in-process */ /* If we can get the owner, the selection is in-process */
owner = gdk_selection_owner_get_for_display (selection_data->display, owner = gdk_selection_owner_get_for_display (gtk_selection_data_get_display (selection_data),
selection_data->selection); gtk_selection_data_get_selection (selection_data));
if (owner == NULL) if (owner == NULL)
return NULL; return NULL;
if (gdk_window_get_window_type (owner) == GDK_WINDOW_FOREIGN) if (gdk_window_get_window_type (owner) == GDK_WINDOW_FOREIGN)
return NULL; return NULL;
if (selection_data->type != if (gtk_selection_data_get_data_type (selection_data) != gdk_atom_intern_static_string ("GTK_TEXT_BUFFER_CONTENTS"))
gdk_atom_intern_static_string ("GTK_TEXT_BUFFER_CONTENTS"))
return NULL; return NULL;
if (selection_data->length != sizeof (src_buffer)) if (gtk_selection_data_get_length (selection_data) != sizeof (src_buffer))
return NULL; return NULL;
memcpy (&src_buffer, selection_data->data, sizeof (src_buffer)); memcpy (&src_buffer, gtk_selection_data_get_data (selection_data), sizeof (src_buffer));
if (src_buffer == NULL) if (src_buffer == NULL)
return NULL; return NULL;