diff options
author | Carlos Soriano <csoriano@gnome.org> | 2016-11-14 14:48:30 +0100 |
---|---|---|
committer | Carlos Soriano <csoriano@gnome.org> | 2016-12-10 00:32:16 +0100 |
commit | f9c946fca6df6a7c83f2575e1c87ec9af8e72bc0 (patch) | |
tree | 030cc94478177b14230db36a2aaebf59c32e7f77 | |
parent | 60ed383d127fe91f0ee9b7e5c656843908db8558 (diff) | |
download | nautilus-f9c946fca6df6a7c83f2575e1c87ec9af8e72bc0.tar.gz |
view: make icon getter static
We were relying on the current view to return the icon to put in the
toolbar, however that requires a view instance and also we cannot
control really what icon we want to show in which circumstances.
We want more control about that, so we need a single entry point where
we can get the icon to show depending on the known view types we
have.
So this patch converts the view property to a static method.
https://bugzilla.gnome.org/show_bug.cgi?id=771075
-rw-r--r-- | src/nautilus-window-slot.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c index a9fb749e6..c680ba301 100644 --- a/src/nautilus-window-slot.c +++ b/src/nautilus-window-slot.c @@ -3050,27 +3050,13 @@ nautilus_window_slot_get_icon (NautilusWindowSlot *self) } current_view_id = nautilus_view_get_view_id (NAUTILUS_VIEW (priv->content_view)); - switch (current_view_id) + if (current_view_id != NAUTILUS_VIEW_INVALID_ID) { - case NAUTILUS_VIEW_LIST_ID: - { - return nautilus_view_get_icon (NAUTILUS_VIEW_GRID_ID); - } - break; - case NAUTILUS_VIEW_GRID_ID: - { - return nautilus_view_get_icon (NAUTILUS_VIEW_LIST_ID); - } - break; - case NAUTILUS_VIEW_OTHER_LOCATIONS_ID: - { - return nautilus_view_get_icon (NAUTILUS_VIEW_OTHER_LOCATIONS_ID); - } - break; - default: - { - return NULL; - } + return nautilus_view_get_icon (current_view_id); + } + else + { + return NULL; } } |