Index: src/file-manager/fm-desktop-icon-view.c
===================================================================
--- src/file-manager/fm-desktop-icon-view.c	(revision 12929)
+++ src/file-manager/fm-desktop-icon-view.c	(working copy)
@@ -522,6 +522,7 @@
 	NautilusIconContainer *icon_container;
 	GtkAllocation *allocation;
 	GtkAdjustment *hadj, *vadj;
+	gboolean is_rtl = gtk_widget_get_direction (GTK_WIDGET(get_icon_container(desktop_icon_view))) == GTK_TEXT_DIR_RTL;
 
 	if (desktop_directory == NULL) {
 		eel_preferences_add_callback (NAUTILUS_PREFERENCES_DESKTOP_IS_HOME_DIR,
@@ -568,6 +569,8 @@
 	
 	/* Set our default layout mode */
 	nautilus_icon_container_set_layout_mode (icon_container,
+						 is_rtl ? 
+						 NAUTILUS_ICON_LAYOUT_T_B_R_L :
 						 NAUTILUS_ICON_LAYOUT_T_B_L_R);
 
 	g_signal_connect_object (icon_container, "middle_click",
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 12929)
+++ ChangeLog	(working copy)
@@ -1,3 +1,120 @@
+2007-06-15  Suresh Chandrasekharan <suresh.chandrasekharan@sun.com>
+	
+	RTL icon support in Nautilus.
+	'342009 nautilus icon arrangement in RTL mode'
+
+	* src/file-manager/fm-desktop-icon-view.c
+	  (fm_desktop_icon_view_init) Set the layout mode for RTL
+	  languages.
+
+	* libnautilus-private/nautilus-icon-dnd.c
+	  (drag_data_received_callback) After a non local drop happens
+	  set drag_info->dropped_not_positioned to indicate that the
+	  dropped icon(s) are yet to be positioned.
+
+	* libnautilus-private/nautilus-icon-private.h
+	  Define saved_ltr_x NautilusIcon member for keeping track
+	  of left to right icon position for a RTL icon. 
+
+	* libnautilus-private/nautilus-dnd.h
+
+	  dropped_not_positioned member added to NautilusIcon
+
+	* libnautilus-private/nautilus-icon-canvas-item.c
+
+	  (nautilus_icon_container_update_scroll_region) In RTL
+	  mode, force the horizontal scrollbar to the right side
+	  when displayed.
+
+	  (compute_text_rectangle) In nautilus window label beside icon
+	  mode, position the text_rectangle to the left side of the
+	  icon.
+
+	  (draw_or_measure_label_text) In rtl mode with the label on the 
+	  side when drawing hilight around the icon text, calculate
+	  the needed text area only to be highlighted.
+
+	* libnautilus-private/nautilus-icon-container.c
+
+	  (icon_set_position) On the leftside, allow icon to move 
+	  partially out of the screen as allowed on the right in LTR
+	  mode.
+
+	  (lay_down_one_line) When laying icons horizontally in a line
+	  from right to left, start from right end, deduct icon width
+	  and add the icon x_offset to that to position icon.
+
+	  (lay_down_icons_horizontal) When calculating the icon pixmap
+	  offset, for RTL with labels beside the icon, make offset
+	  equals width of the max length text.
+
+	  (snap_position) For RTL displayy incase the icons are put 
+	  into the left of the screen, don't totally go out of screen
+	  and don't bounce back, but display half the icon. This
+	  consistent with the LTR behavious for icons on the rightmost
+	  side.
+
+	  (get_mirror_x_position) New function for finding out the
+	  rtl_x given ltr_x and vice versa. This requires that 
+	  nautilus_icon_canvas_item_get_icon_rectangle returns the
+	  right icon dimensions.
+
+	  (nautilus_icon_container_set_rtl_positions) New function
+	  defined to set all icons to RTL positions from the already
+	  known LTR positions.
+
+	  (lay_down_icons_tblr) This function still lays out icons
+	  from top to bottom and left to right. We later convert the
+	  coordinates to RTL position using 
+	  nautilus_icon_container_set_rtl_positionsis function.
+	  If some icons are already existing in Desktop, find out the
+	  vacant place to position by laying out all icons in LTR mode.
+	  Save the new icon x position as icon->saved_ltr_x.
+
+	  When positioning all icons new, icon x position is saved as 
+	  icon->saved_ltr_x
+
+	  nautilus_icon_container_set_rtl_positions will be called after
+	  this function to calculate the RTL position corresponding
+	  to these LTR positions.
+
+	  (lay_down_icons) Added NAUTILUS_ICON_LAYOUT_R_L_T_B
+	  condition
+
+	  (redo_layout_internal) In RTL mode call 
+	  nautilus_icon_container_set_rtl_positions to reposition the 
+	  icons placed in LTR mode in RTL mode except for the cases
+	  the icon is already in RTL mode, for horizontal layout 
+	  as well as for a locally dragged icon.
+
+	  (nautilus_icon_container_move_icon) When an icon is moved
+	  in RTL mode compute and save the ltr position.
+
+	  (compare_icons_vertical_first_reverse_horizontal) Make the
+	  arrow key traversal work fine in RTL mode.
+
+	  (end_stretching) When icon is stretched in RTL mode, save the
+	  corresponding ltr_x data
+
+	  (assign_icon_position) Except for RTL DnD icons, when first
+	  position icons, position them in LTR mode.
+
+	  (finish_adding_new_icons) For multiple DnDed icons after
+	  all are positioned, set dropped_not_positioned member in
+	  drag_info to FALSE.
+
+	  (nautilus_icon_container_freeze_icon_positions) When saving the
+	  icon positions in metadata files, always save the saved_ltr_x 
+	  positions.
+
+	  (nautilus_icon_container_start_renaming_selected_item) When 
+	  renaming the label positions beside, get the correct 
+	  left position in RTL mode.
+
+	* libnautilus-private/nautilus-icon-container.h
+
+	  NAUTILUS_ICON_LAYOUT_R_L_T_B added to NautilusIconLayoutMode
+
 2007-06-12  Martin Wehner  <martin.wehner@gmail.com>
 
 	* src/nautilus-zoom-control.c: (create_zoom_menu_item):
Index: libnautilus-private/nautilus-icon-dnd.c
===================================================================
--- libnautilus-private/nautilus-icon-dnd.c	(revision 12929)
+++ libnautilus-private/nautilus-icon-dnd.c	(working copy)
@@ -1729,6 +1729,7 @@
 
 		/* reinitialise it for the next dnd */
 		drag_info->drop_occured = FALSE;
+		drag_info->dropped_not_positioned = TRUE;
 	}
 
 }
