示例#1
0
static void
handle_local_move (NemoIconContainer *container,
		   double world_x, double world_y)
{
	GList *moved_icons, *p;
	NemoDragSelectionItem *item;
	NemoIcon *icon;
	NemoFile *file;
	char screen_string[32];
	GdkScreen *screen;
	time_t now;

	if (container->details->auto_layout) {
		return;
	}

	time (&now);

	/* Move and select the icons. */
	moved_icons = NULL;
	for (p = container->details->dnd_info->drag_info.selection_list; p != NULL; p = p->next) {
		item = p->data;
		
		icon = nemo_icon_container_get_icon_by_uri
			(container, item->uri);

		if (icon == NULL) {
			/* probably dragged from another screen.  Add it to
			 * this screen
			 */

			file = nemo_file_get_by_uri (item->uri);

			screen = gtk_widget_get_screen (GTK_WIDGET (container));
			g_snprintf (screen_string, sizeof (screen_string), "%d",
				    gdk_screen_get_number (screen));
			nemo_file_set_metadata (file,
					NEMO_METADATA_KEY_SCREEN,
					NULL, screen_string);
			nemo_file_set_time_metadata (file,
							 NEMO_METADATA_KEY_ICON_POSITION_TIMESTAMP, now);

			nemo_icon_container_add (container, NEMO_ICON_CONTAINER_ICON_DATA (file));
			
			icon = nemo_icon_container_get_icon_by_uri
				(container, item->uri);
		}

		if (item->got_icon_position) {
			nemo_icon_container_move_icon
				(container, icon,
				 world_x + item->icon_x, world_y + item->icon_y,
				 icon->scale,
				 TRUE, TRUE, TRUE);
		}
		moved_icons = g_list_prepend (moved_icons, icon);
	}		
	nemo_icon_container_select_list_unselect_others
		(container, moved_icons);
	/* Might have been moved in a way that requires adjusting scroll region. */
	nemo_icon_container_update_scroll_region (container);
	g_list_free (moved_icons);
}
示例#2
0
static void
handle_local_move (NemoIconContainer *container,
		   double world_x, double world_y)
{
	GList *moved_icons, *p;
	NemoDragSelectionItem *item;
	NemoIcon *icon;
	NemoFile *file = NULL;
    gint monitor;
	time_t now;

	if (container->details->auto_layout) {
		return;
	}

	time (&now);

	/* Move and select the icons. */
	moved_icons = NULL;
	for (p = container->details->dnd_info->drag_info.selection_list; p != NULL; p = p->next) {
		item = p->data;
		
		icon = nemo_icon_container_get_icon_by_uri
			(container, item->uri);

		if (icon == NULL) {
			/* probably dragged from another screen.  Add it to
			 * this screen
			 */

			file = nemo_file_get_by_uri (item->uri);

			nemo_file_set_time_metadata (file,
							 NEMO_METADATA_KEY_ICON_POSITION_TIMESTAMP, now);

			nemo_icon_container_add (container, NEMO_ICON_CONTAINER_ICON_DATA (file));
			
			icon = nemo_icon_container_get_icon_by_uri
				(container, item->uri);
		}

        if (file == NULL)
            file = NEMO_FILE (icon->data);

        nemo_file_set_is_desktop_orphan (file, FALSE);

        monitor = nemo_desktop_utils_get_monitor_for_widget (GTK_WIDGET (container));
        nemo_file_set_integer_metadata (file, NEMO_METADATA_KEY_MONITOR, 0, monitor);

		if (item->got_icon_position) {
			nemo_icon_container_move_icon
				(container, icon,
				 world_x + item->icon_x, world_y + item->icon_y,
				 icon->scale,
				 TRUE, TRUE, TRUE);
		}
		moved_icons = g_list_prepend (moved_icons, icon);
	}		
	nemo_icon_container_select_list_unselect_others
		(container, moved_icons);
	/* Might have been moved in a way that requires adjusting scroll region. */
	nemo_icon_container_update_scroll_region (container);
	g_list_free (moved_icons);
}