Exemple #1
0
static void
nemo_icon_container_dropped_icon_feedback (GtkWidget *widget,
					       GtkSelectionData *data,
					       int x, int y)
{
	NemoIconContainer *container;
	NemoIconDndInfo *dnd_info;

	container = NEMO_ICON_CONTAINER (widget);
	dnd_info = container->details->dnd_info;
	
	/* Delete old selection list. */
	nemo_drag_destroy_selection_list (dnd_info->drag_info.selection_list);
	dnd_info->drag_info.selection_list = NULL;

	/* Delete old shadow if any. */
	if (dnd_info->shadow != NULL) {
		/* FIXME bugzilla.gnome.org 42484: 
		 * Is a destroy really sufficient here? Who does the unref? */
		eel_canvas_item_destroy (dnd_info->shadow);
	}

	/* Build the selection list and the shadow. */
	dnd_info->drag_info.selection_list = nemo_drag_build_selection_list (data);
	dnd_info->shadow = create_selection_shadow (container, dnd_info->drag_info.selection_list);
	nemo_icon_container_position_shadow (container, x, y);
}
static gboolean
fade_and_request_redraw (GtkWidget     *canvas,
                         GdkFrameClock *frame_clock,
                         gpointer       user_data)
{
    NautilusSelectionCanvasItem *self = user_data;
    gint64 frame_time;
    gdouble percentage;

    frame_time = gdk_frame_clock_get_frame_time (frame_clock);
    if (frame_time >= self->priv->fade_out_end_time)
    {
        self->priv->fade_out_tick_id = 0;
        eel_canvas_item_destroy (EEL_CANVAS_ITEM (self));

        return G_SOURCE_REMOVE;
    }

    percentage = 1.0 - (gdouble) (frame_time - self->priv->fade_out_start_time) /
                 (gdouble) (self->priv->fade_out_end_time - self->priv->fade_out_start_time);

    self->priv->fade_out_fill_alpha = self->priv->fill_color.alpha * percentage;
    self->priv->fade_out_outline_alpha = self->priv->outline_color.alpha * percentage;

    eel_canvas_item_request_redraw (EEL_CANVAS_ITEM (self));

    return G_SOURCE_CONTINUE;
}
static gboolean
fade_and_request_redraw (gpointer user_data)
{
	NautilusSelectionCanvasItem *self = user_data;

	if (self->priv->fade_out_fill_alpha <= 0 ||
	    self->priv->fade_out_outline_alpha <= 0) {
		self->priv->fade_out_handler_id = 0;
		eel_canvas_item_destroy (EEL_CANVAS_ITEM (self));

		return FALSE;
	}

	self->priv->fade_out_fill_alpha -= self->priv->fade_out_fill_delta;
	self->priv->fade_out_outline_alpha -= self->priv->fade_out_outline_delta;

	eel_canvas_item_request_redraw (EEL_CANVAS_ITEM (self));

	return TRUE;
}
Exemple #4
0
static void
nemo_icon_container_free_drag_data (NemoIconContainer *container)
{
	NemoIconDndInfo *dnd_info;

	dnd_info = container->details->dnd_info;
	
	dnd_info->drag_info.got_drop_data_type = FALSE;

	if (dnd_info->shadow != NULL) {
		eel_canvas_item_destroy (dnd_info->shadow);
		dnd_info->shadow = NULL;
	}

	if (dnd_info->drag_info.selection_data != NULL) {
		gtk_selection_data_free (dnd_info->drag_info.selection_data);
		dnd_info->drag_info.selection_data = NULL;
	}

	if (dnd_info->drag_info.direct_save_uri != NULL) {
		g_free (dnd_info->drag_info.direct_save_uri);
		dnd_info->drag_info.direct_save_uri = NULL;
	}
}