[nautilus/wip/csoriano/flow: 49/55] canvas-view: allow creation of canvas view container subclasses
- From: Carlos Soriano Sánchez <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/csoriano/flow: 49/55] canvas-view: allow creation of canvas view container subclasses
- Date: Thu, 7 Apr 2016 20:55:29 +0000 (UTC)
commit 250cfb654f44d5e7b0d6ce6562802f9797958dd7
Author: Carlos Soriano <csoriano gnome org>
Date: Mon Apr 4 11:14:11 2016 +0200
canvas-view: allow creation of canvas view container subclasses
This will be used by the desktop, so it can use its own
canvas-view-container.
src/nautilus-canvas-view.c | 20 ++++++++++++++++----
src/nautilus-canvas-view.h | 2 ++
2 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/src/nautilus-canvas-view.c b/src/nautilus-canvas-view.c
index d9ae065..a72b4b5 100644
--- a/src/nautilus-canvas-view.c
+++ b/src/nautilus-canvas-view.c
@@ -1639,11 +1639,22 @@ store_layout_timestamp (NautilusCanvasContainer *container,
static NautilusCanvasContainer *
create_canvas_container (NautilusCanvasView *canvas_view)
{
- NautilusCanvasContainer *canvas_container;
+ return NAUTILUS_CANVAS_VIEW_CLASS (G_OBJECT_GET_CLASS (canvas_view))->create_canvas_container
(canvas_view);
+}
+
+static NautilusCanvasContainer *
+real_create_canvas_container (NautilusCanvasView *canvas_view)
+{
+ return nautilus_canvas_view_container_new (canvas_view);
+}
+
+static void
+initialize_canvas_container (NautilusCanvasView *canvas_view,
+ NautilusCanvasContainer *canvas_container)
+{
GtkWidget *content_widget;
content_widget = nautilus_files_view_get_content_widget (NAUTILUS_FILES_VIEW (canvas_view));
- canvas_container = nautilus_canvas_view_container_new (canvas_view);
canvas_view->details->canvas_container = GTK_WIDGET (canvas_container);
g_object_add_weak_pointer (G_OBJECT (canvas_container),
(gpointer *) &canvas_view->details->canvas_container);
@@ -1705,8 +1716,6 @@ create_canvas_container (NautilusCanvasView *canvas_view)
get_default_zoom_level (canvas_view));
gtk_widget_show (GTK_WIDGET (canvas_container));
-
- return canvas_container;
}
/* Handles an URL received from Mozilla */
@@ -1876,6 +1885,8 @@ nautilus_canvas_view_class_init (NautilusCanvasViewClass *klass)
oclass->finalize = nautilus_canvas_view_finalize;
GTK_WIDGET_CLASS (klass)->destroy = nautilus_canvas_view_destroy;
+
+ klass->create_canvas_container = real_create_canvas_container;
nautilus_files_view_class->add_file = nautilus_canvas_view_add_file;
nautilus_files_view_class->begin_loading = nautilus_canvas_view_begin_loading;
@@ -1950,6 +1961,7 @@ nautilus_canvas_view_init (NautilusCanvasView *canvas_view)
canvas_view->details->icon = g_themed_icon_new ("view-grid-symbolic");
canvas_container = create_canvas_container (canvas_view);
+ initialize_canvas_container (canvas_view, canvas_container);
g_signal_connect_swapped (nautilus_preferences,
"changed::" NAUTILUS_PREFERENCES_DEFAULT_SORT_ORDER,
diff --git a/src/nautilus-canvas-view.h b/src/nautilus-canvas-view.h
index 994b51f..3e515b4 100644
--- a/src/nautilus-canvas-view.h
+++ b/src/nautilus-canvas-view.h
@@ -52,6 +52,8 @@ struct NautilusCanvasView {
struct NautilusCanvasViewClass {
NautilusFilesViewClass parent_class;
+
+ NautilusCanvasContainer * (* create_canvas_container) (NautilusCanvasView *canvas_view);
};
/* GObject support */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]