[nautilus/wip/csoriano/flow: 20/55] desktop-window-slot: override creation of views



commit fb6ab261a8c022a2718738cfaf4cfe5bfc2ca033
Author: Carlos Soriano <csoriano gnome org>
Date:   Tue Mar 22 13:41:47 2016 +0100

    desktop-window-slot: override creation of views
    
    Now that we can create our own custom views in subclasses of the window
    slot, we can remove the special casing for subclasses in window slot and
    instead use inheritance for it.
    
    This commit move the creation of the desktop view to the desktop slot.

 src/nautilus-desktop-window-slot.c |   11 +++++++++++
 src/nautilus-files-view.c          |    7 -------
 2 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/src/nautilus-desktop-window-slot.c b/src/nautilus-desktop-window-slot.c
index 5a2d4f1..728e850 100644
--- a/src/nautilus-desktop-window-slot.c
+++ b/src/nautilus-desktop-window-slot.c
@@ -17,6 +17,7 @@
  */
 
 #include "nautilus-desktop-window-slot.h"
+#include "nautilus-desktop-canvas-view.h"
 
 struct _NautilusDesktopWindowSlot
 {
@@ -25,6 +26,13 @@ struct _NautilusDesktopWindowSlot
 
 G_DEFINE_TYPE (NautilusDesktopWindowSlot, nautilus_desktop_window_slot, NAUTILUS_TYPE_WINDOW_SLOT)
 
+static NautilusView *
+real_get_view_for_location (NautilusWindowSlot *self,
+                            GFile              *location)
+{
+  return NAUTILUS_VIEW (nautilus_desktop_canvas_view_new (self));
+}
+
 NautilusDesktopWindowSlot *
 nautilus_desktop_window_slot_new (NautilusWindow *window)
 {
@@ -36,6 +44,9 @@ nautilus_desktop_window_slot_new (NautilusWindow *window)
 static void
 nautilus_desktop_window_slot_class_init (NautilusDesktopWindowSlotClass *klass)
 {
+  NautilusWindowSlotClass *parent_class = NAUTILUS_WINDOW_SLOT_CLASS (klass);
+
+  parent_class->get_view_for_location = real_get_view_for_location;
 }
 
 static void
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 8a22489..9f186b9 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -28,7 +28,6 @@
 #include "nautilus-files-view.h"
 
 #include "nautilus-application.h"
-#include "nautilus-desktop-canvas-view.h"
 #include "nautilus-error-reporting.h"
 #include "nautilus-floating-bar.h"
 #include "nautilus-list-view.h"
@@ -69,8 +68,6 @@
 #include <libnautilus-extension/nautilus-menu-provider.h>
 #include <libnautilus-private/nautilus-clipboard.h>
 #include <libnautilus-private/nautilus-clipboard-monitor.h>
-#include <libnautilus-private/nautilus-desktop-icon-file.h>
-#include <libnautilus-private/nautilus-desktop-directory.h>
 #include <libnautilus-private/nautilus-search-directory.h>
 #include <libnautilus-private/nautilus-directory.h>
 #include <libnautilus-private/nautilus-dnd.h>
@@ -91,7 +88,6 @@
 #include <libnautilus-private/nautilus-signaller.h>
 #include <libnautilus-private/nautilus-icon-names.h>
 
-#define GNOME_DESKTOP_USE_UNSTABLE_API
 #include <gdesktop-enums.h>
 
 #define DEBUG_FLAG NAUTILUS_DEBUG_DIRECTORY_VIEW
@@ -8245,9 +8241,6 @@ nautilus_files_view_new (guint                id,
         case NAUTILUS_VIEW_LIST_ID:
                 view = nautilus_list_view_new (slot);
         break;
-        case NAUTILUS_VIEW_DESKTOP_ID:
-                view = nautilus_desktop_canvas_view_new (slot);
-        break;
 #if ENABLE_EMPTY_VIEW
         case NAUTILUS_VIEW_EMPTY_ID:
                 view = nautilus_empty_view_new (slot);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]