[nautilus] Introduce concept of a NautilusWindowPane



commit daa113b66fbf4193cdb049c11bd3df9f98f4ba0a
Author: Holger Berndt <berndth gmx de>
Date:   Fri Jan 30 14:16:56 2009 +0100

    Introduce concept of a NautilusWindowPane
    
    A pane is another layer around a slot. For spatial windows, a pane
    will contain a single slot. For navigation windows, a pane will contain a
    list of slots, as well as a corresponding toolbar items.

 src/Makefile.am               |    2 +
 src/nautilus-window-pane.c    |   68 +++++++++++++++++++++++++++++++++++++++++
 src/nautilus-window-pane.h    |   65 +++++++++++++++++++++++++++++++++++++++
 src/nautilus-window-private.h |   10 ++++++
 src/nautilus-window.c         |   14 ++++++++
 5 files changed, 159 insertions(+), 0 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index e7a18ac..bde398c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -125,6 +125,8 @@ nautilus_SOURCES = \
 	nautilus-window-manage-views.c		\
 	nautilus-window-manage-views.h		\
 	nautilus-window-menus.c         	\
+	nautilus-window-pane.c	\
+	nautilus-window-pane.h	\
 	nautilus-window-private.h		\
 	nautilus-window-slot.c			\
 	nautilus-window-slot.h			\
