summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Soriano <csoriano@gnome.org>2016-04-04 11:43:24 +0200
committerCarlos Soriano <csoriano@gnome.org>2016-04-06 10:58:22 +0200
commit0244e98146f862ea2ebdc5191f1889d36d284a56 (patch)
tree5920bb8a911a1b9ce2f2d7885b2e406423d4cdde
parent0b2fa2fae19cce930628222b0fb049e1595bd0d8 (diff)
downloadnautilus-0244e98146f862ea2ebdc5191f1889d36d284a56.tar.gz
desktop-canvas-view: override canvas container creation
So we can use a subclass for the desktop. This will be necessary in upcoming patches in order to handle the special links on desktop that currently are done special casing inside the parent canvas view container.
-rw-r--r--src/Makefile.am2
-rw-r--r--src/nautilus-desktop-canvas-view-container.c42
-rw-r--r--src/nautilus-desktop-canvas-view-container.h35
-rw-r--r--src/nautilus-desktop-canvas-view.c12
4 files changed, 91 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index f00957c34..e10e7edef 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -152,6 +152,8 @@ nautilus_no_main_sources = \
nautilus-dbus-manager.h \
nautilus-desktop-canvas-view.c \
nautilus-desktop-canvas-view.h \
+ nautilus-desktop-canvas-view-container.c \
+ nautilus-desktop-canvas-view-container.h \
nautilus-desktop-item-properties.c \
nautilus-desktop-item-properties.h \
nautilus-desktop-window.c \
diff --git a/src/nautilus-desktop-canvas-view-container.c b/src/nautilus-desktop-canvas-view-container.c
new file mode 100644
index 000000000..f0960ffaf
--- /dev/null
+++ b/src/nautilus-desktop-canvas-view-container.c
@@ -0,0 +1,42 @@
+/* nautilus-desktop-canvas-view-container.c
+ *
+ * Copyright (C) 2016 Carlos Soriano <csoriano@gnome.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "nautilus-desktop-canvas-view-container.h"
+
+struct _NautilusDesktopCanvasViewContainer
+{
+ NautilusCanvasViewContainer parent_instance;
+};
+
+G_DEFINE_TYPE (NautilusDesktopCanvasViewContainer, nautilus_desktop_canvas_view_container, NAUTILUS_TYPE_CANVAS_VIEW_CONTAINER)
+
+NautilusDesktopCanvasViewContainer *
+nautilus_desktop_canvas_view_container_new (void)
+{
+ return g_object_new (NAUTILUS_TYPE_DESKTOP_CANVAS_VIEW_CONTAINER, NULL);
+}
+
+static void
+nautilus_desktop_canvas_view_container_class_init (NautilusDesktopCanvasViewContainerClass *klass)
+{
+}
+
+static void
+nautilus_desktop_canvas_view_container_init (NautilusDesktopCanvasViewContainer *self)
+{
+}
diff --git a/src/nautilus-desktop-canvas-view-container.h b/src/nautilus-desktop-canvas-view-container.h
new file mode 100644
index 000000000..018062b7d
--- /dev/null
+++ b/src/nautilus-desktop-canvas-view-container.h
@@ -0,0 +1,35 @@
+/* nautilus-desktop-canvas-view-container.h
+ *
+ * Copyright (C) 2016 Carlos Soriano <csoriano@gnome.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef NAUTILUS_DESKTOP_CANVAS_VIEW_CONTAINER_H
+#define NAUTILUS_DESKTOP_CANVAS_VIEW_CONTAINER_H
+
+#include <glib.h>
+#include "nautilus-canvas-view-container.h"
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_DESKTOP_CANVAS_VIEW_CONTAINER (nautilus_desktop_canvas_view_container_get_type())
+
+G_DECLARE_FINAL_TYPE (NautilusDesktopCanvasViewContainer, nautilus_desktop_canvas_view_container, NAUTILUS, DESKTOP_CANVAS_VIEW_CONTAINER, NautilusCanvasViewContainer)
+
+NautilusDesktopCanvasViewContainer *nautilus_desktop_canvas_view_container_new (void);
+
+G_END_DECLS
+
+#endif /* NAUTILUS_DESKTOP_CANVAS_VIEW_CONTAINER_H */
+
diff --git a/src/nautilus-desktop-canvas-view.c b/src/nautilus-desktop-canvas-view.c
index aaf96945b..b53ead937 100644
--- a/src/nautilus-desktop-canvas-view.c
+++ b/src/nautilus-desktop-canvas-view.c
@@ -28,6 +28,7 @@
#include "nautilus-desktop-canvas-view.h"
#include "nautilus-canvas-view-container.h"
+#include "nautilus-desktop-canvas-view-container.h"
#include "nautilus-files-view.h"
#include <X11/Xatom.h>
@@ -285,15 +286,26 @@ nautilus_desktop_canvas_view_end_loading (NautilusFilesView *view,
g_free (stored_size_icon);
}
+static NautilusCanvasContainer *
+real_create_canvas_container (NautilusCanvasView *canvas_view)
+{
+ return NAUTILUS_CANVAS_CONTAINER (nautilus_desktop_canvas_view_container_new ());
+}
+
static void
nautilus_desktop_canvas_view_class_init (NautilusDesktopCanvasViewClass *class)
{
NautilusFilesViewClass *vclass;
+ NautilusCanvasViewClass *parent_class;
vclass = NAUTILUS_FILES_VIEW_CLASS (class);
+ parent_class = NAUTILUS_CANVAS_VIEW_CLASS (class);
+
G_OBJECT_CLASS (class)->dispose = nautilus_desktop_canvas_view_dispose;
+ parent_class->create_canvas_container = real_create_canvas_container;
+
vclass->update_context_menus = real_update_context_menus;
vclass->get_view_id = real_get_id;
vclass->end_loading = nautilus_desktop_canvas_view_end_loading;