Index: libnautilus-private/nautilus-icon-private.h
===================================================================
--- libnautilus-private/nautilus-icon-private.h	(revision 12929)
+++ libnautilus-private/nautilus-icon-private.h	(working copy)
@@ -43,6 +43,14 @@
 
 	/* X/Y coordinates. */
 	double x, y;
+
+	/*
+	 * In RTL mode x is RTL x position, we use saved_ltr_x for
+	 * keeping track of x value before it gets converted into
+	 * RTL value, this is used for saving the icon position 
+	 * to the nautilus metafile. 
+	 */
+	 double saved_ltr_x;
 	
 	/* Scale factor (stretches icon). */
 	double scale;
Index: libnautilus-private/nautilus-dnd.h
===================================================================
--- libnautilus-private/nautilus-dnd.h	(revision 12929)
+++ libnautilus-private/nautilus-dnd.h	(working copy)
@@ -86,6 +86,8 @@
 
         /* has the drop occured ? */
         gboolean drop_occured;
+	/* icon positioned after a succesful drop ? */
+	gboolean dropped_not_positioned;
 
 	/* whether or not need to clean up the previous dnd data */
 	gboolean need_to_destroy;
Index: libnautilus-private/nautilus-icon-canvas-item.c
===================================================================
--- libnautilus-private/nautilus-icon-canvas-item.c	(revision 12929)
+++ libnautilus-private/nautilus-icon-canvas-item.c	(working copy)
@@ -713,6 +713,7 @@
 	ArtIRect text_rectangle;
 	double pixels_per_unit;
 	double text_width, text_height, text_dx;
