[nautilus/wip/csoriano/desktop-split: 51/53] desktop-canvas-view-container: override get icon description



commit 1c4f69b4edbf446ff7a42b14e0ebb0111139484d
Author: Carlos Soriano <csoriano gnome org>
Date:   Mon Apr 4 12:33:03 2016 +0200

    desktop-canvas-view-container: override get icon description
    
    Now that we have a subclass we can override the function instead of
    special casing in the parent.

 src/nautilus-canvas-view-container.c         |    4 ----
 src/nautilus-desktop-canvas-view-container.c |   24 ++++++++++++++++++++++++
 2 files changed, 24 insertions(+), 4 deletions(-)
---
diff --git a/src/nautilus-canvas-view-container.c b/src/nautilus-canvas-view-container.c
index 03c6ecf..a56ec66 100644
--- a/src/nautilus-canvas-view-container.c
+++ b/src/nautilus-canvas-view-container.c
@@ -85,10 +85,6 @@ nautilus_canvas_view_container_get_icon_description (NautilusCanvasContainer *co
        file = NAUTILUS_FILE (data);
        g_assert (NAUTILUS_IS_FILE (file));
 
-       if (NAUTILUS_IS_DESKTOP_ICON_FILE (file)) {
-               return NULL;
-       }
-
        mime_type = nautilus_file_get_mime_type (file);
        description = g_content_type_get_description (mime_type);
        g_free (mime_type);
diff --git a/src/nautilus-desktop-canvas-view-container.c b/src/nautilus-desktop-canvas-view-container.c
index f0960ff..48e6f95 100644
--- a/src/nautilus-desktop-canvas-view-container.c
+++ b/src/nautilus-desktop-canvas-view-container.c
@@ -17,6 +17,7 @@
  */
 
 #include "nautilus-desktop-canvas-view-container.h"
+#include "nautilus-desktop-icon-file.h"
 
 struct _NautilusDesktopCanvasViewContainer
 {
@@ -25,6 +26,26 @@ struct _NautilusDesktopCanvasViewContainer
 
 G_DEFINE_TYPE (NautilusDesktopCanvasViewContainer, nautilus_desktop_canvas_view_container, 
NAUTILUS_TYPE_CANVAS_VIEW_CONTAINER)
 
+static char *
+real_get_icon_description (NautilusCanvasContainer *container,
+                           NautilusCanvasIconData  *data)
+{
+  NautilusFile *file;
+
+  file = NAUTILUS_FILE (data);
+  g_assert (NAUTILUS_IS_FILE (file));
+
+  if (NAUTILUS_IS_DESKTOP_ICON_FILE (file))
+    {
+      return NULL;
+    }
+  else
+    {
+      return NAUTILUS_CANVAS_CONTAINER_CLASS (G_OBJECT_GET_CLASS (container))->get_icon_description 
(container,
+                                                                                                     data);
+    }
+}
+
 NautilusDesktopCanvasViewContainer *
 nautilus_desktop_canvas_view_container_new (void)
 {
@@ -34,6 +55,9 @@ nautilus_desktop_canvas_view_container_new (void)
 static void
 nautilus_desktop_canvas_view_container_class_init (NautilusDesktopCanvasViewContainerClass *klass)
 {
+  NautilusCanvasContainerClass *container_class = NAUTILUS_CANVAS_CONTAINER_CLASS (klass);
+
+  container_class->get_icon_description = real_get_icon_description;
 }
 
 static void


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