Example #1
0
void
nemo_directory_schedule_position_set (GList *position_setting_list)
{
	GList *p;
	const NemoFileChangesQueuePosition *item;
	NemoFile *file;
	char str[64];
	time_t now;

	time (&now);

	for (p = position_setting_list; p != NULL; p = p->next) {
		item = (NemoFileChangesQueuePosition *) p->data;

		file = nemo_file_get (item->location);
		
		if (item->set) {
			g_snprintf (str, sizeof (str), "%d,%d", item->point.x, item->point.y);
		} else {
			str[0] = 0;
		}
		nemo_file_set_metadata
			(file,
			 NEMO_METADATA_KEY_ICON_POSITION,
			 NULL,
			 str);

		if (item->set) {
			nemo_file_set_time_metadata
				(file,
				 NEMO_METADATA_KEY_ICON_POSITION_TIMESTAMP,
				 now);
		} else {
			nemo_file_set_time_metadata
				(file,
				 NEMO_METADATA_KEY_ICON_POSITION_TIMESTAMP,
				 UNDEFINED_TIME);
		}

        if (item->set) {
            g_snprintf (str, sizeof (str), "%d", item->monitor);
        } else {
            str[0] = 0;
        }

        nemo_file_set_metadata (file, NEMO_METADATA_KEY_MONITOR, NULL, str);

		nemo_file_unref (file);
	}
}
Example #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;
	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);
}