+	gboolean is_rtl = gtk_widget_get_direction (GTK_WIDGET (NAUTILUS_ICON_CONTAINER (EEL_CANVAS_ITEM (item)->canvas))) == GTK_TEXT_DIR_RTL;
 
 	pixels_per_unit = EEL_CANVAS_ITEM (item)->canvas->pixels_per_unit;
 	if (canvas_coords) {
@@ -726,8 +727,13 @@
 	}
 	
 	if (NAUTILUS_ICON_CONTAINER (EEL_CANVAS_ITEM (item)->canvas)->details->label_position == NAUTILUS_ICON_LABEL_POSITION_BESIDE) {
-                text_rectangle.x0 = icon_rectangle.x1;
-                text_rectangle.x1 = text_rectangle.x0 + text_dx + text_width;
+		if (!is_rtl) {
+                	text_rectangle.x0 = icon_rectangle.x1;
+                	text_rectangle.x1 = text_rectangle.x0 + text_dx + text_width;
+		} else {
+                	text_rectangle.x1 = icon_rectangle.x0;
+                	text_rectangle.x0 = text_rectangle.x1 - text_dx - text_width ;
+		}
                 text_rectangle.y0 = (icon_rectangle.y0 + icon_rectangle.y1) / 2- (int) text_height / 2;
                 text_rectangle.y1 = text_rectangle.y0 + text_height + LABEL_OFFSET / pixels_per_unit;
 	} else {
@@ -929,6 +935,8 @@
 }
 
 
+#define RTL_ICON_LABEL_BESIDE	(is_rtl && container->details->label_position == NAUTILUS_ICON_LABEL_POSITION_BESIDE)
+
 static void
 draw_or_measure_label_text (NautilusIconCanvasItem *item,
 			    GdkDrawable *drawable,
@@ -950,6 +958,7 @@
 	GdkGC *gc;
 	ArtIRect text_rect;
 	int text_back_padding_x, text_back_padding_y;
+	gboolean is_rtl = gtk_widget_get_direction (GTK_WIDGET (NAUTILUS_ICON_CONTAINER (EEL_CANVAS_ITEM (item)->canvas))) == GTK_TEXT_DIR_RTL;
 	
 	icon_width = 0;
 	gc = NULL;
@@ -1060,9 +1069,9 @@
 			    drawable,
 			    GTK_WIDGET_HAS_FOCUS (GTK_WIDGET (container)) ? container->details->highlight_color_rgba : container->details->active_color_rgba,
 			    create_mask,
-			    text_rect.x0,
+			    RTL_ICON_LABEL_BESIDE ? text_rect.x0 + item->details->text_dx : text_rect.x0,
 			    text_rect.y0,
-			    text_rect.x1 - text_rect.x0,
+			    RTL_ICON_LABEL_BESIDE ? text_rect.x1 - text_rect.x0 - item->details->text_dx : text_rect.x1 - text_rect.x0,
 			    text_rect.y1 - text_rect.y0);
 	}
 
Index: libnautilus-private/nautilus-icon-container.c
===================================================================
--- libnautilus-private/nautilus-icon-container.c	(revision 12929)
+++ libnautilus-private/nautilus-icon-container.c	(working copy)
@@ -149,6 +149,16 @@
 #define SNAP_CEIL_HORIZONTAL(x) SNAP_HORIZONTAL (ceil, x)
 #define SNAP_CEIL_VERTICAL(y) SNAP_VERTICAL (ceil, y)
 
