- screen = gdk_window_get_screen (gdk_drag_context_get_source_window (context));
- g_return_if_fail (screen != NULL);
-
- settings = gtk_settings_get_for_screen (screen);
- if (gtk_icon_size_lookup_for_settings (settings,
- GTK_ICON_SIZE_DND,
- &width, &height))
- icon_size = MAX (width, height);
- else
- icon_size = 32; /* default value for GTK_ICON_SIZE_DND */
-
- icon_theme = gtk_icon_theme_get_for_screen (screen);
-
- pixbuf = gtk_icon_theme_load_icon (icon_theme, icon_name,
- icon_size, 0, NULL);
- if (pixbuf)
- set_icon_stock_pixbuf (context, NULL, pixbuf, hot_x, hot_y, FALSE);
- else
- g_warning ("Cannot load drag icon from icon name %s", icon_name);
+ icon = _gtk_icon_helper_new ();
+ _gtk_icon_helper_set_icon_name (icon, icon_name, GTK_ICON_SIZE_DND);
+ set_icon_helper (context, icon, hot_x, hot_y, FALSE);
+
+ g_object_unref (icon);
+}
+
+/**
+ * gtk_drag_set_icon_gicon: (method)
+ * @context: the context for a drag. (This must be called
+ * with a context for the source side of a drag)
+ * @icon: a #GIcon
+ * @hot_x: the X offset of the hotspot within the icon
+ * @hot_y: the Y offset of the hotspot within the icon
+ *
+ * Sets the icon for a given drag from the given @icon. See the
+ * documentation for gtk_drag_set_icon_name() for more details about
+ * using icons in drag and drop.
+ *
+ * Since: 3.2
+ **/
+void
+gtk_drag_set_icon_gicon (GdkDragContext *context,
+ GIcon *icon,
+ gint hot_x,
+ gint hot_y)
+{
+ GtkIconHelper *helper;
+
+ g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
+ g_return_if_fail (icon != NULL);
+
+ helper = _gtk_icon_helper_new ();
+ _gtk_icon_helper_set_gicon (helper, icon, GTK_ICON_SIZE_DND);
+ set_icon_helper (context, helper, hot_x, hot_y, FALSE);
+
+ g_object_unref (helper);