diff options
author | Carlos Soriano <csoriano@gnome.org> | 2016-04-07 21:51:52 +0200 |
---|---|---|
committer | Carlos Soriano <csoriano@gnome.org> | 2017-02-15 01:27:41 +0100 |
commit | 1d166b5e3b34195efe04df950a3f5397c2c99ef7 (patch) | |
tree | 8b6eee8bd8215fd9d9de8e285a7d24b9740f0ccb /src/nautilus-canvas-view.c | |
parent | 370b1ab77ead9059eb7bd58a5e63431242becd8d (diff) | |
download | nautilus-1d166b5e3b34195efe04df950a3f5397c2c99ef7.tar.gz |
views: add flow box based view
After all the rework on the window slots, views, and splitting
the desktop, we are finally able to add a flow box based view for
Nautilus.
The GtkFlowBox is still not performance enough to be added as the
default view, not even as an alternative in the user preferences.
However, since the work on this is one of the biggest for Nautilus and
gtk+, the decision was to merge a prototype in order to open the
development, testing and iteration of the code in order to make it
good enough for, in a not so far away future, have it as the main view.
The work merged is not finished, and is an experiment and prototype in
more things than just the GtkFlowBox, we want to create a single shared
model with a complete MVC pattern between all the views. This will need
quite a few iterations to get it right, but once is done right, I hope
it's going to be good enough as an example to any application that wants
multiple types of views with the new widgets of gtk+.
This patch adds the GtkFlowBox view to be optionally used under a
gsetting called use-experimental-views, turned off by default.
Diffstat (limited to 'src/nautilus-canvas-view.c')
-rw-r--r-- | src/nautilus-canvas-view.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/nautilus-canvas-view.c b/src/nautilus-canvas-view.c index f1ed2c58f..ab4512d78 100644 --- a/src/nautilus-canvas-view.c +++ b/src/nautilus-canvas-view.c @@ -101,7 +101,7 @@ typedef struct gboolean supports_scaling; gboolean supports_keep_aligned; - /* Needed for async operations. Suposedly we would use cancellable and gtask, + /* FIXME: Needed for async operations. Suposedly we would use cancellable and gtask, * sadly gtkclipboard doesn't support that. * We follow this pattern for checking validity of the object in the views. * Ideally we would connect to a weak reference and do a cancellable. @@ -447,12 +447,13 @@ nautilus_canvas_view_remove_file (NautilusFilesView *view, } static void -nautilus_canvas_view_add_file (NautilusFilesView *view, - NautilusFile *file, - NautilusDirectory *directory) +nautilus_canvas_view_add_files (NautilusFilesView *view, + GList *files, + NautilusDirectory *directory) { NautilusCanvasView *canvas_view; NautilusCanvasContainer *canvas_container; + GList *l; g_assert (directory == nautilus_files_view_get_model (view)); @@ -465,10 +466,13 @@ nautilus_canvas_view_add_file (NautilusFilesView *view, nautilus_canvas_container_reset_scroll_region (canvas_container); } - if (nautilus_canvas_container_add (canvas_container, - NAUTILUS_CANVAS_ICON_DATA (file))) + for (l = files; l != NULL; l = l->next) { - nautilus_file_ref (file); + if (nautilus_canvas_container_add (canvas_container, + NAUTILUS_CANVAS_ICON_DATA (l->data))) + { + nautilus_file_ref (NAUTILUS_FILE (l->data)); + } } } @@ -2007,7 +2011,7 @@ nautilus_canvas_view_class_init (NautilusCanvasViewClass *klass) klass->create_canvas_container = real_create_canvas_container; - nautilus_files_view_class->add_file = nautilus_canvas_view_add_file; + nautilus_files_view_class->add_files = nautilus_canvas_view_add_files; nautilus_files_view_class->begin_loading = nautilus_canvas_view_begin_loading; 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; |