[nautilus/wip/csoriano/desktop-split: 50/53] desktop-canvas-view: override canvas container creation
- From: Carlos Soriano Sánchez <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/csoriano/desktop-split: 50/53] desktop-canvas-view: override canvas container creation
- Date: Wed, 6 Apr 2016 09:08:47 +0000 (UTC)
commit 0244e98146f862ea2ebdc5191f1889d36d284a56
Author: Carlos Soriano <csoriano gnome org>
Date: Mon Apr 4 11:43:24 2016 +0200
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.
src/Makefile.am | 2 +
src/nautilus-desktop-canvas-view-container.c | 42 ++++++++++++++++++++++++++
src/nautilus-desktop-canvas-view-container.h | 35 +++++++++++++++++++++
src/nautilus-desktop-canvas-view.c | 12 +++++++
4 files changed, 91 insertions(+), 0 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index f00957c..e10e7ed 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 0000000..f0960ff
--- /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 0000000..018062b
--- /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 aaf9694..b53ead9 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]