+#define CANVAS_WIDTH(container) ((GTK_WIDGET (container)->allocation.width \
+				- container->details->left_margin \
+				- container->details->right_margin) \
+				/  EEL_CANVAS (container)->pixels_per_unit)
+
+#define CANVAS_HEIGHT(container) ((GTK_WIDGET (container)->allocation.height \
+			 - container->details->top_margin \
+			 - container->details->bottom_margin) \
+			 / EEL_CANVAS (container)->pixels_per_unit)
+
 /* Copied from NautilusIconContainer */
 #define NAUTILUS_ICON_CONTAINER_SEARCH_DIALOG_TIMEOUT 5000
 
@@ -206,6 +216,8 @@
 static void          nautilus_icon_container_update_visible_icons   (NautilusIconContainer *container);
 static void          reveal_icon                                    (NautilusIconContainer *container,
 								     NautilusIcon *icon);
+static void nautilus_icon_container_set_rtl_positions (NautilusIconContainer *container);
+static int get_mirror_x_position (NautilusIconContainer *container, NautilusIcon *icon, double x);
 
 
 static gpointer accessible_parent_class;
@@ -341,9 +353,14 @@
 			x = right - DESKTOP_ICON_SAFETY_PAD;
 		}
 		
-		if (x < left) {
-			x = left;
-		}
+		/* 
+		 * On the left side, truncate x only if icon 
+		 * totally goes out of screen, as done with the 
+		 * right x coordinate
+		 */
+
+		x = x + width < left ? left : x;
+
 		if (y > bottom - DESKTOP_ICON_SAFETY_PAD) {
 			y = bottom - DESKTOP_ICON_SAFETY_PAD;
 		}
@@ -810,6 +827,7 @@
 	float step_increment;
 	GtkAllocation *allocation;
 	gboolean reset_scroll_region;
+	gboolean is_rtl = gtk_widget_get_direction (GTK_WIDGET(container)) == GTK_TEXT_DIR_RTL;
 
 	if (nautilus_icon_container_get_is_fixed_size (container)) {
 		pixels_per_unit = EEL_CANVAS (container)->pixels_per_unit;
@@ -887,6 +905,14 @@
 	 */
 	eel_gtk_adjustment_clamp_value (hadj);
 	eel_gtk_adjustment_clamp_value (vadj);
+
+	/*
+	 * In RTL mode, when displayed force horizontal scrollbar to the 
+	 * right side.
+	 */
+
+	if (is_rtl)
+		gtk_adjustment_set_value (hadj, hadj->upper - hadj->page_size);
 }
 
 static int
@@ -951,11 +977,11 @@
 	double x, y_offset;
 	IconPositions *position;
 	int i;
+	gboolean is_rtl = gtk_widget_get_direction (GTK_WIDGET(container)) == GTK_TEXT_DIR_RTL;
+	double canvas_width = CANVAS_WIDTH(container);
 
-	/* FIXME: Should layout differently when in RTL base mode */
-
 	/* Lay out the icons along the baseline. */
-	x = ICON_PAD_LEFT;
+	x = is_rtl ? canvas_width : ICON_PAD_LEFT;
 	i = 0;
 	for (p = line_start; p != line_end; p = p->next) {
 		icon = p->data;
@@ -968,12 +994,14 @@
 			y_offset = position->y_offset;
 		}
 
-		icon_set_position
-			(icon,
-			 x + position->x_offset,
-			 y + y_offset);
+		if (is_rtl)
+			x -= position->width;
 
-		x += position->width;
+		icon_set_position (icon, x + position->x_offset, y + y_offset);
+		icon->saved_ltr_x = is_rtl ? get_mirror_x_position (container, icon, icon->x) : icon->x;
+
+		if (!is_rtl)
+			x += position->width;
 	}
 }
 
@@ -999,8 +1027,10 @@
 	double max_text_width, max_icon_width;
 	int icon_width;
 	int i;
+	gboolean is_rtl;
 
 	g_assert (NAUTILUS_IS_ICON_CONTAINER (container));
