mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-01 00:11:29 +00:00
filechooser: Remove commented out code
It wouldn't compile with current APIs anyway
This commit is contained in:
parent
4181abd69a
commit
671c506dfc
@ -2944,166 +2944,6 @@ shortcuts_drag_data_delete_cb (GtkWidget *widget,
|
|||||||
g_signal_stop_emission_by_name (widget, "drag-data-delete");
|
g_signal_stop_emission_by_name (widget, "drag-data-delete");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* Creates a suitable drag cursor to indicate that the selected bookmark will be
|
|
||||||
* deleted or not.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
shortcuts_drag_set_delete_cursor (GtkFileChooserDefault *impl,
|
|
||||||
gboolean delete)
|
|
||||||
{
|
|
||||||
GtkTreeView *tree_view;
|
|
||||||
GtkTreeIter iter;
|
|
||||||
GtkTreePath *path;
|
|
||||||
GdkPixmap *row_pixmap;
|
|
||||||
GdkBitmap *mask;
|
|
||||||
int row_pixmap_y;
|
|
||||||
int cell_y;
|
|
||||||
|
|
||||||
tree_view = GTK_TREE_VIEW (impl->browse_shortcuts_tree_view);
|
|
||||||
|
|
||||||
/* Find the selected path and get its drag pixmap */
|
|
||||||
|
|
||||||
if (!shortcuts_get_selected (impl, &iter))
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
path = gtk_tree_model_get_path (GTK_TREE_MODEL (impl->shortcuts_model), &iter);
|
|
||||||
|
|
||||||
row_pixmap = gtk_tree_view_create_row_drag_icon (tree_view, path);
|
|
||||||
gtk_tree_path_free (path);
|
|
||||||
|
|
||||||
mask = NULL;
|
|
||||||
row_pixmap_y = 0;
|
|
||||||
|
|
||||||
if (delete)
|
|
||||||
{
|
|
||||||
GdkPixbuf *pixbuf;
|
|
||||||
|
|
||||||
pixbuf = gtk_widget_render_icon (impl->browse_shortcuts_tree_view,
|
|
||||||
GTK_STOCK_DELETE,
|
|
||||||
GTK_ICON_SIZE_DND,
|
|
||||||
NULL);
|
|
||||||
if (pixbuf)
|
|
||||||
{
|
|
||||||
GdkPixmap *composite;
|
|
||||||
int row_pixmap_width, row_pixmap_height;
|
|
||||||
int pixbuf_width, pixbuf_height;
|
|
||||||
int composite_width, composite_height;
|
|
||||||
int pixbuf_x, pixbuf_y;
|
|
||||||
GdkGC *gc, *mask_gc;
|
|
||||||
GdkColor color;
|
|
||||||
GdkBitmap *pixbuf_mask;
|
|
||||||
|
|
||||||
/* Create pixmap and mask for composite image */
|
|
||||||
|
|
||||||
gdk_drawable_get_size (row_pixmap, &row_pixmap_width, &row_pixmap_height);
|
|
||||||
pixbuf_width = gdk_pixbuf_get_width (pixbuf);
|
|
||||||
pixbuf_height = gdk_pixbuf_get_height (pixbuf);
|
|
||||||
|
|
||||||
composite_width = MAX (row_pixmap_width, pixbuf_width);
|
|
||||||
composite_height = MAX (row_pixmap_height, pixbuf_height);
|
|
||||||
|
|
||||||
row_pixmap_y = (composite_height - row_pixmap_height) / 2;
|
|
||||||
|
|
||||||
if (gtk_widget_get_direction (impl->browse_shortcuts_tree_view) == GTK_TEXT_DIR_RTL)
|
|
||||||
pixbuf_x = 0;
|
|
||||||
else
|
|
||||||
pixbuf_x = composite_width - pixbuf_width;
|
|
||||||
|
|
||||||
pixbuf_y = (composite_height - pixbuf_height) / 2;
|
|
||||||
|
|
||||||
composite = gdk_pixmap_new (row_pixmap, composite_width, composite_height, -1);
|
|
||||||
gc = gdk_gc_new (composite);
|
|
||||||
|
|
||||||
mask = gdk_pixmap_new (row_pixmap, composite_width, composite_height, 1);
|
|
||||||
mask_gc = gdk_gc_new (mask);
|
|
||||||
color.pixel = 0;
|
|
||||||
gdk_gc_set_foreground (mask_gc, &color);
|
|
||||||
gdk_draw_rectangle (mask, mask_gc, TRUE, 0, 0, composite_width, composite_height);
|
|
||||||
|
|
||||||
color.red = 0xffff;
|
|
||||||
color.green = 0xffff;
|
|
||||||
color.blue = 0xffff;
|
|
||||||
gdk_gc_set_rgb_fg_color (gc, &color);
|
|
||||||
gdk_draw_rectangle (composite, gc, TRUE, 0, 0, composite_width, composite_height);
|
|
||||||
|
|
||||||
/* Composite the row pixmap and the pixbuf */
|
|
||||||
|
|
||||||
gdk_pixbuf_render_pixmap_and_mask_for_colormap
|
|
||||||
(pixbuf,
|
|
||||||
gtk_widget_get_colormap (impl->browse_shortcuts_tree_view),
|
|
||||||
NULL, &pixbuf_mask, 128);
|
|
||||||
gdk_draw_drawable (mask, mask_gc, pixbuf_mask,
|
|
||||||
0, 0,
|
|
||||||
pixbuf_x, pixbuf_y,
|
|
||||||
pixbuf_width, pixbuf_height);
|
|
||||||
g_object_unref (pixbuf_mask);
|
|
||||||
|
|
||||||
gdk_draw_drawable (composite, gc, row_pixmap,
|
|
||||||
0, 0,
|
|
||||||
0, row_pixmap_y,
|
|
||||||
row_pixmap_width, row_pixmap_height);
|
|
||||||
color.pixel = 1;
|
|
||||||
gdk_gc_set_foreground (mask_gc, &color);
|
|
||||||
gdk_draw_rectangle (mask, mask_gc, TRUE, 0, row_pixmap_y, row_pixmap_width, row_pixmap_height);
|
|
||||||
|
|
||||||
gdk_draw_pixbuf (composite, gc, pixbuf,
|
|
||||||
0, 0,
|
|
||||||
pixbuf_x, pixbuf_y,
|
|
||||||
pixbuf_width, pixbuf_height,
|
|
||||||
GDK_RGB_DITHER_MAX,
|
|
||||||
0, 0);
|
|
||||||
|
|
||||||
g_object_unref (pixbuf);
|
|
||||||
g_object_unref (row_pixmap);
|
|
||||||
|
|
||||||
row_pixmap = composite;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The hotspot offsets here are copied from gtk_tree_view_drag_begin(), ugh */
|
|
||||||
|
|
||||||
gtk_tree_view_get_path_at_pos (tree_view,
|
|
||||||
tree_view->priv->press_start_x,
|
|
||||||
tree_view->priv->press_start_y,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
&cell_y);
|
|
||||||
|
|
||||||
gtk_drag_set_icon_pixmap (impl->shortcuts_drag_context,
|
|
||||||
gdk_drawable_get_colormap (row_pixmap),
|
|
||||||
row_pixmap,
|
|
||||||
mask,
|
|
||||||
tree_view->priv->press_start_x + 1,
|
|
||||||
row_pixmap_y + cell_y + 1);
|
|
||||||
|
|
||||||
g_object_unref (row_pixmap);
|
|
||||||
if (mask)
|
|
||||||
g_object_unref (mask);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We set the delete cursor and the shortcuts_drag_outside flag in an idle
|
|
||||||
* handler so that we can tell apart the drag_leave event that comes right
|
|
||||||
* before a drag_drop, from a normal drag_leave. We don't want to set the
|
|
||||||
* cursor nor the flag in the latter case.
|
|
||||||
*/
|
|
||||||
static gboolean
|
|
||||||
shortcuts_drag_outside_idle_cb (GtkFileChooserDefault *impl)
|
|
||||||
{
|
|
||||||
GDK_THREADS_ENTER ();
|
|
||||||
|
|
||||||
shortcuts_drag_set_delete_cursor (impl, TRUE);
|
|
||||||
impl->shortcuts_drag_outside = TRUE;
|
|
||||||
|
|
||||||
shortcuts_cancel_drag_outside_idle (impl);
|
|
||||||
|
|
||||||
GDK_THREADS_LEAVE ();
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* GtkWidget::drag-leave handler for the shortcuts list. We unhighlight the
|
/* GtkWidget::drag-leave handler for the shortcuts list. We unhighlight the
|
||||||
* drop position.
|
* drop position.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user