After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 342009 - nautilus icon arrangement in RTL mode
nautilus icon arrangement in RTL mode
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: Views: All
2.10.x
Other All
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
: 397395 400209 406496 419016 445465 499177 (view as bug list)
Depends on:
Blocks: Persian Hebrew
 
 
Reported: 2006-05-16 17:43 UTC by Hooman "Messi" Mesgary
Modified: 2008-06-19 13:59 UTC
See Also:
GNOME target: ---
GNOME version: 2.9/2.10


Attachments
nautilus screnshot (78.36 KB, image/png)
2006-05-16 17:46 UTC, Hooman "Messi" Mesgary
  Details
RTL icon positioning patch for gnome-2-18 branch (22.00 KB, patch)
2007-04-16 17:36 UTC, suresh
none Details | Review
patch for RTL icons for 2.18 nautilus (24.32 KB, patch)
2007-06-18 14:13 UTC, suresh
none Details | Review
patch for RTL icons for 2.18 nautilus (27.08 KB, patch)
2007-06-28 15:19 UTC, suresh
needs-work Details | Review
patch for RTL icons for 2.20 nautilus (27.91 KB, patch)
2007-10-27 22:04 UTC, Yair Hershkovitz
needs-work Details | Review
patch for RTL icons for 2.20 nautilus (29.11 KB, patch)
2007-11-02 08:44 UTC, Yair Hershkovitz
none Details | Review
patch for RTL icons for 2.20 nautilus (28.05 KB, patch)
2007-11-05 21:22 UTC, Yair Hershkovitz
committed Details | Review

Description Hooman "Messi" Mesgary 2006-05-16 17:43:37 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
Comment 1 Hooman "Messi" Mesgary 2006-05-16 17:46:05 UTC
Created attachment 65606 [details]
nautilus screnshot

It is taken in RTL mode (but icons are arranged from left)
Comment 2 Hooman "Messi" Mesgary 2006-05-16 17:51:09 UTC
BTW, the same happens about the Desktop. Should I report another bug for that?

Forgotten FarsiWeb internal reference: farsiweb #598
Comment 3 Roozbeh Pournader 2006-05-16 18:25:35 UTC
Confirming the bug, as this would be the correct behavior for RTL locales.
Comment 4 Yair Hershkovitz 2007-01-18 11:05:03 UTC
*** Bug 397395 has been marked as a duplicate of this bug. ***
Comment 5 Yair Hershkovitz 2007-01-18 11:06:52 UTC
The same behavior should be applied for icons on the desktop.
Comment 6 suresh 2007-03-16 17:52:29 UTC
*** Bug 419016 has been marked as a duplicate of this bug. ***
Comment 7 suresh 2007-03-16 17:53:31 UTC
Thanks yair fo notifying about this bug, I'm currently working on a patch for this issue.
Comment 8 suresh 2007-04-16 17:36:29 UTC
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.
Comment 9 suresh 2007-04-16 17:39:39 UTC
Redisplaying the icons dynamically copied to the desktop do have some issues, will try to address this plus a bit more tidy up soon. 
Comment 10 Martin Möller 2007-05-18 10:18:11 UTC
*** Bug 400209 has been marked as a duplicate of this bug. ***
Comment 11 Pedro Villavicencio 2007-06-09 01:19:12 UTC
*** Bug 445465 has been marked as a duplicate of this bug. ***
Comment 12 suresh 2007-06-09 01:31:08 UTC
Working on a new patch, will post it within next one week.
Comment 13 suresh 2007-06-18 14:13:58 UTC
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
Comment 14 suresh 2007-06-18 14:21:30 UTC
After adding the patch a make clean may be needed due to the couple of new member additions in structs used. 
Comment 15 Khaled Hosny 2007-06-20 13:38:51 UTC
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.
Comment 16 Yair Hershkovitz 2007-06-20 13:49:36 UTC
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
Comment 17 suresh 2007-06-20 15:25:38 UTC
Thanks for the tests I will work on the bug list and update the patch.
Comment 18 suresh 2007-06-28 15:19:38 UTC
Created attachment 90804 [details] [review]
patch for RTL icons for 2.18 nautilus

Pl. see if the patch solves the issues found against this.
Comment 19 suresh 2007-06-28 15:40:33 UTC
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.
Comment 20 suresh 2007-07-11 21:04:51 UTC
Can somebody pl. test the latest patch and let know the comments ?
Comment 21 Yair Hershkovitz 2007-07-24 13:11:15 UTC
I'm both testing and reviewing your patch. But it takes time.
Comment 22 Khaled Hosny 2007-09-11 17:46:46 UTC
I patched 2.18.1 and every thing seems to be OK, I tested it quickly though.
Comment 23 Yair Hershkovitz 2007-10-21 13:24:41 UTC
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.
Comment 24 Yair Hershkovitz 2007-10-21 13:46:05 UTC
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.

Comment 25 Alexander Larsson 2007-10-22 07:44:22 UTC
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

Comment 26 Yair Hershkovitz 2007-10-22 08:29:20 UTC
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.
Comment 27 Yair Hershkovitz 2007-10-25 12:56:22 UTC
I'm working on fixing all the issues previously described
Comment 28 suresh 2007-10-25 13:25:42 UTC
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.

Comment 29 Yair Hershkovitz 2007-10-25 20:49:21 UTC
I'm working on both. I'll upload my patch by the start of next week.
Comment 30 suresh 2007-10-26 00:14:48 UTC
Thanks for letting know. Will look out for your patch next week.
Comment 31 Yair Hershkovitz 2007-10-27 22:04:02 UTC
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.
Comment 32 Yair Hershkovitz 2007-10-27 22:06:36 UTC
I'll keep working on the embelms code.
Comment 33 suresh 2007-11-01 15:01:44 UTC
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.
Comment 34 Yair Hershkovitz 2007-11-02 08:44:05 UTC
Created attachment 98364 [details] [review]
patch for RTL icons for 2.20 nautilus

Finished emblems code fix for rtl
Comment 35 Yair Hershkovitz 2007-11-02 08:54:45 UTC
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?
Comment 36 Yair Hershkovitz 2007-11-05 13:49:21 UTC
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.
Comment 37 suresh 2007-11-05 14:18:26 UTC
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.
Comment 38 Yair Hershkovitz 2007-11-05 14:44:38 UTC
Sure, i'll add my latest patch with the non-local drop later today.
Comment 39 Yair Hershkovitz 2007-11-05 21:22:10 UTC
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.
Comment 40 Yair Hershkovitz 2007-11-05 21:27:32 UTC
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.
Comment 41 Alexander Larsson 2007-11-12 10:17:23 UTC
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.
Comment 42 André Klapper 2007-12-12 03:16:46 UTC
(patch was committed to trunk as Revision 13413, setting status)
Comment 43 Yair Hershkovitz 2008-02-22 21:56:45 UTC
*** Bug 406496 has been marked as a duplicate of this bug. ***
Comment 44 Cosimo Cecchi 2008-03-23 20:22:10 UTC
*** Bug 499177 has been marked as a duplicate of this bug. ***
Comment 45 Yair Hershkovitz 2008-06-19 13:59:55 UTC
Closing. New bugs (#539132 and #539134) were opened for the remaining RTL issues in icon view.