[nautilus/gnome-3-22] view: make icon getter static
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/gnome-3-22] view: make icon getter static
- Date: Fri, 9 Dec 2016 23:40:34 +0000 (UTC)
commit f9c946fca6df6a7c83f2575e1c87ec9af8e72bc0
Author: Carlos Soriano <csoriano gnome org>
Date: Mon Nov 14 14:48:30 2016 +0100
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
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 a9fb749..c680ba3 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;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]