diff options
author | Neil Herald <neil.herald@gmail.com> | 2016-05-02 18:34:57 +0100 |
---|---|---|
committer | Neil Herald <neil.herald@gmail.com> | 2016-06-22 23:38:22 +0100 |
commit | 06029b1ae9e4b7a220a9c25d772ce0a9729877af (patch) | |
tree | b0e22f1934b5997445d9d100f142a92073b07272 /src/nautilus-canvas-view.c | |
parent | cb7134c8c2c325a4c8e86eebaf1ca85be78537ec (diff) | |
download | nautilus-06029b1ae9e4b7a220a9c25d772ce0a9729877af.tar.gz |
toolbar-view-menu: replace zoom slider with buttons
Convert the zoom slider into a horizontal button list, with a button in
the middle to show the current zoom level percentage.
This is part of the toolbar menu redesign to improve the usability of
the menus.
https://bugzilla.gnome.org/show_bug.cgi?id=764632
Diffstat (limited to 'src/nautilus-canvas-view.c')
-rw-r--r-- | src/nautilus-canvas-view.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/nautilus-canvas-view.c b/src/nautilus-canvas-view.c index 9cd3f3480..563a48c65 100644 --- a/src/nautilus-canvas-view.c +++ b/src/nautilus-canvas-view.c @@ -834,6 +834,12 @@ nautilus_canvas_view_restore_default_zoom_level (NautilusFilesView *view) (view, get_default_zoom_level (canvas_view)); } +static void +nautilus_canvas_view_restore_standard_zoom_level (NautilusFilesView *view) +{ + nautilus_canvas_view_zoom_to_level (view, NAUTILUS_CANVAS_ZOOM_LEVEL_LARGE); +} + static gboolean nautilus_canvas_view_can_zoom_in (NautilusFilesView *view) { @@ -852,6 +858,18 @@ nautilus_canvas_view_can_zoom_out (NautilusFilesView *view) > NAUTILUS_CANVAS_ZOOM_LEVEL_SMALL; } +static gfloat +nautilus_canvas_view_get_zoom_level_percentage (NautilusFilesView *view) +{ + guint icon_size; + NautilusCanvasZoomLevel zoom_level; + + zoom_level = nautilus_canvas_view_get_zoom_level (view); + icon_size = nautilus_canvas_container_get_icon_size_for_zoom_level (zoom_level); + + return (gfloat) icon_size / NAUTILUS_CANVAS_ICON_SIZE_LARGE; +} + static gboolean nautilus_canvas_view_is_empty (NautilusFilesView *view) { @@ -1898,6 +1916,7 @@ nautilus_canvas_view_class_init (NautilusCanvasViewClass *klass) nautilus_files_view_class->bump_zoom_level = nautilus_canvas_view_bump_zoom_level; nautilus_files_view_class->can_zoom_in = nautilus_canvas_view_can_zoom_in; nautilus_files_view_class->can_zoom_out = nautilus_canvas_view_can_zoom_out; + nautilus_files_view_class->get_zoom_level_percentage = nautilus_canvas_view_get_zoom_level_percentage; nautilus_files_view_class->clear = nautilus_canvas_view_clear; nautilus_files_view_class->end_loading = nautilus_canvas_view_end_loading; nautilus_files_view_class->file_changed = nautilus_canvas_view_file_changed; @@ -1907,6 +1926,7 @@ nautilus_canvas_view_class_init (NautilusCanvasViewClass *klass) nautilus_files_view_class->is_empty = nautilus_canvas_view_is_empty; nautilus_files_view_class->remove_file = nautilus_canvas_view_remove_file; nautilus_files_view_class->restore_default_zoom_level = nautilus_canvas_view_restore_default_zoom_level; + nautilus_files_view_class->restore_standard_zoom_level = nautilus_canvas_view_restore_standard_zoom_level; nautilus_files_view_class->reveal_selection = nautilus_canvas_view_reveal_selection; nautilus_files_view_class->select_all = nautilus_canvas_view_select_all; nautilus_files_view_class->select_first = nautilus_canvas_view_select_first; |