diff --git a/src/nautilus-window-pane.c b/src/nautilus-window-pane.c
new file mode 100644
index 0000000..cdb881e
--- /dev/null
+++ b/src/nautilus-window-pane.c
@@ -0,0 +1,68 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+
+   nautilus-window-pane.c: Nautilus window pane
+
+   Copyright (C) 2008 Free Software Foundation, Inc.
+
+   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 2 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, write to the
+   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.
+
+   Author: Holger Berndt <berndth gmx de>
+*/
+
+#include "nautilus-window-pane.h"
+
+static void nautilus_window_pane_init       (NautilusWindowPane *pane);
+static void nautilus_window_pane_class_init (NautilusWindowPaneClass *class);
+static void nautilus_window_pane_dispose    (GObject *object);
+
+G_DEFINE_TYPE (NautilusWindowPane,
+	       nautilus_window_pane,
+	       G_TYPE_OBJECT)
+#define parent_class nautilus_window_pane_parent_class
+
+
+static void
+nautilus_window_pane_init (NautilusWindowPane *pane)
+{
+}
+
+static void
+nautilus_window_pane_class_init (NautilusWindowPaneClass *class)
+{
+	G_OBJECT_CLASS (class)->dispose = nautilus_window_pane_dispose;
+}
+
+static void
+nautilus_window_pane_dispose (GObject *object)
+{
+	NautilusWindowPane *pane = NAUTILUS_WINDOW_PANE (object);
+
+	/* the slots list should now be empty */
+	g_assert (pane->slots == NULL);
+
+	pane->window = NULL;
+	G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+NautilusWindowPane *
+nautilus_window_pane_new (NautilusWindow *window)
+{
+	NautilusWindowPane *pane;
+
+	pane = g_object_new (NAUTILUS_TYPE_WINDOW_PANE, NULL);
+	pane->window = window;
+	return pane;
+}
diff --git a/src/nautilus-window-pane.h b/src/nautilus-window-pane.h
new file mode 100644
index 0000000..cae4ba3
--- /dev/null
+++ b/src/nautilus-window-pane.h
@@ -0,0 +1,65 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+
+   nautilus-window-pane.h: Nautilus window pane
+
+   Copyright (C) 2008 Free Software Foundation, Inc.
+
+   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 2 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, write to the
+   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.
+
+   Author: Holger Berndt <berndth gmx de>
+*/
+
+#ifndef NAUTILUS_WINDOW_PANE_H
+#define NAUTILUS_WINDOW_PANE_H
+
+#include "nautilus-window.h"
+
+#define NAUTILUS_TYPE_WINDOW_PANE	 (nautilus_window_pane_get_type())
+#define NAUTILUS_WINDOW_PANE_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), NAUTILUS_TYPE_WINDOW_PANE, NautilusWindowPaneClass))
+#define NAUTILUS_WINDOW_PANE(obj)	 (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_WINDOW_PANE, NautilusWindowPane))
+#define NAUTILUS_IS_WINDOW_PANE(obj)      (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_WINDOW_PANE))
+#define NAUTILUS_IS_WINDOW_PANE_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), NAUTILUS_TYPE_WINDOW_PANE))
+#define NAUTILUS_WINDOW_PANE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NAUTILUS_TYPE_WINDOW_PANE, NautilusWindowPaneClass))
+
+typedef struct _NautilusWindowPaneClass NautilusWindowPaneClass;
+typedef struct _NautilusWindowPane      NautilusWindowPane;
+
+struct _NautilusWindowPaneClass {
+	GObjectClass parent_class;
+};
+
+/* A NautilusWindowPane is a layer between a slot and a window.
+ * Each slot is contained in one pane, and each pane can contain
+ * one or more slots. It also supports the notion of an "active slot".
+ * On the other hand, each pane is contained in a window, while each
+ * window can contain one or multiple panes. Likewise, the window has
+ * the notion of an "active pane".
+ *
+ * A spatial window has only one pane, which contains a single slot.
+ * A navigation window may have one or more panes.
+ */
+struct _NautilusWindowPane {
+	GObject parent;
+
+	/* hosting window */
+	NautilusWindow *window;
+};
+
+GType nautilus_window_pane_get_type (void);
+NautilusWindowPane *nautilus_window_pane_new (NautilusWindow *window);
+
+
+#endif /* NAUTILUS_WINDOW_PANE_H */
diff --git a/src/nautilus-window-private.h b/src/nautilus-window-private.h
index c92c4bd..062775a 100644
--- a/src/nautilus-window-private.h
+++ b/src/nautilus-window-private.h
@@ -30,6 +30,7 @@
 
 #include "nautilus-window.h"
 #include "nautilus-window-slot.h"
+#include "nautilus-window-pane.h"
 #include "nautilus-spatial-window.h"
 #include "nautilus-navigation-window.h"
 
@@ -79,6 +80,12 @@ struct NautilusWindowDetails
 	 * is cancelled
 	 */
 	gboolean temporarily_ignore_view_signals;
+
+        /* available panes, and active pane.
+         * Both of them may never be NULL.
+         */
+        GList *panes;
+        NautilusWindowPane *active_pane;
 };
 
 struct _NautilusNavigationWindowDetails {
@@ -199,6 +206,9 @@ GList *              nautilus_window_get_slots                           (Nautil
 NautilusWindowSlot * nautilus_window_get_active_slot                     (NautilusWindow    *window);
 void                 nautilus_window_set_active_slot                     (NautilusWindow     *window,
 									  NautilusWindowSlot *slot);
+void                 nautilus_window_set_active_pane                     (NautilusWindow *window,
+                                                                          NautilusWindowPane *new_pane);
+NautilusWindowPane * nautilus_window_get_active_pane                     (NautilusWindow *window);
 
 void               nautilus_send_history_list_changed                    (void);
 void               nautilus_remove_from_history_list_no_notify           (GFile             *location);
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 11f95d2..8acca39 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -740,6 +740,20 @@ nautilus_window_close_slot (NautilusWindow *window,
 
 }
 
+NautilusWindowPane*
+nautilus_window_get_active_pane (NautilusWindow *window)
+{
+	g_assert (NAUTILUS_IS_WINDOW (window));
+	return window->details->active_pane;
+}
+
+void
+nautilus_window_set_active_pane (NautilusWindow *window,
+				 NautilusWindowPane *new_pane)
+{
+	/* hhb: TODO: not yet implemented */
+}
+
 void
 nautilus_window_set_active_slot (NautilusWindow *window,
 				 NautilusWindowSlot *new_slot)



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