mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-09 18:30:08 +00:00
drop: Move gdk_drop_read_async() to GdkDrop class
This commit is contained in:
parent
f247d268d4
commit
6919d8c532
103
gdk/gdkdnd.c
103
gdk/gdkdnd.c
@ -372,40 +372,6 @@ gdk_drag_context_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (gdk_drag_context_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_drag_context_read_local_async (GdkDragContext *context,
|
||||
GdkContentFormats *formats,
|
||||
int io_priority,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GTask *task;
|
||||
|
||||
task = g_task_new (context, cancellable, callback, user_data);
|
||||
g_task_set_priority (task, io_priority);
|
||||
g_task_set_source_tag (task, gdk_drag_context_read_local_async);
|
||||
|
||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
|
||||
_("Reading not implemented."));
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
static GInputStream *
|
||||
gdk_drag_context_read_local_finish (GdkDragContext *context,
|
||||
const char **out_mime_type,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
{
|
||||
g_return_val_if_fail (g_task_is_valid (result, context), NULL);
|
||||
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gdk_drag_context_read_local_async, NULL);
|
||||
|
||||
if (out_mime_type)
|
||||
*out_mime_type = g_task_get_task_data (G_TASK (result));
|
||||
|
||||
return g_task_propagate_pointer (G_TASK (result), error);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_drag_context_class_init (GdkDragContextClass *klass)
|
||||
{
|
||||
@ -742,75 +708,6 @@ gdk_drag_context_write_finish (GdkDragContext *context,
|
||||
return g_task_propagate_boolean (G_TASK (result), error);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drop_read_async:
|
||||
* @context: a #GdkDragContext
|
||||
* @mime_types: (array zero-terminated=1) (element-type utf8): pointer to an array of mime types
|
||||
* @io_priority: the io priority for the read operation
|
||||
* @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore
|
||||
* @callback: (scope async): a #GAsyncReadyCallback to call when the request is satisfied
|
||||
* @user_data: (closure): the data to pass to @callback
|
||||
*
|
||||
* Asynchronously read the dropped data from a DND context
|
||||
* in a format that complies with one of the mime types.
|
||||
*/
|
||||
void
|
||||
gdk_drop_read_async (GdkDragContext *context,
|
||||
const char **mime_types,
|
||||
int io_priority,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GdkContentFormats *formats;
|
||||
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (mime_types != NULL && mime_types[0] != NULL);
|
||||
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
formats = gdk_content_formats_new (mime_types, g_strv_length ((char **) mime_types));
|
||||
|
||||
GDK_DRAG_CONTEXT_GET_CLASS (context)->read_async (context,
|
||||
formats,
|
||||
io_priority,
|
||||
cancellable,
|
||||
callback,
|
||||
user_data);
|
||||
|
||||
gdk_content_formats_unref (formats);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drop_read_finish:
|
||||
* @context: a #GdkDragContext
|
||||
* @out_mime_type: (out) (type utf8): return location for the used mime type
|
||||
* @result: a #GAsyncResult
|
||||
* @error: (allow-none): location to store error information on failure, or %NULL
|
||||
*
|
||||
* Finishes an async drop read operation, see gdk_drop_read_async().
|
||||
*
|
||||
* Returns: (nullable) (transfer full): the #GInputStream, or %NULL
|
||||
*/
|
||||
GInputStream *
|
||||
gdk_drop_read_finish (GdkDragContext *context,
|
||||
const char **out_mime_type,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||
|
||||
if (g_async_result_is_tagged (result, gdk_drag_context_read_local_async))
|
||||
{
|
||||
return gdk_drag_context_read_local_finish (context, out_mime_type, result, error);
|
||||
}
|
||||
else
|
||||
{
|
||||
return GDK_DRAG_CONTEXT_GET_CLASS (context)->read_finish (context, out_mime_type, result, error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drag_context_get_drag_surface:
|
||||
* @context: a #GdkDragContext
|
||||
|
13
gdk/gdkdnd.h
13
gdk/gdkdnd.h
@ -112,19 +112,6 @@ void gdk_drop_finish (GdkDragContext *context,
|
||||
gboolean success,
|
||||
guint32 time_);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_drop_read_async (GdkDragContext *context,
|
||||
const char **mime_types,
|
||||
int io_priority,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GInputStream * gdk_drop_read_finish (GdkDragContext *context,
|
||||
const char **out_mime_type,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
/* Source side */
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
@ -45,16 +45,6 @@ struct _GdkDragContextClass {
|
||||
void (*drop_finish) (GdkDragContext *context,
|
||||
gboolean success,
|
||||
guint32 time_);
|
||||
void (* read_async) (GdkDragContext *context,
|
||||
GdkContentFormats *formats,
|
||||
int io_priority,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
GInputStream * (* read_finish) (GdkDragContext *context,
|
||||
const char **out_mime_type,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
GdkSurface* (*get_drag_surface) (GdkDragContext *context);
|
||||
void (*set_hotspot) (GdkDragContext *context,
|
||||
gint hot_x,
|
||||
|
108
gdk/gdkdrop.c
108
gdk/gdkdrop.c
@ -57,8 +57,37 @@ G_DEFINE_TYPE_WITH_PRIVATE (GdkDrop, gdk_drop, G_TYPE_OBJECT)
|
||||
*/
|
||||
|
||||
static void
|
||||
gdk_drop_init (GdkDrop *self)
|
||||
gdk_drop_read_local_async (GdkDrop *self,
|
||||
GdkContentFormats *formats,
|
||||
int io_priority,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GTask *task;
|
||||
|
||||
task = g_task_new (self, cancellable, callback, user_data);
|
||||
g_task_set_priority (task, io_priority);
|
||||
g_task_set_source_tag (task, gdk_drop_read_local_async);
|
||||
|
||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
|
||||
_("Reading not implemented."));
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
static GInputStream *
|
||||
gdk_drop_read_local_finish (GdkDrop *self,
|
||||
const char **out_mime_type,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
{
|
||||
g_return_val_if_fail (g_task_is_valid (result, self), NULL);
|
||||
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gdk_drop_read_local_async, NULL);
|
||||
|
||||
if (out_mime_type)
|
||||
*out_mime_type = g_task_get_task_data (G_TASK (result));
|
||||
|
||||
return g_task_propagate_pointer (G_TASK (result), error);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -185,6 +214,11 @@ gdk_drop_class_init (GdkDropClass *klass)
|
||||
g_object_class_install_properties (object_class, N_PROPERTIES, properties);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_drop_init (GdkDrop *self)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drop_get_display:
|
||||
* @self: a #GdkDrop
|
||||
@ -240,3 +274,75 @@ gdk_drop_get_formats (GdkDrop *self)
|
||||
return priv->formats;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drop_read_async:
|
||||
* @self: a #GdkDrop
|
||||
* @mime_types: (array zero-terminated=1) (element-type utf8):
|
||||
* pointer to an array of mime types
|
||||
* @io_priority: the io priority for the read operation
|
||||
* @cancellable: (allow-none): optional #GCancellable object,
|
||||
* %NULL to ignore
|
||||
* @callback: (scope async): a #GAsyncReadyCallback to call when
|
||||
* the request is satisfied
|
||||
* @user_data: (closure): the data to pass to @callback
|
||||
*
|
||||
* Asynchronously read the dropped data from a #GdkDrop
|
||||
* in a format that complies with one of the mime types.
|
||||
*/
|
||||
void
|
||||
gdk_drop_read_async (GdkDrop *self,
|
||||
const char **mime_types,
|
||||
int io_priority,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GdkContentFormats *formats;
|
||||
|
||||
g_return_if_fail (GDK_IS_DROP (self));
|
||||
g_return_if_fail (mime_types != NULL && mime_types[0] != NULL);
|
||||
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
formats = gdk_content_formats_new (mime_types, g_strv_length ((char **) mime_types));
|
||||
|
||||
GDK_DROP_GET_CLASS (self)->read_async (self,
|
||||
formats,
|
||||
io_priority,
|
||||
cancellable,
|
||||
callback,
|
||||
user_data);
|
||||
|
||||
gdk_content_formats_unref (formats);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drop_read_finish:
|
||||
* @self: a #GdkDrop
|
||||
* @out_mime_type: (out) (type utf8): return location for the used mime type
|
||||
* @result: a #GAsyncResult
|
||||
* @error: (allow-none): location to store error information on failure, or %NULL
|
||||
*
|
||||
* Finishes an async drop read operation, see gdk_drop_read_async().
|
||||
*
|
||||
* Returns: (nullable) (transfer full): the #GInputStream, or %NULL
|
||||
*/
|
||||
GInputStream *
|
||||
gdk_drop_read_finish (GdkDrop *self,
|
||||
const char **out_mime_type,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DROP (self), NULL);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||
|
||||
if (g_async_result_is_tagged (result, gdk_drop_read_local_async))
|
||||
{
|
||||
return gdk_drop_read_local_finish (self, out_mime_type, result, error);
|
||||
}
|
||||
else
|
||||
{
|
||||
return GDK_DROP_GET_CLASS (self)->read_finish (self, out_mime_type, result, error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,6 +46,19 @@ GdkDevice * gdk_drop_get_device (GdkDrop
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkContentFormats * gdk_drop_get_formats (GdkDrop *self);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_drop_read_async (GdkDrop *self,
|
||||
const char **mime_types,
|
||||
int io_priority,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GInputStream * gdk_drop_read_finish (GdkDrop *self,
|
||||
const char **out_mime_type,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_DROP_H__ */
|
||||
|
@ -38,6 +38,17 @@ struct _GdkDrop {
|
||||
|
||||
struct _GdkDropClass {
|
||||
GObjectClass parent_class;
|
||||
|
||||
void (* read_async) (GdkDrop *self,
|
||||
GdkContentFormats *formats,
|
||||
int io_priority,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
GInputStream * (* read_finish) (GdkDrop *self,
|
||||
const char **out_mime_type,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
};
|
||||
|
||||
|
||||
|
@ -253,14 +253,14 @@ gdk_wayland_drag_context_drop_finish (GdkDragContext *context,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_context_read_async (GdkDragContext *context,
|
||||
gdk_wayland_drag_context_read_async (GdkDrop *drop,
|
||||
GdkContentFormats *formats,
|
||||
int io_priority,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GdkWaylandDragContext *wayland_context = GDK_WAYLAND_DRAG_CONTEXT (context);
|
||||
GdkWaylandDragContext *wayland_context = GDK_WAYLAND_DRAG_CONTEXT (drop);
|
||||
GdkDisplay *display;
|
||||
GInputStream *stream;
|
||||
const char *mime_type;
|
||||
@ -268,16 +268,16 @@ gdk_wayland_drag_context_read_async (GdkDragContext *context,
|
||||
GError *error = NULL;
|
||||
GTask *task;
|
||||
|
||||
display = gdk_drag_context_get_display (context),
|
||||
task = g_task_new (context, cancellable, callback, user_data);
|
||||
display = gdk_drop_get_display (drop),
|
||||
task = g_task_new (drop, cancellable, callback, user_data);
|
||||
g_task_set_priority (task, io_priority);
|
||||
g_task_set_source_tag (task, gdk_wayland_drag_context_read_async);
|
||||
|
||||
GDK_DISPLAY_NOTE (display, DND, char *s = gdk_content_formats_to_string (formats);
|
||||
g_message ("%p: read for %s", context, s);
|
||||
g_message ("%p: read for %s", drop, s);
|
||||
g_free (s); );
|
||||
mime_type = gdk_content_formats_match_mime_type (formats,
|
||||
gdk_drag_context_get_formats (context));
|
||||
gdk_drop_get_formats (drop));
|
||||
if (mime_type == NULL)
|
||||
{
|
||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
|
||||
@ -300,14 +300,14 @@ gdk_wayland_drag_context_read_async (GdkDragContext *context,
|
||||
}
|
||||
|
||||
static GInputStream *
|
||||
gdk_wayland_drag_context_read_finish (GdkDragContext *context,
|
||||
gdk_wayland_drag_context_read_finish (GdkDrop *drop,
|
||||
const char **out_mime_type,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
{
|
||||
GTask *task;
|
||||
|
||||
g_return_val_if_fail (g_task_is_valid (result, G_OBJECT (context)), NULL);
|
||||
g_return_val_if_fail (g_task_is_valid (result, G_OBJECT (drop)), NULL);
|
||||
task = G_TASK (result);
|
||||
g_return_val_if_fail (g_task_get_source_tag (task) == gdk_wayland_drag_context_read_async, NULL);
|
||||
|
||||
@ -407,17 +407,19 @@ static void
|
||||
gdk_wayland_drag_context_class_init (GdkWaylandDragContextClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GdkDropClass *drop_class = GDK_DROP_CLASS (klass);
|
||||
GdkDragContextClass *context_class = GDK_DRAG_CONTEXT_CLASS (klass);
|
||||
|
||||
object_class->finalize = gdk_wayland_drag_context_finalize;
|
||||
|
||||
drop_class->read_async = gdk_wayland_drag_context_read_async;
|
||||
drop_class->read_finish = gdk_wayland_drag_context_read_finish;
|
||||
|
||||
context_class->drag_status = gdk_wayland_drag_context_drag_status;
|
||||
context_class->drag_abort = gdk_wayland_drag_context_drag_abort;
|
||||
context_class->drag_drop = gdk_wayland_drag_context_drag_drop;
|
||||
context_class->drop_finish = gdk_wayland_drag_context_drop_finish;
|
||||
context_class->drop_finish = gdk_wayland_drag_context_drop_finish;
|
||||
context_class->read_async = gdk_wayland_drag_context_read_async;
|
||||
context_class->read_finish = gdk_wayland_drag_context_read_finish;
|
||||
context_class->get_drag_surface = gdk_wayland_drag_context_get_drag_surface;
|
||||
context_class->set_hotspot = gdk_wayland_drag_context_set_hotspot;
|
||||
context_class->drop_done = gdk_wayland_drag_context_drop_done;
|
||||
|
@ -1052,14 +1052,14 @@ grab_data_from_hdata (GTask *task,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_drop_context_read_async (GdkDragContext *context,
|
||||
gdk_win32_drop_context_read_async (GdkDrop *drop,
|
||||
GdkContentFormats *formats,
|
||||
int io_priority,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GdkWin32DropContext *context_win32 = GDK_WIN32_DROP_CONTEXT (context);
|
||||
GdkWin32DropContext *context_win32 = GDK_WIN32_DROP_CONTEXT (drop);
|
||||
GTask *task;
|
||||
target_drag_context *tctx;
|
||||
const char * const *mime_types;
|
||||
@ -1072,16 +1072,16 @@ gdk_win32_drop_context_read_async (GdkDragContext *context,
|
||||
gsize data_len;
|
||||
GInputStream *stream;
|
||||
|
||||
task = g_task_new (context, cancellable, callback, user_data);
|
||||
task = g_task_new (drop, cancellable, callback, user_data);
|
||||
g_task_set_priority (task, io_priority);
|
||||
g_task_set_source_tag (task, gdk_win32_drop_context_read_async);
|
||||
|
||||
tctx = find_droptarget_for_target_context (context);
|
||||
tctx = find_droptarget_for_target_context (GDK_DRAG_CONTEXT (drop));
|
||||
|
||||
if (tctx == NULL)
|
||||
{
|
||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
_("Failed to find target context record for context 0x%p"), context);
|
||||
_("Failed to find target context record for context 0x%p"), drop);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1170,15 +1170,15 @@ gdk_win32_drop_context_read_async (GdkDragContext *context,
|
||||
}
|
||||
|
||||
static GInputStream *
|
||||
gdk_win32_drop_context_read_finish (GdkDragContext *context,
|
||||
const char **out_mime_type,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
gdk_win32_drop_context_read_finish (GdkDrop *drop,
|
||||
const char **out_mime_type,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
{
|
||||
GTask *task;
|
||||
GInputStream *stream;
|
||||
|
||||
g_return_val_if_fail (g_task_is_valid (result, G_OBJECT (context)), NULL);
|
||||
g_return_val_if_fail (g_task_is_valid (result, G_OBJECT (drop)), NULL);
|
||||
task = G_TASK (result);
|
||||
g_return_val_if_fail (g_task_get_source_tag (task) == gdk_win32_drop_context_read_async, NULL);
|
||||
|
||||
@ -1194,14 +1194,16 @@ static void
|
||||
gdk_win32_drop_context_class_init (GdkWin32DropContextClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GdkDropClass *drop_class = GDK_DROP_CLASS (klass);
|
||||
GdkDragContextClass *context_class = GDK_DRAG_CONTEXT_CLASS (klass);
|
||||
|
||||
object_class->finalize = gdk_win32_drop_context_finalize;
|
||||
|
||||
drop_class->read_async = gdk_win32_drop_context_read_async;
|
||||
drop_class->read_finish = gdk_win32_drop_context_read_finish;
|
||||
|
||||
context_class->drag_status = gdk_win32_drop_context_drag_status;
|
||||
context_class->drop_finish = gdk_win32_drop_context_drop_finish;
|
||||
context_class->read_async = gdk_win32_drop_context_read_async;
|
||||
context_class->read_finish = gdk_win32_drop_context_read_finish;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -279,13 +279,13 @@ gdk_x11_drag_context_read_got_stream (GObject *source,
|
||||
next = targets->next;
|
||||
if (next)
|
||||
{
|
||||
GdkDragContext *context = GDK_DRAG_CONTEXT (g_task_get_source_object (task));
|
||||
GdkDrop *drop = GDK_DROP (g_task_get_source_object (task));
|
||||
|
||||
GDK_DISPLAY_NOTE (gdk_drag_context_get_display (context), DND, g_printerr ("reading %s failed, trying %s next\n",
|
||||
GDK_DISPLAY_NOTE (gdk_drop_get_display (drop), DND, g_printerr ("reading %s failed, trying %s next\n",
|
||||
(char *) targets->data, (char *) next->data));
|
||||
targets->next = NULL;
|
||||
g_task_set_task_data (task, next, (GDestroyNotify) g_slist_free);
|
||||
gdk_x11_selection_input_stream_new_async (gdk_drag_context_get_display (context),
|
||||
gdk_x11_selection_input_stream_new_async (gdk_drop_get_display (drop),
|
||||
"XdndSelection",
|
||||
next->data,
|
||||
CurrentTime,
|
||||
@ -330,7 +330,7 @@ gdk_x11_drag_context_read_got_stream (GObject *source,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_drag_context_read_async (GdkDragContext *context,
|
||||
gdk_x11_drag_context_read_async (GdkDrop *drop,
|
||||
GdkContentFormats *formats,
|
||||
int io_priority,
|
||||
GCancellable *cancellable,
|
||||
@ -340,7 +340,7 @@ gdk_x11_drag_context_read_async (GdkDragContext *context,
|
||||
GSList *targets;
|
||||
GTask *task;
|
||||
|
||||
task = g_task_new (context, cancellable, callback, user_data);
|
||||
task = g_task_new (drop, cancellable, callback, user_data);
|
||||
g_task_set_priority (task, io_priority);
|
||||
g_task_set_source_tag (task, gdk_x11_drag_context_read_async);
|
||||
|
||||
@ -353,9 +353,9 @@ gdk_x11_drag_context_read_async (GdkDragContext *context,
|
||||
return;
|
||||
}
|
||||
|
||||
GDK_DISPLAY_NOTE (gdk_drag_context_get_display (context), DND, g_printerr ("new read for %s (%u other options)\n",
|
||||
GDK_DISPLAY_NOTE (gdk_drop_get_display (drop), DND, g_printerr ("new read for %s (%u other options)\n",
|
||||
(char *) targets->data, g_slist_length (targets->next)));
|
||||
gdk_x11_selection_input_stream_new_async (gdk_drag_context_get_display (context),
|
||||
gdk_x11_selection_input_stream_new_async (gdk_drop_get_display (drop),
|
||||
"XdndSelection",
|
||||
targets->data,
|
||||
CurrentTime,
|
||||
@ -366,14 +366,14 @@ gdk_x11_drag_context_read_async (GdkDragContext *context,
|
||||
}
|
||||
|
||||
static GInputStream *
|
||||
gdk_x11_drag_context_read_finish (GdkDragContext *context,
|
||||
gdk_x11_drag_context_read_finish (GdkDrop *drop,
|
||||
const char **out_mime_type,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
{
|
||||
GTask *task;
|
||||
|
||||
g_return_val_if_fail (g_task_is_valid (result, G_OBJECT (context)), NULL);
|
||||
g_return_val_if_fail (g_task_is_valid (result, G_OBJECT (drop)), NULL);
|
||||
task = G_TASK (result);
|
||||
g_return_val_if_fail (g_task_get_source_tag (task) == gdk_x11_drag_context_read_async, NULL);
|
||||
|
||||
@ -392,16 +392,18 @@ static void
|
||||
gdk_x11_drag_context_class_init (GdkX11DragContextClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GdkDropClass *drop_class = GDK_DROP_CLASS (klass);
|
||||
GdkDragContextClass *context_class = GDK_DRAG_CONTEXT_CLASS (klass);
|
||||
|
||||
object_class->finalize = gdk_x11_drag_context_finalize;
|
||||
|
||||
drop_class->read_async = gdk_x11_drag_context_read_async;
|
||||
drop_class->read_finish = gdk_x11_drag_context_read_finish;
|
||||
|
||||
context_class->drag_status = gdk_x11_drag_context_drag_status;
|
||||
context_class->drag_abort = gdk_x11_drag_context_drag_abort;
|
||||
context_class->drag_drop = gdk_x11_drag_context_drag_drop;
|
||||
context_class->drop_finish = gdk_x11_drag_context_drop_finish;
|
||||
context_class->read_async = gdk_x11_drag_context_read_async;
|
||||
context_class->read_finish = gdk_x11_drag_context_read_finish;
|
||||
context_class->get_drag_surface = gdk_x11_drag_context_get_drag_surface;
|
||||
context_class->set_hotspot = gdk_x11_drag_context_set_hotspot;
|
||||
context_class->drop_done = gdk_x11_drag_context_drop_done;
|
||||
|
@ -241,7 +241,7 @@ gtk_drag_get_data_got_stream (GObject *source,
|
||||
GInputStream *input_stream;
|
||||
GOutputStream *output_stream;
|
||||
|
||||
input_stream = gdk_drop_read_finish (GDK_DRAG_CONTEXT (source), &data->mime_type, result, NULL);
|
||||
input_stream = gdk_drop_read_finish (GDK_DROP (source), &data->mime_type, result, NULL);
|
||||
if (input_stream == NULL)
|
||||
{
|
||||
gtk_drag_get_data_finish (data, NULL, 0);
|
||||
@ -297,7 +297,7 @@ gtk_drag_get_data (GtkWidget *widget,
|
||||
data->mime_type = target;
|
||||
data->time = time_;
|
||||
|
||||
gdk_drop_read_async (context,
|
||||
gdk_drop_read_async (GDK_DROP (context),
|
||||
(const gchar *[2]) { target, NULL },
|
||||
G_PRIORITY_DEFAULT,
|
||||
NULL,
|
||||
|
Loading…
Reference in New Issue
Block a user