forked from AuroraMiddleware/gtk
Update all users
This commit is contained in:
parent
a4059cd02d
commit
1c03bbeb9c
@ -792,7 +792,7 @@ gtk_calendar_init (GtkCalendar *calendar)
|
||||
dest = gtk_drop_target_new (formats, GDK_ACTION_COPY);
|
||||
gdk_content_formats_unref (formats);
|
||||
|
||||
g_signal_connect (dest, "drag-motion", G_CALLBACK (gtk_calendar_drag_motion), calendar);
|
||||
g_signal_connect (dest, "accept", G_CALLBACK (gtk_calendar_drag_motion), calendar);
|
||||
g_signal_connect (dest, "drag-leave", G_CALLBACK (gtk_calendar_drag_leave), calendar);
|
||||
g_signal_connect (dest, "drag-drop", G_CALLBACK (gtk_calendar_drag_drop), calendar);
|
||||
|
||||
|
@ -379,7 +379,7 @@ gtk_expander_init (GtkExpander *expander)
|
||||
formats = gdk_content_formats_new (NULL, 0);
|
||||
dest = gtk_drop_target_new (formats, 0);
|
||||
gdk_content_formats_unref (formats);
|
||||
g_signal_connect (dest, "drag-motion", G_CALLBACK (gtk_expander_drag_motion), expander);
|
||||
g_signal_connect (dest, "accept", G_CALLBACK (gtk_expander_drag_motion), expander);
|
||||
g_signal_connect (dest, "drag-leave", G_CALLBACK (gtk_expander_drag_leave), expander);
|
||||
gtk_widget_add_controller (GTK_WIDGET (expander), GTK_EVENT_CONTROLLER (dest));
|
||||
|
||||
|
@ -2052,7 +2052,7 @@ file_list_drag_motion_cb (GtkDropTarget *dest,
|
||||
int y,
|
||||
GtkFileChooserWidget *impl)
|
||||
{
|
||||
g_signal_stop_emission_by_name (dest, "drag-motion");
|
||||
g_signal_stop_emission_by_name (dest, "accept");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -8497,7 +8497,7 @@ post_process_ui (GtkFileChooserWidget *impl)
|
||||
GDK_ACTION_COPY | GDK_ACTION_MOVE);
|
||||
|
||||
dest = gtk_drop_target_new (formats, GDK_ACTION_COPY | GDK_ACTION_MOVE);
|
||||
g_signal_connect (dest, "drag-motion", G_CALLBACK (file_list_drag_motion_cb), impl);
|
||||
g_signal_connect (dest, "accept", G_CALLBACK (file_list_drag_motion_cb), impl);
|
||||
g_signal_connect (dest, "drag-drop", G_CALLBACK (file_list_drag_drop_cb), impl);
|
||||
gtk_widget_add_controller (priv->browse_files_tree_view, GTK_EVENT_CONTROLLER (dest));
|
||||
gdk_content_formats_unref (formats);
|
||||
|
@ -6457,7 +6457,7 @@ gtk_icon_view_enable_model_drag_dest (GtkIconView *icon_view,
|
||||
|
||||
icon_view->priv->dest = gtk_drop_target_new (formats, actions);
|
||||
g_signal_connect (icon_view->priv->dest, "drag-leave", G_CALLBACK (gtk_icon_view_drag_leave), icon_view);
|
||||
g_signal_connect (icon_view->priv->dest, "drag-motion", G_CALLBACK (gtk_icon_view_drag_motion), icon_view);
|
||||
g_signal_connect (icon_view->priv->dest, "accept", G_CALLBACK (gtk_icon_view_drag_motion), icon_view);
|
||||
g_signal_connect (icon_view->priv->dest, "drag-drop", G_CALLBACK (gtk_icon_view_drag_drop), icon_view);
|
||||
gtk_widget_add_controller (GTK_WIDGET (icon_view), GTK_EVENT_CONTROLLER (icon_view->priv->dest));
|
||||
|
||||
|
@ -1349,7 +1349,7 @@ gtk_notebook_init (GtkNotebook *notebook)
|
||||
|
||||
targets = gdk_content_formats_new (dst_notebook_targets, G_N_ELEMENTS (dst_notebook_targets));
|
||||
dest = gtk_drop_target_new (targets, GDK_ACTION_MOVE);
|
||||
g_signal_connect (dest, "drag-motion", G_CALLBACK (gtk_notebook_drag_motion), NULL);
|
||||
g_signal_connect (dest, "accept", G_CALLBACK (gtk_notebook_drag_motion), NULL);
|
||||
g_signal_connect (dest, "drag-leave", G_CALLBACK (gtk_notebook_drag_leave), NULL);
|
||||
g_signal_connect (dest, "drag-drop", G_CALLBACK (gtk_notebook_drag_drop), NULL);
|
||||
gtk_widget_add_controller (GTK_WIDGET (priv->tabs_widget), GTK_EVENT_CONTROLLER (dest));
|
||||
|
@ -4088,7 +4088,7 @@ gtk_places_sidebar_init (GtkPlacesSidebar *sidebar)
|
||||
formats = gdk_content_formats_builder_free_to_formats (builder);
|
||||
dest = gtk_drop_target_new (formats, GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_LINK);
|
||||
gdk_content_formats_unref (formats);
|
||||
g_signal_connect (dest, "drag-motion", G_CALLBACK (drag_motion_callback), sidebar);
|
||||
g_signal_connect (dest, "accept", G_CALLBACK (drag_motion_callback), sidebar);
|
||||
g_signal_connect (dest, "drag-drop", G_CALLBACK (drag_drop_callback), sidebar);
|
||||
g_signal_connect (dest, "drag-leave", G_CALLBACK (drag_leave_callback), sidebar);
|
||||
gtk_widget_add_controller (sidebar->list_box, GTK_EVENT_CONTROLLER (dest));
|
||||
|
@ -121,7 +121,7 @@ gtk_stack_switcher_init (GtkStackSwitcher *switcher)
|
||||
dest = gtk_drop_target_new (formats, 0);
|
||||
gdk_content_formats_unref (formats);
|
||||
g_signal_connect (dest, "drag-leave", G_CALLBACK (gtk_stack_switcher_drag_leave), switcher);
|
||||
g_signal_connect (dest, "drag-motion", G_CALLBACK (gtk_stack_switcher_drag_motion), switcher);
|
||||
g_signal_connect (dest, "accept", G_CALLBACK (gtk_stack_switcher_drag_motion), switcher);
|
||||
gtk_widget_add_controller (GTK_WIDGET (switcher), GTK_EVENT_CONTROLLER (dest));
|
||||
}
|
||||
|
||||
|
@ -1732,7 +1732,7 @@ gtk_text_init (GtkText *self)
|
||||
|
||||
formats = gdk_content_formats_new_for_gtype (G_TYPE_STRING);
|
||||
dest = gtk_drop_target_new (formats, GDK_ACTION_COPY | GDK_ACTION_MOVE);
|
||||
g_signal_connect (dest, "drag-motion", G_CALLBACK (gtk_text_drag_motion), self);
|
||||
g_signal_connect (dest, "accept", G_CALLBACK (gtk_text_drag_motion), self);
|
||||
g_signal_connect (dest, "drag-leave", G_CALLBACK (gtk_text_drag_leave), self);
|
||||
g_signal_connect (dest, "drag-drop", G_CALLBACK (gtk_text_drag_drop), self);
|
||||
gdk_content_formats_unref (formats);
|
||||
|
@ -1638,7 +1638,7 @@ gtk_text_view_init (GtkTextView *text_view)
|
||||
dest = gtk_drop_target_new (formats, GDK_ACTION_COPY | GDK_ACTION_MOVE);
|
||||
gdk_content_formats_unref (formats);
|
||||
g_signal_connect (dest, "drag-leave", G_CALLBACK (gtk_text_view_drag_leave), text_view);
|
||||
g_signal_connect (dest, "drag-motion", G_CALLBACK (gtk_text_view_drag_motion), text_view);
|
||||
g_signal_connect (dest, "accept", G_CALLBACK (gtk_text_view_drag_motion), text_view);
|
||||
g_signal_connect (dest, "drag-drop", G_CALLBACK (gtk_text_view_drag_drop), text_view);
|
||||
gtk_widget_add_controller (GTK_WIDGET (text_view), GTK_EVENT_CONTROLLER (dest));
|
||||
|
||||
|
@ -12924,7 +12924,7 @@ gtk_tree_view_enable_model_drag_dest (GtkTreeView *tree_view,
|
||||
|
||||
di->dest = gtk_drop_target_new (formats, actions);
|
||||
g_signal_connect (di->dest, "drag-leave", G_CALLBACK (gtk_tree_view_drag_leave), tree_view);
|
||||
g_signal_connect (di->dest, "drag-motion", G_CALLBACK (gtk_tree_view_drag_motion), tree_view);
|
||||
g_signal_connect (di->dest, "accept", G_CALLBACK (gtk_tree_view_drag_motion), tree_view);
|
||||
g_signal_connect (di->dest, "drag-drop", G_CALLBACK (gtk_tree_view_drag_drop), tree_view);
|
||||
gtk_widget_add_controller (GTK_WIDGET (tree_view), GTK_EVENT_CONTROLLER (di->dest));
|
||||
g_object_ref (di->dest);
|
||||
|
@ -503,7 +503,7 @@ popup_cb (gpointer data)
|
||||
gtk_grid_attach (GTK_GRID (grid), button, i, j, 1, 1);
|
||||
|
||||
dest = gtk_drop_target_new (targets, GDK_ACTION_COPY | GDK_ACTION_MOVE);
|
||||
g_signal_connect (dest, "drag-motion", G_CALLBACK (popup_motion), NULL);
|
||||
g_signal_connect (dest, "accept", G_CALLBACK (popup_motion), NULL);
|
||||
g_signal_connect (dest, "drag-leave", G_CALLBACK (popup_leave), NULL);
|
||||
gtk_widget_add_controller (button, GTK_EVENT_CONTROLLER (dest));
|
||||
}
|
||||
@ -607,7 +607,7 @@ main (int argc, char **argv)
|
||||
label = gtk_label_new ("Popup\n");
|
||||
|
||||
dest = gtk_drop_target_new (targets, GDK_ACTION_COPY | GDK_ACTION_MOVE);
|
||||
g_signal_connect (dest, "drag-motion", G_CALLBACK (popsite_motion), NULL);
|
||||
g_signal_connect (dest, "accept", G_CALLBACK (popsite_motion), NULL);
|
||||
g_signal_connect (dest, "drag-leave", G_CALLBACK (popsite_leave), NULL);
|
||||
gtk_widget_add_controller (label, GTK_EVENT_CONTROLLER (dest));
|
||||
|
||||
@ -621,7 +621,7 @@ main (int argc, char **argv)
|
||||
targets = gdk_content_formats_new (NULL, 0);
|
||||
dest = gtk_drop_target_new (targets, 0);
|
||||
g_signal_connect (dest, "drag-leave", G_CALLBACK (target_drag_leave), pixmap);
|
||||
g_signal_connect (dest, "drag-motion", G_CALLBACK (target_drag_motion), pixmap);
|
||||
g_signal_connect (dest, "accept", G_CALLBACK (target_drag_motion), pixmap);
|
||||
g_signal_connect (dest, "drag-drop", G_CALLBACK (target_drag_drop), pixmap);
|
||||
gtk_widget_add_controller (pixmap, GTK_EVENT_CONTROLLER (dest));
|
||||
gdk_content_formats_unref (targets);
|
||||
|
@ -160,6 +160,39 @@ ask_actions (GdkDrop *drop,
|
||||
gtk_popover_popup (GTK_POPOVER (popover));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
delayed_deny (gpointer data)
|
||||
{
|
||||
GtkDropTarget *dest = data;
|
||||
GtkWidget *image = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (dest));
|
||||
GdkDrop *drop = GDK_DROP (g_object_get_data (G_OBJECT (image), "drop"));
|
||||
|
||||
if (drop)
|
||||
{
|
||||
g_print ("denying drop, late\n");
|
||||
gtk_drop_target_deny_drop (dest, drop);
|
||||
}
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
image_drag_motion (GtkDropTarget *dest,
|
||||
GdkDrop *drop,
|
||||
int x,
|
||||
int y,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *image = data;
|
||||
g_object_set_data_full (G_OBJECT (image), "drop", g_object_ref (drop), g_object_unref);
|
||||
|
||||
g_timeout_add (1000, delayed_deny, dest);
|
||||
|
||||
gdk_drop_status (drop, gtk_drop_target_get_actions (dest));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
image_drag_drop (GtkDropTarget *dest,
|
||||
GdkDrop *drop,
|
||||
@ -312,6 +345,7 @@ make_image (const gchar *icon_name, int hotspot)
|
||||
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (source));
|
||||
|
||||
dest = gtk_drop_target_new (formats, GDK_ACTION_COPY|GDK_ACTION_MOVE|GDK_ACTION_ASK);
|
||||
g_signal_connect (dest, "accept", G_CALLBACK (image_drag_motion), image);
|
||||
g_signal_connect (dest, "drag-drop", G_CALLBACK (image_drag_drop), image);
|
||||
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (dest));
|
||||
|
||||
|
@ -306,7 +306,7 @@ canvas_item_new (int i,
|
||||
formats = gdk_content_formats_new_for_gtype (GDK_TYPE_RGBA);
|
||||
dest = gtk_drop_target_new (formats, GDK_ACTION_COPY);
|
||||
g_signal_connect (dest, "drag-drop", G_CALLBACK (item_drag_drop), NULL);
|
||||
g_signal_connect (dest, "drag-motion", G_CALLBACK (item_drag_motion), NULL);
|
||||
g_signal_connect (dest, "accept", G_CALLBACK (item_drag_motion), NULL);
|
||||
gtk_widget_add_controller (widget, GTK_EVENT_CONTROLLER (dest));
|
||||
gdk_content_formats_unref (formats);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user