GNOME Bugzilla – Bug 771481
Let the reset zoom button be inactive when zoom is 100%
Last modified: 2017-06-24 16:09:22 UTC
Let the reset zoom button (the button that shows zoom level, like 100%, in menu[F10]) be inactive, if the zoom level is already 100%.
Created attachment 351770 [details] [review] files-view: disable the reset zoom button by default The reset zoom button is sensitive even though the zoom percentage is already at 100%. Let the button be inactive if the zoom percentage is already at 100%. Bugzilla link:
Review of attachment 351770 [details] [review]: Thanks for the patch! I’d do this differently, though, to avoid float comparisons like that. Not sure offhand how exactly. ::: src/nautilus-files-view.c @@ +7410,3 @@ selection_all_in_trash = all_in_trash (selection); + is_default_zoom_level = nautilus_files_view_get_zoom_level_percentage(view) == 1; Equality comparison between a float and a constant is a bad idea. @@ +7411,3 @@ + is_default_zoom_level = nautilus_files_view_get_zoom_level_percentage(view) == 1; + Not sure if leaving empty space here is necessary. @@ +7730,3 @@ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), + nautilus_files_view_supports_zooming (view) && ! is_default_zoom_level); + // nautilus_files_view_supports_zooming (view)); You’ve left a comment there.
Created attachment 352237 [details] [review] files-view: disable the reset zoom button by default The reset zoom button is sensitive even though the zoom percentage is already at 100%. Let the button be inactive if the zoom percentage is already at 100%. Bugzilla link:
Review of attachment 352237 [details] [review]: The “Bugzilla link: ” part in the commit message is unnecessary. ::: src/nautilus-files-view.c @@ +2544,3 @@ { nautilus_files_view_restore_standard_zoom_level (user_data); + g_simple_action_set_enabled (action, FALSE); I cannot see why this would be needed. Can you explain? @@ +7409,3 @@ !nautilus_file_has_activation_uri (NAUTILUS_FILE (selection->data))); selection_all_in_trash = all_in_trash (selection); + is_default_zoom_level = nautilus_files_view_get_zoom_level_percentage (view) == 1.0; Although this does not address my previous concerns, I think this should be fine, as, to my understanding, dividing two integers (which are exactly representable in binary) will be exactly representable in binary if the result is, in fact, integral (which it is, if the zoom level is standard). Do have in mind that you are now promoting the return value to a double (which is arguably worse), so use the “f” suffix for the constant. @@ +7728,3 @@ "zoom-standard"); g_simple_action_set_enabled (G_SIMPLE_ACTION (action), + nautilus_files_view_supports_zooming (view) && ! is_default_zoom_level); The space after the negation operator is unnecessary.
Created attachment 354391 [details] [review] files-view: update vfunc comment get_zoom_level_percentage() does not return a value in the specified range, as there are zoom levels beyond 100%.
Attachment 352237 [details] pushed as b295aa5 - files-view: disable the reset zoom button by default
Attachment 354391 [details] pushed as 0119b67 - files-view: update vfunc comment