GNOME Bugzilla – Bug 342009
nautilus icon arrangement in RTL mode
Last modified: 2008-06-19 13:59:55 UTC
Please describe the problem: when in RTL mode, nautilus should arrange the icons from right to left. but it arranges them from left to right always (in both LTR and RTL mode) Steps to reproduce: 1. login to system in a RTL language (like Persian) 2. open nautilus 3. select "View as icons" (or "نمایش بصورت شمایل" if it is translated) Actual results: the icons arrange from left Expected results: the icons should arrange from right Does this happen every time? yes Other information: (will attach) screenshot
Created attachment 65606 [details] nautilus screnshot It is taken in RTL mode (but icons are arranged from left)
BTW, the same happens about the Desktop. Should I report another bug for that? Forgotten FarsiWeb internal reference: farsiweb #598
Confirming the bug, as this would be the correct behavior for RTL locales.
*** Bug 397395 has been marked as a duplicate of this bug. ***
The same behavior should be applied for icons on the desktop.
*** Bug 419016 has been marked as a duplicate of this bug. ***
Thanks yair fo notifying about this bug, I'm currently working on a patch for this issue.
Created attachment 86443 [details] [review] RTL icon positioning patch for gnome-2-18 branch This patch is for gnome-2-18 branch for RTL icon placement for nautilus.
Redisplaying the icons dynamically copied to the desktop do have some issues, will try to address this plus a bit more tidy up soon.
*** Bug 400209 has been marked as a duplicate of this bug. ***
*** Bug 445465 has been marked as a duplicate of this bug. ***
Working on a new patch, will post it within next one week.
Created attachment 90210 [details] [review] patch for RTL icons for 2.18 nautilus This patch solves a bunch of issues related to RTL icon placement other than the desktop/window icon placement like local and remote DnD/multiple icon DnD/icon keyboard traversal/correct display of side labels in RTL mode/Editing of labels/label highlight etc
After adding the patch a make clean may be needed due to the couple of new member additions in structs used.
I tested it with 2.18.1 nautilus. It seems to work, icons are arranged from rtl in both file manager and desktop, no problems so far.
Bug list -------- - Clean up by name, and keep aligned does not use the same minimum space from the right edge of the screen - after moving some icon to the right edge of the screen (and keep aligned will move it a bit to the left) "clean up by name" always sort icons to the left side of the screen - when creating a new folder, it is not created in the pointer location but in its rtl reverted point. - in nautilus folder window, when using manual sort the icons are kept to the left
Thanks for the tests I will work on the bug list and update the patch.
Created attachment 90804 [details] [review] patch for RTL icons for 2.18 nautilus Pl. see if the patch solves the issues found against this.
One issue still remains is in RTL mode folder window if there are fewer icons than can be fitted in a line then the icons are kept on to the left side when refresh/entering the directory and this behaves allright when cleaned up. This goes away if the scroll origin is set to 0,0 as in autolayout mode. But doing like this causes the scrollbar to go away in manual mode. This needs fix. Other minor issues remaining in my knowledge are - Icon alignment issues in the Beside Label mode when logging into a LTR desktop and after that to a RTL desktop, needs cleanup to behave right. - When DnD icons from a folder to desktop in label beside mode to desktop, the relative icon positions are maintained and this may cause text overlapping the image. Ideally this positions need to be recalculated when DnD. - In RTL mode Pl. test this patch to see if any other issues are present.
Can somebody pl. test the latest patch and let know the comments ?
I'm both testing and reviewing your patch. But it takes time.
I patched 2.18.1 and every thing seems to be OK, I tested it quickly though.
There is an issue with keep aligned mode when dragging an icon. When the icon is dropped the aligned location is calculated as in rtl mode when in rtl it should be different. For example clean icons by name so that the icons are all right aligned. Choose one icon and move it a little bit to the left. Now try to move it back. Because the aligned positions in ltr and rtl are different, you won't be able to do that.
Code comments: - rename the function lay_down_icons_tbrl() to lay_down_icons_vertical() - the frequent use of the rtl text direction check is incorrect. instead of querying the container text direction you need to check if the container layout mode is NAUTILUS_ICON_LAYOUT_T_B_R_L. It is probably a good idea to use a is_layout_rtl() function because we need to check both NAUTILUS_ICON_LAYOUT_T_B_R_L and NAUTILUS_ICON_LAYOUT_R_L_T_B.
I agree on the frequent check of text direction. We should just store some state in our widget (such as the layout mode) to control that. Otherwise it looks fairly ok to me, although i didn't verify all the coordinates etc (testing would show errors there anyway). The one thing I don't like is the global flag_icons_rtl variable. It seems very icky to store that in a global variable. Its also racy, as you can easily get other icons added after the flag is set. There has to be some better way to pass this information for that particular file. On which operations do we need to flag that and on which do we not? Code style issue i saw were: * Don't declare variable and assign it in same row * Missing brackets after "if", even if its only one row * Missing spaces before paranthesis in function call
The layout mode is good enough to know if we're rtl or ltr. This is also beneficial because we can have an icons to the right desktop even on LTR systems.
I'm working on fixing all the issues previously described
Hi Yair, Are you working on both your comments and Alex's as well ? I'm busy this week and will get to this next week. Let me know so that we don't duplicate the work.
I'm working on both. I'll upload my patch by the start of next week.
Thanks for letting know. Will look out for your patch next week.
Created attachment 97992 [details] [review] patch for RTL icons for 2.20 nautilus Fixes from last patch: - some code cleanup and apply nautilus conventions. - keep aligned and clean up by name did not gave the same positions. - placing icons with respect to screen edges was opposite to how it works in ltr. - rtl detection in browser mode. - icons with embelms got place of two icons when label beside icons. known issues: - when switching to manual layout in browser icons are repositioned as left aligned. - when creating a new file/launcher it is placed unaligned - emblems fix is not complete. in ltr emblems start position is top right. in rtl it should be top left. with current patch it is placed bottom left. - should remove the global flag_rtl function.
I'll keep working on the embelms code.
Is it OK to ask Alex to review and integrate the latest patch. Additional modifications can be made with new patches rather than holding this for a long time.
Created attachment 98364 [details] [review] patch for RTL icons for 2.20 nautilus Finished emblems code fix for rtl
switching to manualy layout is done here: nautilus_icon_container_set_auto_layout(). Regarding opposite position when creating new folder and for non local drop: ---------------------------------------------------------------------------- In these two scenarios the position is stored to the metadata directly before the icon object is created. this is done by calling nautilus_file_changes_queue_schedule_position_set(). The big issue is that at this point the icon width is not known so it is not possible to calculate the correct ltr position. Any ideas how to approach this problem?
I've figured out how to handle non-local drops. In handle_nonlocal_move() we should we should alter x,y and source_item_locations so when emiting the "move_copy_items" signal which calls fm_directory_view_move_copy_items() using x amd source_item_location will give the ltr possition. Then the ltr position will be saved to the icon's meta-data, and when reloading icon positions will get the correct position. Still in doubt how to handle creation of a new folder.
Hi Yair, Thats great. IMO it will be good if we can put back the fix created so far and work on the rest of the issues one by one. I will ask Alex to look at the patch attached and see if it's fine. Will let you know once I heard from Alex.
Sure, i'll add my latest patch with the non-local drop later today.
Created attachment 98587 [details] [review] patch for RTL icons for 2.20 nautilus - Fix opposite position issue for non-local drops. - Remove global flag_icons_rtl use. Open issues: - Opposite position when creating a new folder - Unaligned position when creating new files - Position change when switching from automatic to manual layout in browser window.
Regarding new folder creation, the position must be fixed before it is saved to the meta-data. Then there is nothing to fix in the icon-container code. I think it is inevitable to create a temporary icon object just to know the icon width.
I took a quick look at the patch, and it seems ok as a start. I've commited it to trunk so that we can work incrementally from that.
(patch was committed to trunk as Revision 13413, setting status)
*** Bug 406496 has been marked as a duplicate of this bug. ***
*** Bug 499177 has been marked as a duplicate of this bug. ***
Closing. New bugs (#539132 and #539134) were opened for the remaining RTL issues in icon view.