Don't use inout ints in the drag-action-requested signal
It's not friendly to bindings, and we didn't need an inout parameter anyway. We use a simple return value from the signal handler now. Signed-off-by: Federico Mena Quintero <federico@gnome.org>
This commit is contained in:
parent
bc38811645
commit
63b9598b51
@ -127,3 +127,4 @@ VOID:POINTER,POINTER,POINTER,POINTER,STRING
|
|||||||
VOID:OBJECT,STRING,POINTER,POINTER
|
VOID:OBJECT,STRING,POINTER,POINTER
|
||||||
INT:INT
|
INT:INT
|
||||||
VOID:POINTER,STRING,INT
|
VOID:POINTER,STRING,INT
|
||||||
|
INT:OBJECT,OBJECT,POINTER
|
||||||
|
@ -158,11 +158,10 @@ struct _GtkPlacesSidebarClass {
|
|||||||
void (* show_error_message) (GtkPlacesSidebar *sidebar,
|
void (* show_error_message) (GtkPlacesSidebar *sidebar,
|
||||||
const char *primary,
|
const char *primary,
|
||||||
const char *secondary);
|
const char *secondary);
|
||||||
void (* drag_action_requested) (GtkPlacesSidebar *sidebar,
|
GdkDragAction (* drag_action_requested) (GtkPlacesSidebar *sidebar,
|
||||||
GdkDragContext *context,
|
GdkDragContext *context,
|
||||||
GFile *dest_file,
|
GFile *dest_file,
|
||||||
GList *source_file_list,
|
GList *source_file_list);
|
||||||
int *action);
|
|
||||||
GdkDragAction (* drag_action_ask) (GtkPlacesSidebar *sidebar,
|
GdkDragAction (* drag_action_ask) (GtkPlacesSidebar *sidebar,
|
||||||
GdkDragAction actions);
|
GdkDragAction actions);
|
||||||
void (* drag_perform_drop) (GtkPlacesSidebar *sidebar,
|
void (* drag_perform_drop) (GtkPlacesSidebar *sidebar,
|
||||||
@ -326,18 +325,23 @@ emit_show_error_message (GtkPlacesSidebar *sidebar, const char *primary, const c
|
|||||||
primary, secondary);
|
primary, secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static GdkDragAction
|
||||||
emit_drag_action_requested (GtkPlacesSidebar *sidebar,
|
emit_drag_action_requested (GtkPlacesSidebar *sidebar,
|
||||||
GdkDragContext *context,
|
GdkDragContext *context,
|
||||||
GFile *dest_file,
|
GFile *dest_file,
|
||||||
GList *source_file_list,
|
GList *source_file_list)
|
||||||
int *action)
|
|
||||||
{
|
{
|
||||||
|
GdkDragAction ret_action;
|
||||||
|
|
||||||
|
ret_action = 0;
|
||||||
|
|
||||||
g_signal_emit (sidebar, places_sidebar_signals[DRAG_ACTION_REQUESTED], 0,
|
g_signal_emit (sidebar, places_sidebar_signals[DRAG_ACTION_REQUESTED], 0,
|
||||||
context,
|
context,
|
||||||
dest_file,
|
dest_file,
|
||||||
source_file_list,
|
source_file_list,
|
||||||
action);
|
&ret_action);
|
||||||
|
|
||||||
|
return ret_action;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GdkDragAction
|
static GdkDragAction
|
||||||
@ -1455,7 +1459,7 @@ drag_motion_callback (GtkTreeView *tree_view,
|
|||||||
if (uri != NULL) {
|
if (uri != NULL) {
|
||||||
GFile *dest_file = g_file_new_for_uri (uri);
|
GFile *dest_file = g_file_new_for_uri (uri);
|
||||||
|
|
||||||
emit_drag_action_requested (sidebar, context, dest_file, sidebar->drag_list, &action);
|
action = emit_drag_action_requested (sidebar, context, dest_file, sidebar->drag_list);
|
||||||
|
|
||||||
g_object_unref (dest_file);
|
g_object_unref (dest_file);
|
||||||
g_free (uri);
|
g_free (uri);
|
||||||
@ -3802,7 +3806,6 @@ gtk_places_sidebar_class_init (GtkPlacesSidebarClass *class)
|
|||||||
* @context: #GdkDragContext with information about the drag operation
|
* @context: #GdkDragContext with information about the drag operation
|
||||||
* @dest_file: #GFile with the tentative location that is being hovered for a drop
|
* @dest_file: #GFile with the tentative location that is being hovered for a drop
|
||||||
* @source_file_list: (element-type GFile) (transfer none): List of #GFile that are being dragged
|
* @source_file_list: (element-type GFile) (transfer none): List of #GFile that are being dragged
|
||||||
* @action: Location in which to store the drag action here
|
|
||||||
*
|
*
|
||||||
* When the user starts a drag-and-drop operation and the sidebar needs
|
* When the user starts a drag-and-drop operation and the sidebar needs
|
||||||
* to ask the application for which drag action to perform, then the
|
* to ask the application for which drag action to perform, then the
|
||||||
@ -3811,19 +3814,26 @@ gtk_places_sidebar_class_init (GtkPlacesSidebarClass *class)
|
|||||||
* The application can evaluate the @context for customary actions, or
|
* The application can evaluate the @context for customary actions, or
|
||||||
* it can check the type of the files indicated by @source_file_list against the
|
* it can check the type of the files indicated by @source_file_list against the
|
||||||
* possible actions for the destination @dest_file.
|
* possible actions for the destination @dest_file.
|
||||||
|
*
|
||||||
|
* The drag action to use must be the return value of the signal handler.
|
||||||
|
*
|
||||||
|
* Return value: The drag action to use, for example, #GDK_ACTION_COPY
|
||||||
|
* or #GDK_ACTION_MOVE, or 0 if no action is allowed here (i.e. drops
|
||||||
|
* are not allowed in the specified @dest_file).
|
||||||
|
*
|
||||||
|
* Since: 3.8
|
||||||
*/
|
*/
|
||||||
places_sidebar_signals [DRAG_ACTION_REQUESTED] =
|
places_sidebar_signals [DRAG_ACTION_REQUESTED] =
|
||||||
g_signal_new (I_("drag-action-requested"),
|
g_signal_new (I_("drag-action-requested"),
|
||||||
G_OBJECT_CLASS_TYPE (gobject_class),
|
G_OBJECT_CLASS_TYPE (gobject_class),
|
||||||
G_SIGNAL_RUN_FIRST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (GtkPlacesSidebarClass, drag_action_requested),
|
G_STRUCT_OFFSET (GtkPlacesSidebarClass, drag_action_requested),
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
_gtk_marshal_VOID__OBJECT_OBJECT_POINTER_POINTER,
|
_gtk_marshal_INT__OBJECT_OBJECT_POINTER,
|
||||||
G_TYPE_NONE, 4,
|
G_TYPE_INT, 3,
|
||||||
GDK_TYPE_DRAG_CONTEXT,
|
GDK_TYPE_DRAG_CONTEXT,
|
||||||
G_TYPE_OBJECT,
|
G_TYPE_OBJECT,
|
||||||
G_TYPE_POINTER, /* GList of GFile */
|
G_TYPE_POINTER /* GList of GFile */ );
|
||||||
G_TYPE_POINTER /* FIXME: (inout int) is there something friendlier to language bindings? */);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkPlacesSidebar::drag-action-ask:
|
* GtkPlacesSidebar::drag-action-ask:
|
||||||
|
Loading…
Reference in New Issue
Block a user