+	is_rtl = gtk_widget_get_direction (GTK_WIDGET(container)) == GTK_TEXT_DIR_RTL;
 
 	if (icons == NULL) {
 		return;
@@ -1009,14 +1039,8 @@
 	positions = g_array_new (FALSE, FALSE, sizeof (IconPositions));
 	
 	/* Lay out icons a line at a time. */
-	canvas_width = (GTK_WIDGET (container)->allocation.width
-			- container->details->left_margin
-			- container->details->right_margin)
-		/ EEL_CANVAS (container)->pixels_per_unit;
-	canvas_height = (GTK_WIDGET (container)->allocation.height
-			 - container->details->top_margin
-			 - container->details->bottom_margin)
-		/ EEL_CANVAS (container)->pixels_per_unit;
+	canvas_width = CANVAS_WIDTH(container);
+	canvas_height = CANVAS_HEIGHT(container);
 
 	max_icon_width = max_text_width = 0.0;
 
@@ -1112,10 +1136,14 @@
 
 		if (container->details->label_position == NAUTILUS_ICON_LABEL_POSITION_BESIDE) {
 			if (gridded_layout) {
-				position->x_offset = max_icon_width + ICON_PAD_LEFT + ICON_PAD_RIGHT - (icon_bounds.x1 - icon_bounds.x0);
+				if (!is_rtl)
+					position->x_offset = max_icon_width + ICON_PAD_LEFT + ICON_PAD_RIGHT - (icon_bounds.x1 - icon_bounds.x0);
 			} else {
-				position->x_offset = icon_width - ((icon_bounds.x1 - icon_bounds.x0) + (text_bounds.x1 - text_bounds.x0));
+				if (!is_rtl)
+					position->x_offset = icon_width - ((icon_bounds.x1 - icon_bounds.x0) + (text_bounds.x1 - text_bounds.x0));
 			}
+			if (is_rtl)
+				position->x_offset = max_text_width;
 			position->y_offset = 0;
 		} else {
 			position->x_offset = (icon_width - (icon_bounds.x1 - icon_bounds.x0)) / 2;
@@ -1154,13 +1182,18 @@
 	int icon_width;
 	int icon_height;
 	ArtDRect icon_position;
+	gboolean is_rtl = gtk_widget_get_direction (GTK_WIDGET(container)) == GTK_TEXT_DIR_RTL;
+	double canvas_width = CANVAS_WIDTH(container);
 	
 	icon_position = nautilus_icon_canvas_item_get_icon_rectangle (icon->item);
 	icon_width = icon_position.x1 - icon_position.x0;
 	icon_height = icon_position.y1 - icon_position.y0;
 
-	if (*x + icon_width / 2 < DESKTOP_PAD_HORIZONTAL + SNAP_SIZE_X) {
+	if (!is_rtl && (*x + icon_width / 2 < DESKTOP_PAD_HORIZONTAL + SNAP_SIZE_X)) {
 		*x = DESKTOP_PAD_HORIZONTAL + SNAP_SIZE_X - icon_width / 2;
+
+	} else if (is_rtl && (*x + icon_width / 2 > canvas_width - DESKTOP_PAD_HORIZONTAL - SNAP_SIZE_X )) {
+		*x = canvas_width - ( DESKTOP_PAD_HORIZONTAL + SNAP_SIZE_X +  icon_width / 2 );
 	}
 
 	if (*y + icon_height < DESKTOP_PAD_VERTICAL + SNAP_SIZE_Y) {
@@ -1207,14 +1240,8 @@
 	int i;
 
 	/* Get container dimensions */
-	width  = (GTK_WIDGET (container)->allocation.width
-		  - container->details->left_margin
-		  - container->details->right_margin) /
-		EEL_CANVAS (container)->pixels_per_unit;
-	height = (GTK_WIDGET (container)->allocation.height
-		  - container->details->top_margin
-		  - container->details->bottom_margin) /
-		EEL_CANVAS (container)->pixels_per_unit;
+	width  = CANVAS_WIDTH(container);
+	height = CANVAS_HEIGHT(container);
 
 	num_columns = width / SNAP_SIZE_X;
 	num_rows = height / SNAP_SIZE_Y;
@@ -1343,14 +1370,8 @@
 	gboolean collision;
 
 	/* Get container dimensions */
-	canvas_width  = (GTK_WIDGET (container)->allocation.width
-			 - container->details->left_margin
-			 - container->details->right_margin) /
-		EEL_CANVAS (container)->pixels_per_unit;
-	canvas_height = (GTK_WIDGET (container)->allocation.height
-			 - container->details->top_margin
-			 - container->details->bottom_margin) /
-		EEL_CANVAS (container)->pixels_per_unit;
+	canvas_width  = CANVAS_WIDTH(container);
+	canvas_height = CANVAS_HEIGHT(container);
 
 	icon_get_bounding_box (icon, 
 			       &icon_position.x0, &icon_position.y0, 
@@ -1440,7 +1461,35 @@
 	placement_grid_free (grid);
 }
 
+static int
+get_mirror_x_position (NautilusIconContainer *container, NautilusIcon *icon, double x) {
+	ArtDRect icon_bounds = nautilus_icon_canvas_item_get_icon_rectangle (icon->item);
+	double	icon_width = icon_bounds.x1 - icon_bounds.x0;
+	int ret = CANVAS_WIDTH(container) - x - icon_width;
+
+	return ret;
+}
+
 static void
+nautilus_icon_container_set_rtl_positions (NautilusIconContainer *container)
+{
+	GList *l;
+	NautilusIcon *icon;
+	int x;
+
+
+	if (!container->details->icons) {
+		return ;
+	}
+
+	for (l = container->details->icons; l != NULL; l = l->next) {
+		icon = l->data;
+		x = get_mirror_x_position (container, icon, icon->saved_ltr_x);
+		icon_set_position(icon, x, icon->y);
+	}
+}
+
+static void
 lay_down_icons_tblr (NautilusIconContainer *container, GList *icons)
 {
 	GList *p, *placed_icons, *unplaced_icons;
@@ -1451,14 +1500,8 @@
 	ArtDRect icon_rect;
 
 	/* Get container dimensions */
-	width  = GTK_WIDGET (container)->allocation.width /
-		EEL_CANVAS (container)->pixels_per_unit
-		- container->details->left_margin
-		- container->details->right_margin;
-	height = GTK_WIDGET (container)->allocation.height /
-		EEL_CANVAS (container)->pixels_per_unit
-		- container->details->top_margin
-		- container->details->bottom_margin;
+	width  = CANVAS_WIDTH(container);
+	height = CANVAS_HEIGHT(container);
 
 	/* Determine which icons have and have not been placed */
 	placed_icons = NULL;
@@ -1473,6 +1516,7 @@
 		for (p = container->details->icons; p != NULL; p = p->next) {
 			icon = p->data;
 			if (icon_is_positioned (icon)) {
+				icon_set_position(icon, icon->saved_ltr_x, icon->y);
 				placed_icons = g_list_prepend (placed_icons, icon);
 			} else {
 				icon->x = 0;
@@ -1508,6 +1552,7 @@
 						     &x, &y);
 				
 				icon_set_position (icon, x, y);
+				icon->saved_ltr_x = x;
 				placement_grid_mark_icon (grid, icon);
 			}
 
@@ -1596,6 +1641,7 @@
 						   center_x - (icon_rect.x1 - icon_rect.x0) / 2,
 						   y);
 				
+				icon->saved_ltr_x = icon->x;
 				y += icon_height + DESKTOP_PAD_VERTICAL;
 			}
 			icons = p;
@@ -1619,13 +1665,12 @@
 	switch (container->details->layout_mode)
 	{
 	case NAUTILUS_ICON_LAYOUT_L_R_T_B:
+	case NAUTILUS_ICON_LAYOUT_R_L_T_B:
 		lay_down_icons_horizontal (container, icons, start_y);
 		break;
 		
 	case NAUTILUS_ICON_LAYOUT_T_B_L_R:
 	case NAUTILUS_ICON_LAYOUT_T_B_R_L:
-		/* FIXME bugzilla.gnome.org 42479: 
-		 * Need to handle T_B_R_L differently. */
 		lay_down_icons_tblr (container, icons);
 		break;
 		
@@ -1637,6 +1682,9 @@
 static void
 redo_layout_internal (NautilusIconContainer *container)
 {
+
+	gboolean is_rtl = gtk_widget_get_direction (GTK_WIDGET(container)) == GTK_TEXT_DIR_RTL;
+
 	finish_adding_new_icons (container);
 
 	/* Don't do any re-laying-out during stretching. Later we
@@ -1650,6 +1698,9 @@
 		lay_down_icons (container, container->details->icons, 0);
 	}
 
+	if (is_rtl && !container->details->drag_started && ( container->details->layout_mode != NAUTILUS_ICON_LAYOUT_L_R_T_B && container->details->layout_mode != NAUTILUS_ICON_LAYOUT_R_L_T_B))
+		nautilus_icon_container_set_rtl_positions (container);
+
 	nautilus_icon_container_update_scroll_region (container);
 
 	process_pending_icon_to_reveal (container);
@@ -1861,6 +1912,7 @@
 	NautilusIconContainerDetails *details;
 	gboolean emit_signal;
 	NautilusIconPosition position;
+	gboolean is_rtl = gtk_widget_get_direction (GTK_WIDGET(container)) == GTK_TEXT_DIR_RTL;
 	
 	details = container->details;
 	
@@ -1885,13 +1937,16 @@
 		}
 
 		if (x != icon->x || y != icon->y) {
+			if (is_rtl)
+				x -= DESKTOP_PAD_HORIZONTAL;
 			icon_set_position (icon, x, y);
+			icon->saved_ltr_x = is_rtl ? get_mirror_x_position (container, icon, icon->x) : icon->x;
 			emit_signal = update_position;
 		}
 	}
 	
 	if (emit_signal) {
-		position.x = icon->x;
+		position.x = icon->saved_ltr_x;
 		position.y = icon->y;
 		position.scale = scale;
 		g_signal_emit (container,
@@ -2324,6 +2379,7 @@
 {
 	ArtDRect world_rect;
 	int ax, ay, bx, by;
+	gboolean is_rtl = gtk_widget_get_direction (GTK_WIDGET(container)) == GTK_TEXT_DIR_RTL;
 
 	world_rect = nautilus_icon_canvas_item_get_icon_rectangle (icon_a->item);
 	eel_canvas_w2c
@@ -2347,10 +2403,10 @@
 		return +1;
 	}
 	if (ax < bx) {
-		return +1;
+		return (is_rtl ? -1 : +1);
 	}
 	if (ax > bx) {
-		return -1;
+		return (is_rtl ? +1 : -1);
 	}
 	return compare_icons_by_uri (container, icon_a, icon_b);
 }
@@ -3537,13 +3593,25 @@
 {
 	NautilusIconPosition position;
 	NautilusIcon *icon;
+	int icon_width;
+	ArtDRect icon_position;
+	gboolean is_rtl = gtk_widget_get_direction (GTK_WIDGET(container)) == GTK_TEXT_DIR_RTL;
 	
 	continue_stretching (container, world_x, world_y);
 	ungrab_stretch_icon (container);
 
 	/* now that we're done stretching, update the icon's position */
+	
 	icon = container->details->drag_icon;	
-	position.x = icon->x;
+	if (is_rtl) {
+		icon_position = nautilus_icon_canvas_item_get_icon_rectangle (icon->item);
+		icon_width = icon_position.x1 - icon_position.x0;
+
+		position.x = icon->saved_ltr_x = CANVAS_WIDTH(container) - icon->x - icon_width;
+
+	} else {
+		position.x = icon->x;
+	}
 	position.y = icon->y;
 	position.scale = icon->scale;
 	g_signal_emit (container,
@@ -5806,12 +5874,16 @@
 	g_free (additional_text);
 }
 
+#define DND_POSITIONED(container) ((container)->details->dnd_info->drag_info.dropped_not_positioned)
+
 static gboolean
 assign_icon_position (NautilusIconContainer *container,
 		      NautilusIcon *icon)
 {
 	gboolean have_stored_position;
 	NautilusIconPosition position;
+	gboolean is_rtl = gtk_widget_get_direction (GTK_WIDGET(container)) == GTK_TEXT_DIR_RTL;
+	
 
 	/* Get the stored position. */
 	have_stored_position = FALSE;
@@ -5825,6 +5897,20 @@
 	if (!container->details->auto_layout) {
 		if (have_stored_position) {
 			icon_set_position (icon, position.x, position.y);
+			/* 
+			 * Applies for non-local icons dropped
+			 * to nautilus
+			 */
+			if (DND_POSITIONED(container) && is_rtl) {
+				nautilus_icon_container_move_icon (container,
+							   icon,
+							   icon->x, icon->y,
+							   icon->scale,
+							   FALSE, TRUE, TRUE);
+			} else {
+				icon->saved_ltr_x = icon->x;
+			}
+
 		} else {
 			return FALSE;
 		}
@@ -5872,6 +5958,13 @@
 	}
 	g_list_free (new_icons);
 
+	/* 
+	 * DnD'ed multiple icons, if any, are already positioned
+	 * in assign_icon_position routine
+	 */
+	if (container->details && container->details->dnd_info) 
+		container->details->dnd_info->drag_info.dropped_not_positioned = FALSE;
+
 	if (semi_position_icons != NULL) {
 		PlacementGrid *grid;
 
@@ -6779,7 +6872,7 @@
 	for (p = container->details->icons; p != NULL; p = p->next) {
 		icon = p->data;
 
-		position.x = icon->x;
+		position.x = icon->saved_ltr_x;
 		position.y = icon->y;
 		position.scale = icon->scale;
 		g_signal_emit (container, signals[ICON_POSITION_CHANGED], 0,
@@ -6907,6 +7000,7 @@
 	NautilusIconContainerDetails *details;
 	NautilusIcon *icon;
 	ArtDRect icon_rect;
+	ArtDRect text_rect;
 	PangoContext *context;
 	PangoFontDescription *desc;
 	const char *editable_text;
@@ -6978,14 +7072,15 @@
 	pango_font_description_free (desc);
 	
 	icon_rect = nautilus_icon_canvas_item_get_icon_rectangle (icon->item);
+	text_rect = nautilus_icon_canvas_item_get_text_rectangle (icon->item);
 	
 	width = nautilus_icon_canvas_item_get_max_text_width (icon->item);
 
 
 	if (details->label_position == NAUTILUS_ICON_LABEL_POSITION_BESIDE) {
 		eel_canvas_w2c (EEL_CANVAS_ITEM (icon->item)->canvas,
-				icon_rect.x1,
-				icon_rect.y0,
+				text_rect.x0,
+				text_rect.y0,
 				&x, &y);
 	} else {
 		eel_canvas_w2c (EEL_CANVAS_ITEM (icon->item)->canvas,
Index: libnautilus-private/nautilus-icon-container.h
===================================================================
--- libnautilus-private/nautilus-icon-container.h	(revision 12929)
+++ libnautilus-private/nautilus-icon-container.h	(working copy)
@@ -56,6 +56,7 @@
 
 typedef enum {
 	NAUTILUS_ICON_LAYOUT_L_R_T_B,
+	NAUTILUS_ICON_LAYOUT_R_L_T_B,
 	NAUTILUS_ICON_LAYOUT_T_B_L_R,
 	NAUTILUS_ICON_LAYOUT_T_B_R_L
 } NautilusIconLayoutMode;
