nautilus r13961 - in branches/multiview: . libnautilus-private src src/file-manager
- From: cneumair svn gnome org
- To: svn-commits-list gnome org
- Subject: nautilus r13961 - in branches/multiview: . libnautilus-private src src/file-manager
- Date: Thu, 20 Mar 2008 23:38:02 +0000 (GMT)
Author: cneumair
Date: Thu Mar 20 23:38:01 2008
New Revision: 13961
URL: http://svn.gnome.org/viewvc/nautilus?rev=13961&view=rev
Log:
2008-03-20 Chrisian Neumair <cneumair gnome-de org>
* src/*.[ch]:
* libnautilus-private/*.[ch]:
Added:
* src/nautilus-window-slot.[ch]:
* src/nautilus-navigation-window-slot.[ch]:
* libnautilus-private/nautilus-window-slot-info.[ch]:
Add initial implementation of view slots, port all the
existing view switching code to it.
Each slot corresponds to a location that can be used to
display view widgets.
A slot contains all view-specific data, and connects
windows, sidebar panels and views.
For now, all Nautilus windows just have one slot. The
idea is that navigation windows will have a tabbed interfaces,
and each slot will be corresponde to a separate tab.
Added:
branches/multiview/libnautilus-private/nautilus-window-slot-info.c
branches/multiview/libnautilus-private/nautilus-window-slot-info.h
branches/multiview/src/nautilus-navigation-window-slot.c
branches/multiview/src/nautilus-navigation-window-slot.h
branches/multiview/src/nautilus-window-slot.c
branches/multiview/src/nautilus-window-slot.h
Modified:
branches/multiview/ChangeLog
branches/multiview/libnautilus-private/Makefile.am
branches/multiview/libnautilus-private/nautilus-mime-actions.c
branches/multiview/libnautilus-private/nautilus-mime-actions.h
branches/multiview/libnautilus-private/nautilus-view-factory.c
branches/multiview/libnautilus-private/nautilus-view-factory.h
branches/multiview/libnautilus-private/nautilus-window-info.c
branches/multiview/libnautilus-private/nautilus-window-info.h
branches/multiview/src/Makefile.am
branches/multiview/src/file-manager/fm-desktop-icon-view.c
branches/multiview/src/file-manager/fm-directory-view.c
branches/multiview/src/file-manager/fm-directory-view.h
branches/multiview/src/file-manager/fm-empty-view.c
branches/multiview/src/file-manager/fm-icon-view.c
branches/multiview/src/file-manager/fm-list-view.c
branches/multiview/src/file-manager/fm-tree-view.c
branches/multiview/src/nautilus-application.c
branches/multiview/src/nautilus-desktop-window.c
branches/multiview/src/nautilus-history-sidebar.c
branches/multiview/src/nautilus-information-panel.c
branches/multiview/src/nautilus-location-bar.c
branches/multiview/src/nautilus-location-dialog.c
branches/multiview/src/nautilus-navigation-action.c
branches/multiview/src/nautilus-navigation-window-menus.c
branches/multiview/src/nautilus-navigation-window.c
branches/multiview/src/nautilus-navigation-window.h
branches/multiview/src/nautilus-notes-viewer.c
branches/multiview/src/nautilus-places-sidebar.c
branches/multiview/src/nautilus-shell.c
branches/multiview/src/nautilus-spatial-window.c
branches/multiview/src/nautilus-window-bookmarks.c
branches/multiview/src/nautilus-window-manage-views.c
branches/multiview/src/nautilus-window-manage-views.h
branches/multiview/src/nautilus-window-menus.c
branches/multiview/src/nautilus-window-private.h
branches/multiview/src/nautilus-window-toolbars.c
branches/multiview/src/nautilus-window.c
branches/multiview/src/nautilus-window.h
Modified: branches/multiview/libnautilus-private/Makefile.am
==============================================================================
--- branches/multiview/libnautilus-private/Makefile.am (original)
+++ branches/multiview/libnautilus-private/Makefile.am Thu Mar 20 23:38:01 2008
@@ -195,6 +195,8 @@
nautilus-view.h \
nautilus-window-info.c \
nautilus-window-info.h \
+ nautilus-window-slot-info.c \
+ nautilus-window-slot-info.h \
$(NULL)
BEAGLE_SOURCES = \
Modified: branches/multiview/libnautilus-private/nautilus-mime-actions.c
==============================================================================
--- branches/multiview/libnautilus-private/nautilus-mime-actions.c (original)
+++ branches/multiview/libnautilus-private/nautilus-mime-actions.c Thu Mar 20 23:38:01 2008
@@ -59,7 +59,8 @@
} ApplicationLaunchParameters;
typedef struct {
- NautilusWindowInfo *window_info;
+ NautilusWindowSlotInfo *slot_info;
+ gpointer window_info;
GtkWindow *parent_window;
GCancellable *cancellable;
GList *files;
@@ -910,8 +911,8 @@
eel_timed_wait_stop (cancel_activate_callback, parameters);
}
- if (parameters->window_info) {
- g_object_remove_weak_pointer (G_OBJECT (parameters->window_info), (gpointer *)¶meters->window_info);
+ if (parameters->slot_info) {
+ g_object_remove_weak_pointer (G_OBJECT (parameters->slot_info), (gpointer *)¶meters->slot_info);
}
if (parameters->parent_window) {
g_object_remove_weak_pointer (G_OBJECT (parameters->parent_window), (gpointer *)¶meters->parent_window);
@@ -1000,6 +1001,7 @@
static void
activate_files (ActivateParameters *parameters)
{
+ NautilusWindowInfo *window_info;
NautilusFile *file;
GList *launch_desktop_files;
GList *launch_files;
@@ -1133,7 +1135,7 @@
open_in_view_files = g_list_reverse (open_in_view_files);
count = g_list_length (open_in_view_files);
- if (parameters->window_info != NULL &&
+ if (parameters->slot_info != NULL &&
confirm_multiple_windows (parameters->parent_window, count)) {
NautilusWindowOpenFlags flags;
@@ -1150,8 +1152,8 @@
uri = nautilus_file_get_activation_uri (file);
f = g_file_new_for_uri (uri);
- nautilus_window_info_open_location (parameters->window_info,
- f, parameters->mode, flags, NULL);
+ nautilus_window_slot_info_open_location (parameters->slot_info,
+ f, parameters->mode, flags, NULL);
g_object_unref (f);
g_free (uri);
}
@@ -1207,12 +1209,17 @@
g_free (error_message);
}
+ window_info = NULL;
+ if (parameters->slot_info != NULL) {
+ window_info = nautilus_window_slot_info_get_window (parameters->slot_info);
+ }
+
if (open_in_app_parameters != NULL ||
unhandled_open_in_app_files != NULL) {
if ((parameters->flags & NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND) != 0 &&
- parameters->window_info != NULL &&
- nautilus_window_info_get_window_type (parameters->window_info) == NAUTILUS_WINDOW_SPATIAL) {
- nautilus_window_info_close (parameters->window_info);
+ window_info != NULL &&
+ nautilus_window_info_get_window_type (window_info) == NAUTILUS_WINDOW_SPATIAL) {
+ nautilus_window_info_close (window_info);
}
}
@@ -1534,7 +1541,7 @@
**/
void
nautilus_mime_activate_files (GtkWindow *parent_window,
- NautilusWindowInfo *window_info,
+ NautilusWindowSlotInfo *slot_info,
GList *files,
const char *launch_directory,
NautilusWindowOpenMode mode,
@@ -1555,8 +1562,8 @@
parent_window);
parameters = g_new0 (ActivateParameters, 1);
- parameters->window_info = window_info;
- g_object_add_weak_pointer (G_OBJECT (parameters->window_info), (gpointer *)¶meters->window_info);
+ parameters->slot_info = slot_info;
+ g_object_add_weak_pointer (G_OBJECT (parameters->slot_info), (gpointer *)¶meters->slot_info);
if (parent_window) {
parameters->parent_window = parent_window;
g_object_add_weak_pointer (G_OBJECT (parameters->parent_window), (gpointer *)¶meters->parent_window);
@@ -1607,7 +1614,7 @@
void
nautilus_mime_activate_file (GtkWindow *parent_window,
- NautilusWindowInfo *window_info,
+ NautilusWindowSlotInfo *slot_info,
NautilusFile *file,
const char *launch_directory,
NautilusWindowOpenMode mode,
@@ -1618,6 +1625,6 @@
g_return_if_fail (NAUTILUS_IS_FILE (file));
files = g_list_prepend (NULL, file);
- nautilus_mime_activate_files (parent_window, window_info, files, launch_directory, mode, flags);
+ nautilus_mime_activate_files (parent_window, slot_info, files, launch_directory, mode, flags);
g_list_free (files);
}
Modified: branches/multiview/libnautilus-private/nautilus-mime-actions.h
==============================================================================
--- branches/multiview/libnautilus-private/nautilus-mime-actions.h (original)
+++ branches/multiview/libnautilus-private/nautilus-mime-actions.h Thu Mar 20 23:38:01 2008
@@ -29,6 +29,7 @@
#include <libnautilus-private/nautilus-file.h>
#include <libnautilus-private/nautilus-window-info.h>
+#include <libnautilus-private/nautilus-window-slot-info.h>
NautilusFileAttributes nautilus_mime_actions_get_required_file_attributes (void);
@@ -44,13 +45,13 @@
gboolean nautilus_mime_file_opens_in_view (NautilusFile *file);
gboolean nautilus_mime_file_opens_in_external_app (NautilusFile *file);
void nautilus_mime_activate_files (GtkWindow *parent_window,
- NautilusWindowInfo *window_info,
+ NautilusWindowSlotInfo *slot_info,
GList *files,
const char *launch_directory,
NautilusWindowOpenMode mode,
NautilusWindowOpenFlags flags);
void nautilus_mime_activate_file (GtkWindow *parent_window,
- NautilusWindowInfo *window_info,
+ NautilusWindowSlotInfo *slot_info,
NautilusFile *file,
const char *launch_directory,
NautilusWindowOpenMode mode,
Modified: branches/multiview/libnautilus-private/nautilus-view-factory.c
==============================================================================
--- branches/multiview/libnautilus-private/nautilus-view-factory.c (original)
+++ branches/multiview/libnautilus-private/nautilus-view-factory.c Thu Mar 20 23:38:01 2008
@@ -57,7 +57,7 @@
NautilusView *
nautilus_view_factory_create (const char *id,
- NautilusWindowInfo *window)
+ NautilusWindowSlotInfo *slot)
{
const NautilusViewInfo *view_info;
@@ -66,7 +66,7 @@
return NULL;
}
- return view_info->create (window);
+ return view_info->create (slot);
}
gboolean
Modified: branches/multiview/libnautilus-private/nautilus-view-factory.h
==============================================================================
--- branches/multiview/libnautilus-private/nautilus-view-factory.h (original)
+++ branches/multiview/libnautilus-private/nautilus-view-factory.h Thu Mar 20 23:38:01 2008
@@ -28,7 +28,7 @@
#include <string.h>
#include <libnautilus-private/nautilus-view.h>
-#include <libnautilus-private/nautilus-window-info.h>
+#include <libnautilus-private/nautilus-window-slot-info.h>
#include <gio/gio.h>
G_BEGIN_DECLS
@@ -43,7 +43,7 @@
char *error_label; /* The foo view encountered an error. */
char *startup_error_label; /* The foo view encountered an error while starting up. */
char *display_location_label; /* Display this location with the foo view. */
- NautilusView * (*create) (NautilusWindowInfo *window);
+ NautilusView * (*create) (NautilusWindowSlotInfo *slot);
/* BONOBOTODO: More args here */
gboolean (*supports_uri) (const char *uri,
GFileType file_type,
@@ -54,7 +54,7 @@
void nautilus_view_factory_register (NautilusViewInfo *view_info);
const NautilusViewInfo *nautilus_view_factory_lookup (const char *id);
NautilusView * nautilus_view_factory_create (const char *id,
- NautilusWindowInfo *window);
+ NautilusWindowSlotInfo *slot);
gboolean nautilus_view_factory_view_supports_uri (const char *id,
GFile *location,
GFileType file_type,
Modified: branches/multiview/libnautilus-private/nautilus-window-info.c
==============================================================================
--- branches/multiview/libnautilus-private/nautilus-window-info.c (original)
+++ branches/multiview/libnautilus-private/nautilus-window-info.c Thu Mar 20 23:38:01 2008
@@ -152,22 +152,6 @@
}
void
-nautilus_window_info_open_location (NautilusWindowInfo *window,
- GFile *location,
- NautilusWindowOpenMode mode,
- NautilusWindowOpenFlags flags,
- GList *selection)
-{
- g_return_if_fail (NAUTILUS_IS_WINDOW_INFO (window));
-
- (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->open_location) (window,
- location,
- mode,
- flags,
- selection);
-}
-
-void
nautilus_window_info_show_window (NautilusWindowInfo *window)
{
g_return_if_fail (NAUTILUS_IS_WINDOW_INFO (window));
@@ -184,13 +168,13 @@
}
void
-nautilus_window_info_set_status (NautilusWindowInfo *window,
- const char *status)
+nautilus_window_info_push_status (NautilusWindowInfo *window,
+ const char *status)
{
g_return_if_fail (NAUTILUS_IS_WINDOW_INFO (window));
- (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->set_status) (window,
- status);
+ (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->push_status) (window,
+ status);
}
NautilusWindowType
@@ -276,3 +260,11 @@
return (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->get_ui_manager) (window);
}
+NautilusWindowSlotInfo *
+nautilus_window_info_get_active_slot (NautilusWindowInfo *window)
+{
+ g_return_val_if_fail (NAUTILUS_IS_WINDOW_INFO (window), NULL);
+
+ return (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->get_active_slot) (window);
+}
+
Modified: branches/multiview/libnautilus-private/nautilus-window-info.h
==============================================================================
--- branches/multiview/libnautilus-private/nautilus-window-info.h (original)
+++ branches/multiview/libnautilus-private/nautilus-window-info.h Thu Mar 20 23:38:01 2008
@@ -71,6 +71,13 @@
typedef struct NautilusWindow NautilusWindow;
#endif
+#ifndef NAUTILUS_WINDOW_SLOT_DEFINED
+#define NAUTILUS_WINDOW_SLOT_DEFINED
+typedef struct NautilusWindowSlot NautilusWindowSlot;
+#endif
+
+
+typedef NautilusWindowSlot NautilusWindowSlotInfo;
typedef NautilusWindow NautilusWindowInfo;
typedef struct _NautilusWindowInfoIface NautilusWindowInfoIface;
@@ -115,7 +122,7 @@
GList *(* get_selection) (NautilusWindowInfo *window);
char * (* get_current_location) (NautilusWindowInfo *window);
- void (* set_status) (NautilusWindowInfo *window,
+ void (* push_status) (NautilusWindowInfo *window,
const char *status);
char * (* get_title) (NautilusWindowInfo *window);
GList *(* get_history) (NautilusWindowInfo *window);
@@ -128,11 +135,8 @@
void (* set_hidden_files_mode) (NautilusWindowInfo *window,
NautilusWindowShowHiddenFilesMode mode);
- void (* open_location) (NautilusWindowInfo *window,
- GFile *location,
- NautilusWindowOpenMode mode,
- NautilusWindowOpenFlags flags,
- GList *selection);
+ NautilusWindowSlotInfo * (* get_active_slot) (NautilusWindowInfo *window);
+
void (* show_window) (NautilusWindowInfo *window);
void (* close_window) (NautilusWindowInfo *window);
GtkUIManager * (* get_ui_manager) (NautilusWindowInfo *window);
@@ -146,14 +150,10 @@
void nautilus_window_info_report_view_failed (NautilusWindowInfo *window,
NautilusView *view);
void nautilus_window_info_report_selection_changed (NautilusWindowInfo *window);
-void nautilus_window_info_open_location (NautilusWindowInfo *window,
- GFile *location,
- NautilusWindowOpenMode mode,
- NautilusWindowOpenFlags flags,
- GList *selection);
+NautilusWindowSlotInfo * nautilus_window_info_get_active_slot (NautilusWindowInfo *window);
void nautilus_window_info_show_window (NautilusWindowInfo *window);
void nautilus_window_info_close (NautilusWindowInfo *window);
-void nautilus_window_info_set_status (NautilusWindowInfo *window,
+void nautilus_window_info_push_status (NautilusWindowInfo *window,
const char *status);
NautilusWindowType nautilus_window_info_get_window_type (NautilusWindowInfo *window);
char * nautilus_window_info_get_title (NautilusWindowInfo *window);
Added: branches/multiview/libnautilus-private/nautilus-window-slot-info.c
==============================================================================
--- (empty file)
+++ branches/multiview/libnautilus-private/nautilus-window-slot-info.c Thu Mar 20 23:38:01 2008
@@ -0,0 +1,139 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+
+ nautilus-window-slot-info.c: Interface for nautilus window slots
+
+ 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: Christian Neumair <cneumair gnome org>
+*/
+#include "nautilus-window-slot-info.h"
+
+enum {
+ ACTIVE,
+ INACTIVE,
+ LAST_SIGNAL
+};
+
+static guint nautilus_window_slot_info_signals[LAST_SIGNAL] = { 0 };
+
+static void
+nautilus_window_slot_info_base_init (gpointer g_class)
+{
+ static gboolean initialized = FALSE;
+
+ if (!initialized) {
+ nautilus_window_slot_info_signals[ACTIVE] =
+ g_signal_new ("active",
+ NAUTILUS_TYPE_WINDOW_SLOT_INFO,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (NautilusWindowSlotInfoIface, active),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ nautilus_window_slot_info_signals[INACTIVE] =
+ g_signal_new ("inactive",
+ NAUTILUS_TYPE_WINDOW_SLOT_INFO,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (NautilusWindowSlotInfoIface, inactive),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ initialized = TRUE;
+ }
+}
+
+GType
+nautilus_window_slot_info_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type) {
+ const GTypeInfo info = {
+ sizeof (NautilusWindowSlotInfoIface),
+ nautilus_window_slot_info_base_init,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ 0,
+ 0,
+ NULL
+ };
+
+ type = g_type_register_static (G_TYPE_INTERFACE,
+ "NautilusWindowSlotInfo",
+ &info, 0);
+ g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
+ }
+
+ return type;
+}
+
+void
+nautilus_window_slot_info_set_status (NautilusWindowSlotInfo *slot,
+ const char *status)
+{
+ g_assert (NAUTILUS_IS_WINDOW_SLOT_INFO (slot));
+
+ (* NAUTILUS_WINDOW_SLOT_INFO_GET_IFACE (slot)->set_status) (slot,
+ status);
+}
+
+
+void
+nautilus_window_slot_info_open_location (NautilusWindowSlotInfo *slot,
+ GFile *location,
+ NautilusWindowOpenMode mode,
+ NautilusWindowOpenFlags flags,
+ GList *selection)
+{
+ g_assert (NAUTILUS_IS_WINDOW_SLOT_INFO (slot));
+
+ (* NAUTILUS_WINDOW_SLOT_INFO_GET_IFACE (slot)->open_location) (slot,
+ location,
+ mode,
+ flags,
+ selection);
+}
+
+char *
+nautilus_window_slot_info_get_title (NautilusWindowSlotInfo *slot)
+{
+ g_assert (NAUTILUS_IS_WINDOW_SLOT_INFO (slot));
+
+ return (* NAUTILUS_WINDOW_SLOT_INFO_GET_IFACE (slot)->get_title) (slot);
+}
+
+char *
+nautilus_window_slot_info_get_current_location (NautilusWindowSlotInfo *slot)
+{
+ g_assert (NAUTILUS_IS_WINDOW_SLOT_INFO (slot));
+
+ return (* NAUTILUS_WINDOW_SLOT_INFO_GET_IFACE (slot)->get_current_location) (slot);
+}
+
+NautilusWindowInfo *
+nautilus_window_slot_info_get_window (NautilusWindowSlotInfo *slot)
+{
+ g_assert (NAUTILUS_IS_WINDOW_SLOT_INFO (slot));
+
+ return (* NAUTILUS_WINDOW_SLOT_INFO_GET_IFACE (slot)->get_window) (slot);
+}
+
Added: branches/multiview/libnautilus-private/nautilus-window-slot-info.h
==============================================================================
--- (empty file)
+++ branches/multiview/libnautilus-private/nautilus-window-slot-info.h Thu Mar 20 23:38:01 2008
@@ -0,0 +1,92 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+
+ nautilus-window-slot-info.h: Interface for nautilus window slots
+
+ 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: Christian Neumair <cneumair gnome org>
+*/
+
+#ifndef NAUTILUS_WINDOW_SLOT_INFO_H
+#define NAUTILUS_WINDOW_SLOT_INFO_H
+
+#include "nautilus-window-info.h"
+
+
+#define NAUTILUS_TYPE_WINDOW_SLOT_INFO (nautilus_window_slot_info_get_type ())
+#define NAUTILUS_WINDOW_SLOT_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_WINDOW_SLOT_INFO, NautilusWindowSlotInfo))
+#define NAUTILUS_IS_WINDOW_SLOT_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_WINDOW_SLOT_INFO))
+#define NAUTILUS_WINDOW_SLOT_INFO_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NAUTILUS_TYPE_WINDOW_SLOT_INFO, NautilusWindowSlotInfoIface))
+
+typedef struct _NautilusWindowSlotInfoIface NautilusWindowSlotInfoIface;
+
+struct _NautilusWindowSlotInfoIface
+{
+ GTypeInterface g_iface;
+
+ /* signals */
+
+ /* emitted right after this slot becomes active.
+ * Views should connect to this signal and merge their UI
+ * into the main window.
+ */
+ void (* active) (NautilusWindowSlotInfo *slot);
+ /* emitted right before this slot becomes inactive.
+ * Views should connect to this signal and unmerge their UI
+ * from the main window.
+ */
+ void (* inactive) (NautilusWindowSlotInfo *slot);
+
+ /* returns the window info associated with this slot */
+ NautilusWindowInfo * (* get_window) (NautilusWindowSlotInfo *slot);
+
+ /* Returns the number of selected items in the view */
+ int (* get_selection_count) (NautilusWindowSlotInfo *slot);
+
+ /* Returns a list of uris for th selected items in the view, caller frees it */
+ GList *(* get_selection) (NautilusWindowSlotInfo *slot);
+
+ char * (* get_current_location) (NautilusWindowSlotInfo *slot);
+ void (* set_status) (NautilusWindowSlotInfo *slot,
+ const char *status);
+ char * (* get_title) (NautilusWindowSlotInfo *slot);
+
+ void (* open_location) (NautilusWindowSlotInfo *slot,
+ GFile *location,
+ NautilusWindowOpenMode mode,
+ NautilusWindowOpenFlags flags,
+ GList *selection);
+};
+
+
+GType nautilus_window_slot_info_get_type (void);
+NautilusWindowInfo * nautilus_window_slot_info_get_window (NautilusWindowSlotInfo *slot);
+void nautilus_window_slot_info_open_location (NautilusWindowSlotInfo *slot,
+ GFile *location,
+ NautilusWindowOpenMode mode,
+ NautilusWindowOpenFlags flags,
+ GList *selection);
+void nautilus_window_slot_info_set_status (NautilusWindowSlotInfo *slot,
+ const char *status);
+
+char * nautilus_window_slot_info_get_current_location (NautilusWindowSlotInfo *slot);
+int nautilus_window_slot_info_get_selection_count (NautilusWindowSlotInfo *slot);
+GList * nautilus_window_slot_info_get_selection (NautilusWindowSlotInfo *slot);
+char * nautilus_window_slot_info_get_title (NautilusWindowSlotInfo *slot);
+
+#endif /* NAUTILUS_WINDOW_SLOT_INFO_H */
Modified: branches/multiview/src/Makefile.am
==============================================================================
--- branches/multiview/src/Makefile.am (original)
+++ branches/multiview/src/Makefile.am Thu Mar 20 23:38:01 2008
@@ -98,6 +98,8 @@
nautilus-navigation-window-menus.c \
nautilus-navigation-window.c \
nautilus-navigation-window.h \
+ nautilus-navigation-window-slot.c \
+ nautilus-navigation-window-slot.h \
nautilus-notes-viewer.c \
nautilus-notes-viewer.h \
nautilus-pathbar.c \
@@ -130,6 +132,8 @@
nautilus-window-manage-views.h \
nautilus-window-menus.c \
nautilus-window-private.h \
+ nautilus-window-slot.c \
+ nautilus-window-slot.h \
nautilus-window-toolbars.c \
nautilus-window.c \
nautilus-window.h \
Modified: branches/multiview/src/file-manager/fm-desktop-icon-view.c
==============================================================================
--- branches/multiview/src/file-manager/fm-desktop-icon-view.c (original)
+++ branches/multiview/src/file-manager/fm-desktop-icon-view.c Thu Mar 20 23:38:01 2008
@@ -771,11 +771,13 @@
}
static NautilusView *
-fm_desktop_icon_view_create (NautilusWindowInfo *window)
+fm_desktop_icon_view_create (NautilusWindowSlotInfo *slot)
{
FMIconView *view;
- view = g_object_new (FM_TYPE_DESKTOP_ICON_VIEW, "window", window, NULL);
+ view = g_object_new (FM_TYPE_DESKTOP_ICON_VIEW,
+ "window-slot", slot,
+ NULL);
g_object_ref (view);
gtk_object_sink (GTK_OBJECT (view));
return NAUTILUS_VIEW (view);
Modified: branches/multiview/src/file-manager/fm-directory-view.c
==============================================================================
--- branches/multiview/src/file-manager/fm-directory-view.c (original)
+++ branches/multiview/src/file-manager/fm-directory-view.c Thu Mar 20 23:38:01 2008
@@ -161,7 +161,7 @@
enum
{
PROP_0,
- PROP_WINDOW
+ PROP_WINDOW_SLOT
};
@@ -179,6 +179,7 @@
struct FMDirectoryViewDetails
{
NautilusWindowInfo *window;
+ NautilusWindowSlotInfo *slot;
NautilusDirectory *model;
NautilusFile *directory_as_file;
GtkActionGroup *dir_action_group;
@@ -224,6 +225,9 @@
GList *pending_locations_selected;
+ /* whether we are in the active slot */
+ gboolean active;
+
/* loading indicates whether this view has begun loading a directory.
* This flag should need not be set inside subclasses. FMDirectoryView automatically
* sets 'loading' to TRUE before it begins loading a directory's contents and to FALSE
@@ -303,6 +307,7 @@
static void load_directory (FMDirectoryView *view,
NautilusDirectory *directory);
static void fm_directory_view_merge_menus (FMDirectoryView *view);
+static void fm_directory_view_unmerge_menus (FMDirectoryView *view);
static void fm_directory_view_init_show_hidden_files (FMDirectoryView *view);
static void fm_directory_view_load_location (NautilusView *nautilus_view,
const char *location);
@@ -577,6 +582,13 @@
return view->details->window;
}
+NautilusWindowSlotInfo *
+fm_directory_view_get_nautilus_window_slot (FMDirectoryView *view)
+{
+ g_assert (view->details->slot != NULL);
+
+ return view->details->slot;
+}
/* Returns the GtkWindow that this directory view occupies, or NULL
@@ -691,7 +703,7 @@
path = get_view_directory (view);
nautilus_mime_activate_files (fm_directory_view_get_containing_window (view),
- view->details->window,
+ view->details->slot,
files,
path,
mode,
@@ -710,7 +722,7 @@
path = get_view_directory (view);
nautilus_mime_activate_file (fm_directory_view_get_containing_window (view),
- view->details->window,
+ view->details->slot,
file,
path,
mode,
@@ -810,8 +822,8 @@
nautilus_debug_log (FALSE, NAUTILUS_DEBUG_LOG_DOMAIN_USER,
"directory view open_location window=%p: %s", window, new_uri);
location = g_file_new_for_uri (new_uri);
- nautilus_window_info_open_location (directory_view->details->window,
- location, mode, flags, NULL);
+ nautilus_window_slot_info_open_location (directory_view->details->slot,
+ location, mode, flags, NULL);
g_object_unref (location);
}
@@ -1152,7 +1164,9 @@
} else {
mode = NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DISABLE;
}
- nautilus_window_info_set_hidden_files_mode (directory_view->details->window, mode);
+ /* multiview-TODO listen to hidden file modes changes, block handler here. */
+ nautilus_window_info_set_hidden_files_mode (directory_view->details->window,
+ mode);
if (directory_view->details->model != NULL) {
load_directory (directory_view, directory_view->details->model);
}
@@ -1531,7 +1545,9 @@
view = FM_DIRECTORY_VIEW (callback_data);
view->details->scripts_invalid = TRUE;
- schedule_update_menus (view);
+ if (view->details->active) {
+ schedule_update_menus (view);
+ }
}
static void
@@ -1544,7 +1560,9 @@
view = FM_DIRECTORY_VIEW (callback_data);
view->details->templates_invalid = TRUE;
- schedule_update_menus (view);
+ if (view->details->active) {
+ schedule_update_menus (view);
+ }
}
static void
@@ -1631,20 +1649,28 @@
}
static void
-fm_directory_view_set_parent_window (FMDirectoryView *directory_view,
- NautilusWindowInfo *window)
+slot_active (NautilusWindowSlot *slot,
+ FMDirectoryView *view)
{
-
- directory_view->details->window = window;
+ g_assert (!view->details->active);
+ view->details->active = TRUE;
- /* Add new menu items and perhaps whole menus */
- fm_directory_view_merge_menus (directory_view);
-
- /* Set initial sensitivity, wording, toggle state, etc. */
- fm_directory_view_update_menus (directory_view);
+ fm_directory_view_merge_menus (view);
+ schedule_update_menus (view);
/* initialise show hidden mode */
- fm_directory_view_init_show_hidden_files (directory_view);
+ fm_directory_view_init_show_hidden_files (view);
+}
+
+static void
+slot_inactive (NautilusWindowSlot *slot,
+ FMDirectoryView *view)
+{
+ g_assert (view->details->active);
+ view->details->active = FALSE;
+
+ fm_directory_view_unmerge_menus (view);
+ remove_update_menus_timeout_callback (view);
}
static GtkWidget *
@@ -1836,7 +1862,7 @@
}
static void
-unmerge_ui (FMDirectoryView *view)
+real_unmerge_menus (FMDirectoryView *view)
{
GtkUIManager *ui_manager;
@@ -1873,7 +1899,7 @@
disconnect_model_handlers (view);
- unmerge_ui (view);
+ fm_directory_view_unmerge_menus (view);
/* We don't own the window, so no unref */
view->details->window = NULL;
@@ -2152,8 +2178,8 @@
g_free (folder_item_count_str);
g_free (non_folder_str);
- nautilus_window_info_set_status (view->details->window,
- status_string);
+ nautilus_window_slot_info_set_status (view->details->slot,
+ status_string);
g_free (status_string);
}
@@ -5582,8 +5608,8 @@
}
}
- nautilus_window_info_set_status (view->details->window,
- status_string);
+ nautilus_window_slot_info_set_status (view->details->slot,
+ status_string);
g_free (status_string);
}
@@ -5666,8 +5692,8 @@
}
if (item_uris == NULL|| destination_uri == NULL) {
- nautilus_window_info_set_status (view->details->window,
- _("There is nothing on the clipboard to paste."));
+ nautilus_window_slot_info_set_status (view->details->slot,
+ _("There is nothing on the clipboard to paste."));
} else {
fm_directory_view_move_copy_items (item_uris, NULL, destination_uri,
cut ? GDK_ACTION_MOVE : GDK_ACTION_COPY,
@@ -6553,6 +6579,7 @@
view->details->templates_invalid = TRUE;
}
+
static gboolean
can_paste_into_file (NautilusFile *file)
{
@@ -7403,8 +7430,11 @@
{
g_assert (FM_IS_DIRECTORY_VIEW (view));
- /* Don't schedule updates after destroy (#349551) */
- if (view->details->window == NULL) {
+ /* Don't schedule updates after destroy (#349551),
+ * or if we are not active.
+ */
+ if (view->details->window == NULL ||
+ !view->details->active) {
return;
}
@@ -7768,6 +7798,16 @@
}
static void
+fm_directory_view_unmerge_menus (FMDirectoryView *view)
+{
+ g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
+
+ EEL_CALL_METHOD
+ (FM_DIRECTORY_VIEW_CLASS, view,
+ unmerge_menus, (view));
+}
+
+static void
disconnect_handler (GObject *object, int *id)
{
if (*id != 0) {
@@ -8116,6 +8156,8 @@
{
g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
+ g_assert (view->details->active);
+
EEL_CALL_METHOD
(FM_DIRECTORY_VIEW_CLASS, view,
update_menus, (view));
@@ -8649,7 +8691,12 @@
g_free (container_uri);
}
-
+gboolean
+fm_directory_view_get_active (FMDirectoryView *view)
+{
+ g_assert (FM_IS_DIRECTORY_VIEW (view));
+ return view->details->active;
+}
static GArray *
real_get_selected_icon_locations (FMDirectoryView *view)
@@ -8665,13 +8712,32 @@
GParamSpec *pspec)
{
FMDirectoryView *directory_view;
+ NautilusWindowSlotInfo *slot;
+ NautilusWindowInfo *window;
directory_view = FM_DIRECTORY_VIEW (object);
switch (prop_id) {
- case PROP_WINDOW:
- g_assert (directory_view->details->window == NULL);
- fm_directory_view_set_parent_window (directory_view, NAUTILUS_WINDOW_INFO (g_value_get_object (value)));
+ case PROP_WINDOW_SLOT:
+ g_assert (directory_view->details->slot == NULL);
+
+ slot = NAUTILUS_WINDOW_SLOT_INFO (g_value_get_object (value));
+ window = nautilus_window_slot_info_get_window (slot);
+
+ directory_view->details->slot = slot;
+ directory_view->details->window = window;
+
+ g_signal_connect_object (directory_view->details->slot,
+ "active", G_CALLBACK (slot_active),
+ directory_view, 0);
+ g_signal_connect_object (directory_view->details->slot,
+ "inactive", G_CALLBACK (slot_inactive),
+ directory_view, 0);
+
+ if (directory_view->details->slot ==
+ nautilus_window_info_get_active_slot (window)) {
+ slot_active (directory_view->details->slot, directory_view);
+ }
break;
default:
@@ -8830,6 +8896,7 @@
klass->supports_zooming = real_supports_zooming;
klass->using_manual_layout = real_using_manual_layout;
klass->merge_menus = real_merge_menus;
+ klass->unmerge_menus = real_unmerge_menus;
klass->update_menus = real_update_menus;
/* Function pointers that subclasses must override */
@@ -8855,11 +8922,11 @@
utf8_string_atom = gdk_atom_intern ("UTF8_STRING", FALSE);
g_object_class_install_property (G_OBJECT_CLASS (klass),
- PROP_WINDOW,
- g_param_spec_object ("window",
- "Window",
- "The parent NautilusWindowInfo reference",
- NAUTILUS_TYPE_WINDOW_INFO,
+ PROP_WINDOW_SLOT,
+ g_param_spec_object ("window-slot",
+ "Window Slot",
+ "The parent window slot reference",
+ NAUTILUS_TYPE_WINDOW_SLOT_INFO,
G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY));
Modified: branches/multiview/src/file-manager/fm-directory-view.h
==============================================================================
--- branches/multiview/src/file-manager/fm-directory-view.h (original)
+++ branches/multiview/src/file-manager/fm-directory-view.h Thu Mar 20 23:38:01 2008
@@ -39,6 +39,7 @@
#include <libnautilus-private/nautilus-link.h>
#include <libnautilus-private/nautilus-view.h>
#include <libnautilus-private/nautilus-window-info.h>
+#include <libnautilus-private/nautilus-window-slot-info.h>
#include <gio/gio.h>
typedef struct FMDirectoryView FMDirectoryView;
@@ -204,6 +205,7 @@
* If overridden, subclasses must call parent class's function.
*/
void (* merge_menus) (FMDirectoryView *view);
+ void (* unmerge_menus) (FMDirectoryView *view);
/* update_menus is a function pointer that subclasses can override to
* update the sensitivity or wording of menu items in the menu bar.
@@ -328,6 +330,7 @@
/* Functions callable from the user interface and elsewhere. */
NautilusWindowInfo *fm_directory_view_get_nautilus_window (FMDirectoryView *view);
+NautilusWindowSlotInfo *fm_directory_view_get_nautilus_window_slot (FMDirectoryView *view);
char * fm_directory_view_get_uri (FMDirectoryView *view);
char * fm_directory_view_get_backing_uri (FMDirectoryView *view);
gboolean fm_directory_view_can_accept_item (NautilusFile *target_item,
@@ -367,6 +370,7 @@
int x,
int y,
FMDirectoryView *view);
+gboolean fm_directory_view_get_active (FMDirectoryView *view);
/* Wrappers for signal emitters. These are normally called
* only by FMDirectoryView itself. They have corresponding signals
Modified: branches/multiview/src/file-manager/fm-empty-view.c
==============================================================================
--- branches/multiview/src/file-manager/fm-empty-view.c (original)
+++ branches/multiview/src/file-manager/fm-empty-view.c Thu Mar 20 23:38:01 2008
@@ -345,11 +345,16 @@
}
static NautilusView *
-fm_empty_view_create (NautilusWindowInfo *window)
+fm_empty_view_create (NautilusWindowSlotInfo *slot)
{
+ NautilusWindowSlotInfo *slot;
FMEmptyView *view;
- view = g_object_new (FM_TYPE_EMPTY_VIEW, "window", window, NULL);
+ g_assert (NAUTILUS_IS_WINDOW_SLOT_INFO (slot));
+
+ view = g_object_new (FM_TYPE_EMPTY_VIEW,
+ "window-slot", slot,
+ NULL);
g_object_ref (view);
gtk_object_sink (GTK_OBJECT (view));
return NAUTILUS_VIEW (view);
Modified: branches/multiview/src/file-manager/fm-icon-view.c
==============================================================================
--- branches/multiview/src/file-manager/fm-icon-view.c (original)
+++ branches/multiview/src/file-manager/fm-icon-view.c Thu Mar 20 23:38:01 2008
@@ -187,7 +187,6 @@
fm_icon_view_destroy (GtkObject *object)
{
FMIconView *icon_view;
- GtkUIManager *ui_manager;
icon_view = FM_ICON_VIEW (object);
@@ -204,13 +203,6 @@
icon_view->details->icons_not_positioned = NULL;
}
- ui_manager = fm_directory_view_get_ui_manager (FM_DIRECTORY_VIEW (icon_view));
- if (ui_manager != NULL) {
- nautilus_ui_unmerge_ui (ui_manager,
- &icon_view->details->icon_merge_id,
- &icon_view->details->icon_action_group);
- }
-
GTK_OBJECT_CLASS (fm_icon_view_parent_class)->destroy (object);
}
@@ -1190,7 +1182,9 @@
g_signal_emit_by_name (view, "zoom_level_changed");
- fm_directory_view_update_menus (FM_DIRECTORY_VIEW (view));
+ if (fm_directory_view_get_active (FM_DIRECTORY_VIEW (view))) {
+ fm_directory_view_update_menus (FM_DIRECTORY_VIEW (view));
+ }
}
static void
@@ -1551,6 +1545,24 @@
}
static void
+fm_icon_view_unmerge_menus (FMDirectoryView *view)
+{
+ FMIconView *icon_view;
+ GtkUIManager *ui_manager;
+
+ icon_view = FM_ICON_VIEW (view);
+
+ FM_DIRECTORY_VIEW_CLASS (fm_icon_view_parent_class)->unmerge_menus (view);
+
+ ui_manager = fm_directory_view_get_ui_manager (view);
+ if (ui_manager != NULL) {
+ nautilus_ui_unmerge_ui (ui_manager,
+ &icon_view->details->icon_merge_id,
+ &icon_view->details->icon_action_group);
+ }
+}
+
+static void
fm_icon_view_update_menus (FMDirectoryView *view)
{
FMIconView *icon_view;
@@ -1962,8 +1974,8 @@
file_name = nautilus_file_get_display_name (file);
message = g_strdup_printf (_("pointing at \"%s\""), file_name);
g_free (file_name);
- nautilus_window_info_set_status
- (fm_directory_view_get_nautilus_window (FM_DIRECTORY_VIEW (icon_view)),
+ nautilus_window_slot_info_set_status
+ (fm_directory_view_get_nautilus_window_slot (FM_DIRECTORY_VIEW (icon_view)),
message);
g_free (message);
} else {
@@ -2140,7 +2152,8 @@
* idle call, because we'd have to keep track of potentially multiple
* sets of file/geometry info.
*/
- if (icon_view->details->react_to_icon_change_idle_id == 0) {
+ if (fm_directory_view_get_active (FM_DIRECTORY_VIEW (icon_view)) &&
+ icon_view->details->react_to_icon_change_idle_id == 0) {
icon_view->details->react_to_icon_change_idle_id
= g_idle_add (fm_icon_view_react_to_icon_change_idle_callback,
icon_view);
@@ -2605,6 +2618,7 @@
fm_directory_view_class->emblems_changed = fm_icon_view_emblems_changed;
fm_directory_view_class->image_display_policy_changed = fm_icon_view_image_display_policy_changed;
fm_directory_view_class->merge_menus = fm_icon_view_merge_menus;
+ fm_directory_view_class->unmerge_menus = fm_icon_view_unmerge_menus;
fm_directory_view_class->sort_directories_first_changed = fm_icon_view_sort_directories_first_changed;
fm_directory_view_class->start_renaming_file = fm_icon_view_start_renaming_file;
fm_directory_view_class->text_attribute_names_changed = fm_icon_view_text_attribute_names_changed;
@@ -2701,11 +2715,15 @@
}
static NautilusView *
-fm_icon_view_create (NautilusWindowInfo *window)
+fm_icon_view_create (NautilusWindowSlotInfo *slot)
{
FMIconView *view;
- view = g_object_new (FM_TYPE_ICON_VIEW, "window", window, NULL);
+ g_assert (NAUTILUS_IS_WINDOW_SLOT_INFO (slot));
+
+ view = g_object_new (FM_TYPE_ICON_VIEW,
+ "window-slot", slot,
+ NULL);
g_object_ref (view);
gtk_object_sink (GTK_OBJECT (view));
return NAUTILUS_VIEW (view);
Modified: branches/multiview/src/file-manager/fm-list-view.c
==============================================================================
--- branches/multiview/src/file-manager/fm-list-view.c (original)
+++ branches/multiview/src/file-manager/fm-list-view.c Thu Mar 20 23:38:01 2008
@@ -2763,11 +2763,13 @@
}
static NautilusView *
-fm_list_view_create (NautilusWindowInfo *window)
+fm_list_view_create (NautilusWindowSlotInfo *slot)
{
FMListView *view;
- view = g_object_new (FM_TYPE_LIST_VIEW, "window", window, NULL);
+ view = g_object_new (FM_TYPE_LIST_VIEW,
+ "window-slot", slot,
+ NULL);
g_object_ref (view);
gtk_object_sink (GTK_OBJECT (view));
return NAUTILUS_VIEW (view);
Modified: branches/multiview/src/file-manager/fm-tree-view.c
==============================================================================
--- branches/multiview/src/file-manager/fm-tree-view.c (original)
+++ branches/multiview/src/file-manager/fm-tree-view.c Thu Mar 20 23:38:01 2008
@@ -72,6 +72,8 @@
#include <libnautilus-private/nautilus-cell-renderer-pixbuf-emblem.h>
#include <libnautilus-private/nautilus-sidebar-provider.h>
#include <libnautilus-private/nautilus-module.h>
+#include <libnautilus-private/nautilus-window-info.h>
+#include <libnautilus-private/nautilus-window-slot-info.h>
typedef struct {
GObject parent;
@@ -335,6 +337,7 @@
GdkScreen *screen;
NautilusWindowOpenMode mode;
GFile *location;
+ NautilusWindowSlotInfo *slot;
view = FM_TREE_VIEW (callback_data);
@@ -344,6 +347,8 @@
mode = view->details->activation_in_new_window ? NAUTILUS_WINDOW_OPEN_IN_NAVIGATION : NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE;
+ slot = nautilus_window_info_get_active_slot (view->details->window);
+
uri = nautilus_file_get_activation_uri (file);
if (nautilus_file_is_launcher (file)) {
file_uri = nautilus_file_get_uri (file);
@@ -365,8 +370,8 @@
"tree view window_info_open_location window=%p: %s",
view->details->window, uri);
location = g_file_new_for_uri (uri);
- nautilus_window_info_open_location
- (view->details->window,
+ nautilus_window_slot_info_open_location
+ (slot,
location,
mode,
0,
@@ -391,8 +396,8 @@
"tree view window_info_open_location window=%p: %s",
view->details->window, uri);
location = g_file_new_for_uri (uri);
- nautilus_window_info_open_location
- (view->details->window,
+ nautilus_window_slot_info_open_location
+ (slot,
location,
mode,
0,
@@ -898,8 +903,8 @@
}
g_free (name);
- nautilus_window_info_set_status (view->details->window,
- status_string);
+ nautilus_window_info_push_status (view->details->window,
+ status_string);
g_free (status_string);
}
@@ -968,8 +973,8 @@
}
if (item_uris == NULL|| destination_uri == NULL) {
- nautilus_window_info_set_status (view->details->window,
- _("There is nothing on the clipboard to paste."));
+ nautilus_window_info_push_status (view->details->window,
+ _("There is nothing on the clipboard to paste."));
} else {
nautilus_file_operations_copy_move
(item_uris, NULL, destination_uri,
@@ -1226,6 +1231,7 @@
GList *mounts, *l;
char *location;
GIcon *icon;
+ NautilusWindowSlotInfo *slot;
view->details->child_model = fm_tree_model_new ();
view->details->sort_model = GTK_TREE_MODEL_SORT
@@ -1326,7 +1332,8 @@
"button_press_event", G_CALLBACK (button_pressed_callback),
view);
- location = nautilus_window_info_get_current_location (view->details->window);
+ slot = nautilus_window_info_get_active_slot (view->details->window);
+ location = nautilus_window_slot_info_get_current_location (slot);
schedule_select_and_show_location (view, location);
g_free (location);
}
@@ -1383,8 +1390,11 @@
static void
loading_uri_callback (NautilusWindowInfo *window,
char *location,
- FMTreeView *view)
+ gpointer callback_data)
{
+ FMTreeView *view;
+
+ view = FM_TREE_VIEW (callback_data);
schedule_select_and_show_location (view, location);
}
@@ -1537,12 +1547,15 @@
NautilusWindowInfo *window)
{
char *location;
+ NautilusWindowSlotInfo *slot;
sidebar->details->window = window;
+ slot = nautilus_window_info_get_active_slot (window);
+
g_signal_connect_object (window, "loading_uri",
G_CALLBACK (loading_uri_callback), sidebar, 0);
- location = nautilus_window_info_get_current_location (window);
+ location = nautilus_window_slot_info_get_current_location (slot);
loading_uri_callback (window, location, sidebar);
g_free (location);
Modified: branches/multiview/src/nautilus-application.c
==============================================================================
--- branches/multiview/src/nautilus-application.c (original)
+++ branches/multiview/src/nautilus-application.c Thu Mar 20 23:38:01 2008
@@ -869,6 +869,7 @@
list_copy = g_list_copy (nautilus_application_window_list);
for (l = list_copy; l != NULL; l = l->next) {
NautilusWindow *window;
+ GList *l;
window = NAUTILUS_WINDOW (l->data);
@@ -883,18 +884,18 @@
nautilus_application_get_existing_spatial_window (GFile *location)
{
GList *l;
+ NautilusWindowSlot *slot;
for (l = nautilus_application_get_spatial_window_list ();
l != NULL; l = l->next) {
GFile *window_location;
- window_location = nautilus_window_get_location (NAUTILUS_WINDOW (l->data));
+ slot = NAUTILUS_WINDOW (l->data)->details->active_slot;
+ window_location = slot->location;
if (window_location != NULL) {
if (g_file_equal (location, window_location)) {
- g_object_unref (window_location);
return NAUTILUS_SPATIAL_WINDOW (l->data);
}
- g_object_unref (window_location);
}
}
return NULL;
@@ -905,14 +906,16 @@
{
NautilusFile *file;
NautilusFile *parent_file;
+ NautilusWindowSlot *slot;
GFile *location;
- location = nautilus_window_get_location (NAUTILUS_WINDOW (window));
+ slot = NAUTILUS_WINDOW (window)->details->active_slot;
+
+ location = slot->location;
if (location == NULL) {
return NULL;
}
file = nautilus_file_get (location);
- g_object_unref (location);
if (!file) {
return NULL;
@@ -1154,13 +1157,15 @@
for (l = nautilus_application_get_spatial_window_list ();
l != NULL; l = l->next) {
NautilusWindow *existing_window;
+ NautilusWindowSlot *slot;
GFile *existing_location;
-
+
existing_window = NAUTILUS_WINDOW (l->data);
- existing_location = existing_window->details->pending_location;
+ slot = existing_window->details->active_slot;
+ existing_location = slot->pending_location;
if (existing_location == NULL) {
- existing_location = existing_window->details->location;
+ existing_location = slot->location;
}
if (g_file_equal (existing_location, location)) {
@@ -1171,8 +1176,8 @@
gtk_window_present (GTK_WINDOW (existing_window));
if (new_selection &&
- existing_window->content_view != NULL) {
- nautilus_view_set_selection (existing_window->content_view, new_selection);
+ slot->content_view != NULL) {
+ nautilus_view_set_selection (slot->content_view, new_selection);
}
uri = g_file_get_uri (location);
@@ -1444,6 +1449,7 @@
{
GList *window_list, *node, *close_list;
NautilusWindow *window;
+ NautilusWindowSlot *slot;
GFile *root;
close_list = NULL;
@@ -1456,24 +1462,27 @@
for (node = window_list; node != NULL; node = node->next) {
window = NAUTILUS_WINDOW (node->data);
if (window != NULL && window_can_be_closed (window)) {
+ GList *l;
GFile *location;
- location = nautilus_window_get_location (window);
+ for (l = window->details->slots; l != NULL; l = l->next) {
+ slot = l->data;
+ location = slot->location;
+ if (g_file_has_prefix (location, root)) {
+ close_list = g_list_prepend (close_list, slot);
+ }
+ }
- if (g_file_has_prefix (location, root)) {
- close_list = g_list_prepend (close_list, window);
- }
- g_object_unref (location);
}
}
/* Handle the windows in the close list. */
for (node = close_list; node != NULL; node = node->next) {
- window = NAUTILUS_WINDOW (node->data);
+ slot = node->data;
if (NAUTILUS_IS_SPATIAL_WINDOW (window)) {
- nautilus_window_close (window);
+ nautilus_window_slot_close (slot);
} else {
- nautilus_window_go_home (window);
+ nautilus_window_go_home (slot->window);
}
}
@@ -1582,6 +1591,7 @@
for (l = nautilus_application_window_list; l != NULL; l = l->next) {
xmlNodePtr win_node;
NautilusWindow *window;
+ NautilusWindowSlot *slot;
char *tmp;
window = l->data;
@@ -1611,7 +1621,9 @@
}
}
- tmp = nautilus_window_get_location_uri (window);
+ /* TODO store all URIs for windows with mutiple slots */
+ slot = nautilus_window_get_active_slot (window);
+ tmp = nautilus_window_slot_get_location_uri (slot);
xmlNewProp (win_node, "location", tmp);
g_free (tmp);
}
@@ -1770,7 +1782,8 @@
}
location = g_file_new_for_uri (location_uri);
- nautilus_window_open_location (window, location, FALSE);
+ /* TODO open all URIs for windows with mutiple slots */
+ nautilus_window_slot_open_location (window->details->active_slot, location, FALSE);
g_object_unref (location);
} else if (!strcmp (type, "spatial")) {
location = g_file_new_for_uri (location_uri);
Modified: branches/multiview/src/nautilus-desktop-window.c
==============================================================================
--- branches/multiview/src/nautilus-desktop-window.c (original)
+++ branches/multiview/src/nautilus-desktop-window.c Thu Mar 20 23:38:01 2008
@@ -252,7 +252,8 @@
}
static NautilusIconInfo *
-real_get_icon (NautilusWindow *window)
+real_get_icon (NautilusWindow *window,
+ NautilusWindowSlot *slot)
{
return nautilus_icon_info_lookup_from_name (NAUTILUS_ICON_DESKTOP, 48);
}
Modified: branches/multiview/src/nautilus-history-sidebar.c
==============================================================================
--- branches/multiview/src/nautilus-history-sidebar.c (original)
+++ branches/multiview/src/nautilus-history-sidebar.c Thu Mar 20 23:38:01 2008
@@ -44,6 +44,8 @@
#include <libnautilus-private/nautilus-sidebar-provider.h>
#include <libnautilus-private/nautilus-module.h>
#include <libnautilus-private/nautilus-signaller.h>
+#include <libnautilus-private/nautilus-window-info.h>
+#include <libnautilus-private/nautilus-window-slot-info.h>
#include "nautilus-history-sidebar.h"
@@ -142,6 +144,7 @@
gpointer user_data)
{
NautilusHistorySidebar *sidebar;
+ NautilusWindowSlotInfo *slot;
GtkTreeModel *model;
GtkTreeIter iter;
NautilusBookmark *bookmark;
@@ -159,8 +162,9 @@
/* Navigate to the clicked location. */
location = nautilus_bookmark_get_location (NAUTILUS_BOOKMARK (bookmark));
- nautilus_window_info_open_location
- (sidebar->window,
+ slot = nautilus_window_info_get_active_slot (sidebar->window);
+ nautilus_window_slot_info_open_location
+ (slot,
location, NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE, 0, NULL);
g_object_unref (location);
}
Modified: branches/multiview/src/nautilus-information-panel.c
==============================================================================
--- branches/multiview/src/nautilus-information-panel.c (original)
+++ branches/multiview/src/nautilus-information-panel.c Thu Mar 20 23:38:01 2008
@@ -1098,10 +1098,13 @@
char *uri,
NautilusInformationPanel *panel)
{
+ NautilusWindowSlotInfo *slot;
char *title;
- title = nautilus_window_info_get_title (window);
- nautilus_information_panel_set_uri (panel,
+ slot = nautilus_window_info_get_active_slot (window);
+
+ title = nautilus_window_slot_info_get_title (slot);
+ nautilus_information_panel_set_uri (panel,
uri,
title);
g_free (title);
@@ -1111,6 +1114,7 @@
nautilus_information_panel_set_parent_window (NautilusInformationPanel *panel,
NautilusWindowInfo *window)
{
+ gpointer slot;
char *title, *location;
panel->details->window = window;
@@ -1119,9 +1123,11 @@
G_CALLBACK (loading_uri_callback), panel, 0);
g_signal_connect_object (window, "title_changed",
G_CALLBACK (title_changed_callback), panel, 0);
+
+ slot = nautilus_window_info_get_active_slot (window);
- title = nautilus_window_info_get_title (window);
- location = nautilus_window_info_get_current_location (window);
+ title = nautilus_window_slot_info_get_title (slot);
+ location = nautilus_window_slot_info_get_current_location (slot);
nautilus_information_panel_set_uri (panel,
location,
title);
Modified: branches/multiview/src/nautilus-location-bar.c
==============================================================================
--- branches/multiview/src/nautilus-location-bar.c (original)
+++ branches/multiview/src/nautilus-location-bar.c Thu Mar 20 23:38:01 2008
@@ -260,6 +260,7 @@
GdkEventButton *event)
{
NautilusNavigationWindow *window;
+ NautilusWindowSlot *slot;
NautilusView *view;
GtkWidget *label;
@@ -268,7 +269,8 @@
}
window = nautilus_location_bar_get_window (widget->parent);
- view = NAUTILUS_WINDOW (window)->content_view;
+ slot = NAUTILUS_WINDOW (window)->details->active_slot;
+ view = slot->content_view;
label = GTK_BIN (widget)->child;
/* only pop-up if the URI in the entry matches the displayed location */
if (view == NULL ||
Modified: branches/multiview/src/nautilus-location-dialog.c
==============================================================================
--- branches/multiview/src/nautilus-location-dialog.c (original)
+++ branches/multiview/src/nautilus-location-dialog.c Thu Mar 20 23:38:01 2008
@@ -201,6 +201,7 @@
GtkWidget *
nautilus_location_dialog_new (NautilusWindow *window)
{
+ NautilusWindowSlot *slot;
GtkWidget *dialog;
GFile *location;
char *formatted_location;
@@ -213,9 +214,10 @@
gtk_window_get_screen (GTK_WINDOW (window)));
NAUTILUS_LOCATION_DIALOG (dialog)->details->window = window;
}
-
- location = nautilus_window_get_location (window);
+ slot = window->details->active_slot;
+
+ location = slot->location;
if (location != NULL) {
if (NAUTILUS_IS_DESKTOP_WINDOW (window)) {
formatted_location = g_strdup_printf ("%s/", g_get_home_dir ());
@@ -226,7 +228,6 @@
gtk_editable_select_region (GTK_EDITABLE (NAUTILUS_LOCATION_DIALOG (dialog)->details->entry), 0, -1);
gtk_editable_set_position (GTK_EDITABLE (NAUTILUS_LOCATION_DIALOG (dialog)->details->entry), -1);
g_free (formatted_location);
- g_object_unref (location);
}
gtk_widget_grab_focus (NAUTILUS_LOCATION_DIALOG (dialog)->details->entry);
Modified: branches/multiview/src/nautilus-navigation-action.c
==============================================================================
--- branches/multiview/src/nautilus-navigation-action.c (original)
+++ branches/multiview/src/nautilus-navigation-action.c Thu Mar 20 23:38:01 2008
@@ -31,6 +31,8 @@
#include "nautilus-navigation-action.h"
#include "nautilus-navigation-window.h"
+#include "nautilus-window-private.h"
+#include "nautilus-navigation-window-slot.h"
#include <gtk/gtkimage.h>
#include <gtk/gtkimagemenuitem.h>
@@ -117,13 +119,16 @@
GtkWidget *menu,
gboolean back)
{
+ NautilusNavigationWindowSlot *slot;
GtkWidget *menu_item;
int index;
GList *list;
g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
+
+ slot = NAUTILUS_NAVIGATION_WINDOW_SLOT (NAUTILUS_WINDOW (window)->details->active_slot);
- list = back ? window->back_list : window->forward_list;
+ list = back ? slot->back_list : slot->forward_list;
index = 0;
while (list != NULL) {
menu_item = nautilus_bookmark_menu_item_new (NAUTILUS_BOOKMARK (list->data));
Modified: branches/multiview/src/nautilus-navigation-window-menus.c
==============================================================================
--- branches/multiview/src/nautilus-navigation-window-menus.c (original)
+++ branches/multiview/src/nautilus-navigation-window-menus.c Thu Mar 20 23:38:01 2008
@@ -432,10 +432,12 @@
gpointer user_data)
{
NautilusWindow *current_window;
+ NautilusWindowSlot *slot;
GFile *current_location;
current_window = NAUTILUS_WINDOW (user_data);
- current_location = nautilus_window_get_location (current_window);
+ slot = current_window->details->active_slot;
+ current_location = nautilus_window_slot_get_location (slot);
nautilus_application_present_spatial_window (
current_window->application,
current_window,
Added: branches/multiview/src/nautilus-navigation-window-slot.c
==============================================================================
--- (empty file)
+++ branches/multiview/src/nautilus-navigation-window-slot.c Thu Mar 20 23:38:01 2008
@@ -0,0 +1,58 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+
+ nautilus-navigation-window-slot.c: Nautilus navigation window slot
+
+ 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: Christian Neumair <cneumair gnome org>
+*/
+
+#include "nautilus-window-slot.h"
+#include "nautilus-navigation-window-slot.h"
+#include "nautilus-window-private.h"
+#include <libnautilus-private/nautilus-window-slot-info.h>
+#include <eel/eel-gtk-macros.h>
+
+static void nautilus_navigation_window_slot_init (NautilusNavigationWindowSlot *slot);
+static void nautilus_navigation_window_slot_class_init (NautilusNavigationWindowSlotClass *class);
+
+G_DEFINE_TYPE (NautilusNavigationWindowSlot, nautilus_navigation_window_slot, NAUTILUS_TYPE_WINDOW_SLOT)
+#define parent_class nautilus_navigation_window_slot_parent_class
+
+static void
+nautilus_navigation_window_slot_active (NautilusWindowSlot *slot)
+{
+ NautilusWindow *window;
+
+ window = slot->window;
+
+ EEL_CALL_PARENT (NAUTILUS_WINDOW_SLOT_CLASS, active, (slot));
+
+ nautilus_navigation_window_load_extension_toolbar_items (NAUTILUS_NAVIGATION_WINDOW (window));
+}
+
+static void
+nautilus_navigation_window_slot_init (NautilusNavigationWindowSlot *slot)
+{
+}
+
+static void
+nautilus_navigation_window_slot_class_init (NautilusNavigationWindowSlotClass *class)
+{
+ NAUTILUS_WINDOW_SLOT_CLASS (class)->active = nautilus_navigation_window_slot_active;
+}
Added: branches/multiview/src/nautilus-navigation-window-slot.h
==============================================================================
--- (empty file)
+++ branches/multiview/src/nautilus-navigation-window-slot.h Thu Mar 20 23:38:01 2008
@@ -0,0 +1,71 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+
+ nautilus-navigation-window-slot.h: Nautilus navigation window slot
+
+ 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: Christian Neumair <cneumair gnome org>
+*/
+
+#ifndef NAUTILUS_NAVIGATION_WINDOW_SLOT_H
+#define NAUTILUS_NAVIGATION_WINDOW_SLOT_H
+
+#include "nautilus-window-slot.h"
+
+typedef struct NautilusNavigationWindowSlot NautilusNavigationWindowSlot;
+typedef struct NautilusNavigationWindowSlotClass NautilusNavigationWindowSlotClass;
+
+
+#define NAUTILUS_TYPE_NAVIGATION_WINDOW_SLOT (nautilus_navigation_window_slot_get_type())
+#define NAUTILUS_NAVIGATION_WINDOW_SLOT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NAUTILUS_NAVIGATION_WINDOW_SLOT_CLASS, NautilusNavigationWindowSlotClass))
+#define NAUTILUS_NAVIGATION_WINDOW_SLOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_NAVIGATION_WINDOW_SLOT, NautilusNavigationWindowSlot))
+#define NAUTILUS_IS_NAVIGATION_WINDOW_SLOT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_NAVIGATION_WINDOW_SLOT))
+#define NAUTILUS_IS_NAVIGATION_WINDOW_SLOT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NAUTILUS_TYPE_NAVIGATION_WINDOW_SLOT))
+#define NAUTILUS_NAVIGATION_WINDOW_SLOT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NAUTILUS_TYPE_NAVIGATION_WINDOW_SLOT, NautilusNavigationWindowSlotClass))
+
+typedef enum {
+ NAUTILUS_BAR_PATH,
+ NAUTILUS_BAR_NAVIGATION,
+ NAUTILUS_BAR_SEARCH
+} NautilusBarMode;
+
+struct NautilusNavigationWindowSlot {
+ GtkWidget *content_box;
+ NautilusWindowSlot parent;
+
+ NautilusBarMode bar_mode;
+ GtkTreeModel *viewer_model;
+ int num_viewers;
+
+ /* Back/Forward chain, and history list.
+ * The data in these lists are NautilusBookmark pointers.
+ */
+ GList *back_list, *forward_list;
+
+ /* Current views stuff */
+ GList *sidebar_panels;
+};
+
+struct NautilusNavigationWindowSlotClass {
+ NautilusWindowSlotClass parent;
+};
+
+GType nautilus_navigation_window_slot_get_type (void);
+
+#endif /* NAUTILUS_NAVIGATION_WINDOW_SLOT_H */
+
Modified: branches/multiview/src/nautilus-navigation-window.c
==============================================================================
--- branches/multiview/src/nautilus-navigation-window.c (original)
+++ branches/multiview/src/nautilus-navigation-window.c Thu Mar 20 23:38:01 2008
@@ -39,6 +39,7 @@
#include "nautilus-pathbar.h"
#include "nautilus-query-editor.h"
#include "nautilus-search-bar.h"
+#include "nautilus-navigation-window-slot.h"
#include "nautilus-window-manage-views.h"
#include "nautilus-zoom-control.h"
#include <eel/eel-gtk-extensions.h>
@@ -90,12 +91,6 @@
#define MENU_PATH_BOOKMARKS_PLACEHOLDER "/MenuBar/Other Menus/Bookmarks/Bookmarks Placeholder"
-typedef enum {
- NAUTILUS_BAR_PATH,
- NAUTILUS_BAR_NAVIGATION,
- NAUTILUS_BAR_SEARCH
-} NautilusBarMode;
-
enum {
ARG_0,
ARG_APP_ID,
@@ -144,6 +139,8 @@
#endif
};
+
+
static void
location_button_toggled_cb (GtkToggleButton *toggle,
NautilusNavigationWindow *window)
@@ -195,7 +192,7 @@
GtkWidget *location_bar;
GtkWidget *view_as_menu_vbox;
GtkToolItem *item;
- GtkWidget *hbox, *vbox, *eventbox, *extras_vbox;
+ GtkWidget *hbox;
window->details = G_TYPE_INSTANCE_GET_PRIVATE (window, NAUTILUS_TYPE_NAVIGATION_WINDOW, NautilusNavigationWindowDetails);
@@ -208,25 +205,13 @@
0, 0);
gtk_widget_show (window->details->content_paned);
- vbox = gtk_vbox_new (FALSE, 0);
+ window->notebook = gtk_notebook_new ();
nautilus_horizontal_splitter_pack2 (
NAUTILUS_HORIZONTAL_SPLITTER (window->details->content_paned),
- vbox);
- gtk_widget_show (vbox);
-
- eventbox = gtk_event_box_new ();
- gtk_widget_set_name (eventbox, "nautilus-extra-view-widget");
- gtk_box_pack_start (GTK_BOX (vbox), eventbox, FALSE, FALSE, 0);
- gtk_widget_show (eventbox);
-
- extras_vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_set_border_width (GTK_CONTAINER (extras_vbox), 6);
- NAUTILUS_WINDOW (window)->details->extra_location_widgets = extras_vbox;
- gtk_container_add (GTK_CONTAINER (eventbox), extras_vbox);
-
- window->details->content_box = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), window->details->content_box, TRUE, TRUE, 0);
- gtk_widget_show (window->details->content_box);
+ window->notebook);
+ gtk_notebook_set_show_tabs (GTK_NOTEBOOK (window->notebook), FALSE);
+ gtk_notebook_set_show_border (GTK_NOTEBOOK (window->notebook), FALSE);
+ gtk_widget_show (window->notebook);
nautilus_navigation_window_initialize_actions (window);
nautilus_navigation_window_initialize_menus (window);
@@ -425,12 +410,15 @@
GFile *location,
NautilusNavigationWindow *window)
{
+ NautilusNavigationWindowSlot *slot;
int i;
g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
+ slot = NAUTILUS_NAVIGATION_WINDOW_SLOT (NAUTILUS_WINDOW (window)->details->active_slot);
+
/* check whether we already visited the target location */
- i = bookmark_list_get_uri_index (window->back_list, location);
+ i = bookmark_list_get_uri_index (slot->back_list, location);
if (i >= 0) {
nautilus_navigation_window_back_or_forward (window, TRUE, i);
} else {
@@ -441,8 +429,12 @@
static void
hide_temporary_bars (NautilusNavigationWindow *window)
{
+ NautilusWindowSlot *slot;
+
g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
+ slot = nautilus_window_get_active_slot (NAUTILUS_WINDOW (window));
+
if (window->details->temporary_location_bar) {
if (nautilus_navigation_window_location_bar_showing (window)) {
nautilus_navigation_window_hide_location_bar (window, FALSE);
@@ -450,7 +442,7 @@
window->details->temporary_location_bar = FALSE;
}
if (window->details->temporary_navigation_bar) {
- if (NAUTILUS_WINDOW (window)->details->search_mode) {
+ if (slot->search_mode) {
nautilus_navigation_window_set_bar_mode (window, NAUTILUS_BAR_SEARCH);
} else {
if (!eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY)) {
@@ -834,20 +826,28 @@
static void
activate_nth_short_list_item (NautilusWindow *window, guint index)
{
+ NautilusWindowSlot *slot;
+
g_assert (NAUTILUS_IS_WINDOW (window));
+
+ slot = window->details->active_slot;
g_assert (index < g_list_length (window->details->short_list_viewers));
- nautilus_window_set_content_view (window,
- g_list_nth_data (window->details->short_list_viewers, index));
+ nautilus_window_slot_set_content_view (slot,
+ g_list_nth_data (window->details->short_list_viewers, index));
}
static void
activate_extra_viewer (NautilusWindow *window)
{
+ NautilusWindowSlot *slot;
+
g_assert (NAUTILUS_IS_WINDOW (window));
+
+ slot = window->details->active_slot;
g_assert (window->details->extra_viewer != NULL);
-
- nautilus_window_set_content_view (window, window->details->extra_viewer);
+
+ nautilus_window_slot_set_content_view (slot, window->details->extra_viewer);
}
static void
@@ -871,6 +871,7 @@
static void
load_view_as_menu (NautilusWindow *window)
{
+ NautilusWindowSlot *slot;
GList *node;
int index;
int selected_index = -1;
@@ -889,6 +890,8 @@
store = GTK_LIST_STORE (model);
gtk_list_store_clear (store);
+ slot = window->details->active_slot;
+
/* Add a menu item for each view in the preferred list for this location. */
for (node = window->details->short_list_viewers, index = 0;
node != NULL;
@@ -896,7 +899,7 @@
info = nautilus_view_factory_lookup (node->data);
gtk_combo_box_append_text (combo_box, _(info->view_as_label));
- if (nautilus_window_content_view_matches_iid (NAUTILUS_WINDOW (window), (char *)node->data)) {
+ if (nautilus_window_slot_content_view_matches_iid (slot, (char *)node->data)) {
selected_index = index;
}
}
@@ -905,7 +908,7 @@
const char *id;
/* We're using an extra viewer, add a menu item for it */
- id = nautilus_window_get_content_view_id (window);
+ id = nautilus_window_slot_get_content_view_id (slot);
info = nautilus_view_factory_lookup (id);
gtk_combo_box_append_text (GTK_COMBO_BOX (NAUTILUS_NAVIGATION_WINDOW (window)->view_as_combo_box),
_(info->view_as_label));
@@ -924,30 +927,27 @@
load_view_as_menu (window);
}
-static gboolean
-real_set_title (NautilusWindow *window, const char *title)
+static void
+real_set_title (NautilusWindow *window,
+ const char *title)
{
char *full_title;
char *window_title;
- gboolean changed;
- changed = EEL_CALL_PARENT_WITH_RETURN_VALUE
- (NAUTILUS_WINDOW_CLASS, set_title, (window, title));
-
- if (changed) {
- full_title = g_strdup_printf (_("%s - File Browser"), title);
+ EEL_CALL_PARENT (NAUTILUS_WINDOW_CLASS,
+ set_title, (window, title));
- window_title = eel_str_middle_truncate (full_title, MAX_TITLE_LENGTH);
- gtk_window_set_title (GTK_WINDOW (window), window_title);
- g_free (window_title);
- g_free (full_title);
- }
+ full_title = g_strdup_printf (_("%s - File Browser"), title);
- return changed;
+ window_title = eel_str_middle_truncate (full_title, MAX_TITLE_LENGTH);
+ gtk_window_set_title (GTK_WINDOW (window), window_title);
+ g_free (window_title);
+ g_free (full_title);
}
static NautilusIconInfo *
-real_get_icon (NautilusWindow *window)
+real_get_icon (NautilusWindow *window,
+ NautilusWindowSlot *slot)
{
return nautilus_icon_info_lookup_from_name ("file-manager", 48);
}
@@ -956,8 +956,8 @@
zoom_level_changed_callback (NautilusView *view,
NautilusNavigationWindow *window)
{
- g_assert (NAUTILUS_IS_WINDOW (window));
-
+ g_assert (NAUTILUS_WINDOW (window)->details->active_slot->content_view == view);
+
/* This is called each time the component successfully completed
* a zooming operation.
*/
@@ -966,52 +966,24 @@
}
static void
-connect_view (NautilusNavigationWindow *window, NautilusView *view)
+real_connect_content_view (NautilusWindow *nautilus_window,
+ NautilusView *view)
{
- g_signal_connect (view, "zoom_level_changed",
- G_CALLBACK (zoom_level_changed_callback),
- window);
-}
-
-static void
-disconnect_view (NautilusNavigationWindow *window, NautilusView *view)
-{
- if (!view) {
- return;
- }
-
- g_signal_handlers_disconnect_by_func
- (view,
- G_CALLBACK (zoom_level_changed_callback),
- window);
-}
-
-static void
-real_set_content_view_widget (NautilusWindow *nautilus_window,
- NautilusView *new_view)
-{
-
NautilusNavigationWindow *window;
+ NautilusWindowSlot *slot;
window = NAUTILUS_NAVIGATION_WINDOW (nautilus_window);
-
- disconnect_view (window, nautilus_window->content_view);
+ slot = nautilus_window->details->active_slot;
EEL_CALL_PARENT (NAUTILUS_WINDOW_CLASS,
- set_content_view_widget,
- (nautilus_window, new_view));
-
+ connect_content_view,
+ (nautilus_window, view));
- if (new_view == NULL) {
- return;
- }
-
- connect_view (window, new_view);
-
- gtk_container_add (GTK_CONTAINER (window->details->content_box),
- GTK_WIDGET (new_view));
+ g_signal_connect (view, "zoom_level_changed",
+ G_CALLBACK (zoom_level_changed_callback),
+ window);
- if (new_view != NULL && nautilus_view_supports_zooming (new_view)) {
+ if (nautilus_view_supports_zooming (view)) {
gtk_widget_show (window->zoom_control);
} else {
gtk_widget_hide (window->zoom_control);
@@ -1022,12 +994,32 @@
* install a whole new set of views in the menu later (the current
* views in the menu are for the old location).
*/
- if (nautilus_window->details->pending_location == NULL) {
+ if (slot->pending_location == NULL) {
load_view_as_menu (nautilus_window);
}
}
static void
+real_disconnect_content_view (NautilusWindow *nautilus_window,
+ NautilusView *view)
+{
+ NautilusNavigationWindow *window;
+
+ window = NAUTILUS_NAVIGATION_WINDOW (nautilus_window);
+
+ EEL_CALL_PARENT (NAUTILUS_WINDOW_CLASS,
+ disconnect_content_view,
+ (nautilus_window, view));
+
+ g_signal_handlers_disconnect_by_func
+ (view,
+ G_CALLBACK (zoom_level_changed_callback),
+ window);
+
+ gtk_widget_hide (window->zoom_control);
+}
+
+static void
real_set_throbber_active (NautilusWindow *window, gboolean active)
{
nautilus_navigation_window_set_throbber_active
@@ -1089,8 +1081,9 @@
query = nautilus_search_bar_get_query (NAUTILUS_SEARCH_BAR (NAUTILUS_NAVIGATION_WINDOW (window)->search_bar));
if (query != NULL) {
+ NautilusWindowSlot *slot = window->details->active_slot;
if (!nautilus_search_directory_is_indexed (search_directory)) {
- current_uri = nautilus_window_get_location_uri (window);
+ current_uri = nautilus_window_slot_get_location_uri (slot);
nautilus_query_set_location (query, current_uri);
g_free (current_uri);
}
@@ -1128,17 +1121,19 @@
query_editor_changed_callback (NautilusSearchBar *bar,
NautilusQuery *query,
gboolean reload,
- NautilusWindow *window)
+ NautilusWindowSlot *slot)
{
NautilusDirectory *directory;
- directory = nautilus_directory_get_for_file (window->details->viewed_file);
+ g_assert (NAUTILUS_IS_FILE (slot->viewed_file));
+
+ directory = nautilus_directory_get_for_file (slot->viewed_file);
g_assert (NAUTILUS_IS_SEARCH_DIRECTORY (directory));
nautilus_search_directory_set_query (NAUTILUS_SEARCH_DIRECTORY (directory),
query);
if (reload) {
- nautilus_window_reload (window);
+ nautilus_window_slot_reload (slot);
}
nautilus_directory_unref (directory);
@@ -1148,12 +1143,15 @@
real_set_search_mode (NautilusWindow *window, gboolean search_mode,
NautilusSearchDirectory *search_directory)
{
+ NautilusWindowSlot *slot;
NautilusNavigationWindow *nav_window;
GtkWidget *query_editor;
NautilusQuery *query;
nav_window = NAUTILUS_NAVIGATION_WINDOW (window);
+ slot = window->details->active_slot;
+
if (!search_mode) {
nav_window->details->temporary_search_bar = TRUE;
hide_temporary_bars (nav_window);
@@ -1174,7 +1172,7 @@
}
g_signal_connect_object (query_editor, "changed",
- G_CALLBACK (query_editor_changed_callback), window, 0);
+ G_CALLBACK (query_editor_changed_callback), slot, 0);
query = nautilus_search_directory_get_query (search_directory);
if (query != NULL) {
@@ -1185,7 +1183,7 @@
nautilus_query_editor_set_default_query (NAUTILUS_QUERY_EDITOR (query_editor));
}
- nautilus_window_add_extra_location_widget (window, query_editor);
+ nautilus_window_slot_add_extra_location_widget (slot, query_editor);
gtk_widget_show (query_editor);
nautilus_query_editor_grab_focus (NAUTILUS_QUERY_EDITOR (query_editor));
}
@@ -1193,15 +1191,25 @@
void
nautilus_navigation_window_clear_forward_list (NautilusNavigationWindow *window)
{
- eel_g_object_list_free (window->forward_list);
- window->forward_list = NULL;
+ NautilusNavigationWindowSlot *slot;
+
+ slot = NAUTILUS_NAVIGATION_WINDOW_SLOT (NAUTILUS_WINDOW (window)->details->active_slot);
+ g_assert (slot != NULL);
+
+ eel_g_object_list_free (slot->forward_list);
+ slot->forward_list = NULL;
}
void
nautilus_navigation_window_clear_back_list (NautilusNavigationWindow *window)
{
- eel_g_object_list_free (window->back_list);
- window->back_list = NULL;
+ NautilusNavigationWindowSlot *slot;
+
+ slot = NAUTILUS_NAVIGATION_WINDOW_SLOT (NAUTILUS_WINDOW (window)->details->active_slot);
+ g_assert (slot != NULL);
+
+ eel_g_object_list_free (slot->back_list);
+ slot->back_list = NULL;
}
static void
@@ -1464,9 +1472,12 @@
gint
nautilus_navigation_window_get_base_page_index (NautilusNavigationWindow *window)
{
+ NautilusNavigationWindowSlot *slot;
gint forward_count;
-
- forward_count = g_list_length (window->forward_list);
+
+ slot = NAUTILUS_NAVIGATION_WINDOW_SLOT (NAUTILUS_WINDOW (window)->details->active_slot);
+
+ forward_count = g_list_length (slot->forward_list);
/* If forward is empty, the base it at the top of the list */
if (forward_count == 0) {
@@ -1578,6 +1589,36 @@
}
}
+static NautilusWindowSlot *
+real_open_slot (NautilusWindow *window)
+{
+ NautilusWindowSlot *slot;
+
+ /* these will be removed once we have real tab support */
+ g_assert (window->details->active_slot == NULL);
+ g_assert (window->details->slots == NULL);
+
+ slot = (NautilusWindowSlot *) g_object_new (NAUTILUS_TYPE_NAVIGATION_WINDOW_SLOT, NULL);
+ slot->window = window;
+ gtk_notebook_append_page (GTK_NOTEBOOK (NAUTILUS_NAVIGATION_WINDOW (window)->notebook),
+ slot->content_box,
+ NULL);
+ gtk_widget_show (slot->content_box);
+
+ return slot;
+}
+
+static void
+real_close_slot (NautilusWindow *window,
+ NautilusWindowSlot *slot)
+{
+ /* multiview-TODO these will be removed once we have real tab support */
+ g_assert (window->details->active_slot == slot);
+ g_assert (g_list_length (window->details->slots) == 1);
+
+ /* multiview-TODO remove notebook tab */
+}
+
static void
nautilus_navigation_window_class_init (NautilusNavigationWindowClass *class)
{
@@ -1591,7 +1632,8 @@
GTK_WIDGET_CLASS (class)->window_state_event = nautilus_navigation_window_state_event;
GTK_WIDGET_CLASS (class)->key_press_event = nautilus_navigation_window_key_press_event;
NAUTILUS_WINDOW_CLASS (class)->load_view_as_menu = real_load_view_as_menu;
- NAUTILUS_WINDOW_CLASS (class)->set_content_view_widget = real_set_content_view_widget;
+ NAUTILUS_WINDOW_CLASS (class)->connect_content_view = real_connect_content_view;
+ NAUTILUS_WINDOW_CLASS (class)->disconnect_content_view = real_disconnect_content_view;
NAUTILUS_WINDOW_CLASS (class)->set_throbber_active = real_set_throbber_active;
NAUTILUS_WINDOW_CLASS (class)->prompt_for_location = real_prompt_for_location;
NAUTILUS_WINDOW_CLASS (class)->set_search_mode = real_set_search_mode;
@@ -1600,5 +1642,8 @@
NAUTILUS_WINDOW_CLASS (class)->get_default_size = real_get_default_size;
NAUTILUS_WINDOW_CLASS (class)->close = real_window_close;
+ NAUTILUS_WINDOW_CLASS (class)->open_slot = real_open_slot;
+ NAUTILUS_WINDOW_CLASS (class)->close_slot = real_close_slot;
+
g_type_class_add_private (G_OBJECT_CLASS (class), sizeof (NautilusNavigationWindowDetails));
}
Modified: branches/multiview/src/nautilus-navigation-window.h
==============================================================================
--- branches/multiview/src/nautilus-navigation-window.h (original)
+++ branches/multiview/src/nautilus-navigation-window.h Thu Mar 20 23:38:01 2008
@@ -50,6 +50,7 @@
typedef struct _NautilusNavigationWindowClass NautilusNavigationWindowClass;
typedef struct _NautilusNavigationWindowDetails NautilusNavigationWindowDetails;
+
struct _NautilusNavigationWindow {
NautilusWindow parent_object;
@@ -61,12 +62,8 @@
GtkWidget *navigation_bar;
GtkWidget *path_bar;
GtkWidget *search_bar;
-
- /* Back/Forward chain, and history list.
- * The data in these lists are NautilusBookmark pointers.
- */
- GList *back_list, *forward_list;
-
+ GtkWidget *notebook;
+
/* Current views stuff */
GList *sidebar_panels;
Modified: branches/multiview/src/nautilus-notes-viewer.c
==============================================================================
--- branches/multiview/src/nautilus-notes-viewer.c (original)
+++ branches/multiview/src/nautilus-notes-viewer.c Thu Mar 20 23:38:01 2008
@@ -47,6 +47,8 @@
#include <libnautilus-private/nautilus-clipboard.h>
#include <libnautilus-private/nautilus-module.h>
#include <libnautilus-private/nautilus-sidebar-provider.h>
+#include <libnautilus-private/nautilus-window-info.h>
+#include <libnautilus-private/nautilus-window-slot-info.h>
#include <libnautilus-extension/nautilus-property-page-provider.h>
#define SAVE_TIMEOUT (3 * 1000)
@@ -279,7 +281,7 @@
}
static void
-loading_uri_callback (NautilusSidebar *sidebar,
+loading_uri_callback (NautilusWindowInfo *window,
const char *location,
NautilusNotesViewer *notes)
{
@@ -430,11 +432,15 @@
nautilus_notes_viewer_set_parent_window (NautilusNotesViewer *sidebar,
NautilusWindowInfo *window)
{
+ NautilusWindowSlotInfo *slot;
+
+ slot = nautilus_window_info_get_active_slot (window);
+
g_signal_connect_object (window, "loading_uri",
G_CALLBACK (loading_uri_callback), sidebar, 0);
g_free (sidebar->details->uri);
- sidebar->details->uri = nautilus_window_info_get_current_location (window);
+ sidebar->details->uri = nautilus_window_slot_info_get_current_location (slot);
notes_load_metainfo (sidebar);
nautilus_clipboard_set_up_text_view
Modified: branches/multiview/src/nautilus-places-sidebar.c
==============================================================================
--- branches/multiview/src/nautilus-places-sidebar.c (original)
+++ branches/multiview/src/nautilus-places-sidebar.c Thu Mar 20 23:38:01 2008
@@ -57,6 +57,8 @@
#include <libnautilus-private/nautilus-trash-monitor.h>
#include <libnautilus-private/nautilus-icon-names.h>
#include <libnautilus-private/nautilus-autorun.h>
+#include <libnautilus-private/nautilus-window-info.h>
+#include <libnautilus-private/nautilus-window-slot-info.h>
#include <gio/gio.h>
#include "nautilus-bookmark-list.h"
@@ -247,11 +249,13 @@
char *location, *mount_uri, *name, *desktop_path;
GIcon *icon;
GFile *root;
-
-
+ NautilusWindowSlotInfo *slot;
+
selection = gtk_tree_view_get_selection (sidebar->tree_view);
gtk_list_store_clear (sidebar->store);
- location = nautilus_window_info_get_current_location (sidebar->window);
+
+ slot = nautilus_window_info_get_active_slot (sidebar->window);
+ location = nautilus_window_slot_info_get_current_location (slot);
/* add built in bookmarks */
desktop_path = nautilus_get_desktop_directory ();
@@ -1275,6 +1279,7 @@
GtkTreePath *path,
gboolean open_in_new_window)
{
+ NautilusWindowSlot *slot;
GtkTreeIter iter;
GFile *location;
char *uri;
@@ -1296,9 +1301,10 @@
location = g_file_new_for_uri (uri);
/* Navigate to the clicked location */
if (!open_in_new_window) {
- nautilus_window_info_open_location (sidebar->window, location,
- NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
- 0, NULL);
+ slot = nautilus_window_info_get_active_slot (sidebar->window);
+ nautilus_window_slot_info_open_location (slot, location,
+ NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
+ 0, NULL);
} else {
NautilusWindow *cur, *new;
@@ -2046,11 +2052,15 @@
static void
nautilus_places_sidebar_set_parent_window (NautilusPlacesSidebar *sidebar,
NautilusWindowInfo *window)
-{
+{
+ NautilusWindowSlotInfo *slot;
+
sidebar->window = window;
-
+
+ slot = nautilus_window_info_get_active_slot (window);
+
sidebar->bookmarks = nautilus_window_info_get_bookmark_list (window);
- sidebar->uri = nautilus_window_info_get_current_location (window);
+ sidebar->uri = nautilus_window_slot_info_get_current_location (slot);
g_signal_connect_object (sidebar->bookmarks, "contents_changed",
G_CALLBACK (update_places),
Modified: branches/multiview/src/nautilus-shell.c
==============================================================================
--- branches/multiview/src/nautilus-shell.c (original)
+++ branches/multiview/src/nautilus-shell.c Thu Mar 20 23:38:01 2008
@@ -81,7 +81,7 @@
CORBA_Environment *ev);
static void corba_restart (PortableServer_Servant servant,
CORBA_Environment *ev);
-static gboolean restore_window_states (NautilusShell *shell);
+//static gboolean restore_window_states (NautilusShell *shell);
BONOBO_CLASS_BOILERPLATE_FULL (NautilusShell, nautilus_shell,
Nautilus_Shell,
@@ -187,11 +187,11 @@
GList *l;
if (data->uris == NULL) {
- if (!restore_window_states (data->shell)) {
+// if (!restore_window_states (data->shell)) {
/* Open a window pointing at the default location. */
open_window (data->shell, NULL, data->startup_id,
data->geometry, data->browser_window);
- }
+// }
} else {
/* Open windows at each requested location. */
for (l = data->uris; l != NULL; l = l->next) {
@@ -369,6 +369,8 @@
#define WINDOW_STATE_ATTRIBUTE_LOCATION 4
#define WINDOW_STATE_ATTRIBUTE_SCREEN 5
+#if 0
+
static void
save_window_states (void)
{
@@ -526,10 +528,12 @@
return result;
}
+#endif
+
static gboolean
restart_at_idle (gpointer data)
{
- save_window_states ();
+// save_window_states ();
nautilus_main_event_loop_quit (TRUE);
g_setenv ("_NAUTILUS_RESTART", "yes", 1);
Modified: branches/multiview/src/nautilus-spatial-window.c
==============================================================================
--- branches/multiview/src/nautilus-spatial-window.c (original)
+++ branches/multiview/src/nautilus-spatial-window.c Thu Mar 20 23:38:01 2008
@@ -178,27 +178,35 @@
nautilus_spatial_window_state_event (GtkWidget *widget,
GdkEventWindowState *event)
{
+ NautilusWindow *window;
+ NautilusWindowSlot *slot;
+ NautilusFile *viewed_file;
+
+ window = NAUTILUS_WINDOW (widget);
+ slot = window->details->active_slot;
+ viewed_file = slot->viewed_file;
+
if (!NAUTILUS_IS_DESKTOP_WINDOW (widget)) {
if (event->changed_mask & GDK_WINDOW_STATE_MAXIMIZED &&
- NAUTILUS_WINDOW (widget)->details->viewed_file != NULL) {
- nautilus_file_set_boolean_metadata (NAUTILUS_WINDOW (widget)->details->viewed_file,
+ viewed_file != NULL) {
+ nautilus_file_set_boolean_metadata (viewed_file,
NAUTILUS_METADATA_KEY_WINDOW_MAXIMIZED,
FALSE,
event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED);
}
if (event->changed_mask & GDK_WINDOW_STATE_STICKY &&
- NAUTILUS_WINDOW (widget)->details->viewed_file != NULL) {
- nautilus_file_set_boolean_metadata (NAUTILUS_WINDOW (widget)->details->viewed_file,
+ viewed_file != NULL) {
+ nautilus_file_set_boolean_metadata (viewed_file,
NAUTILUS_METADATA_KEY_WINDOW_STICKY,
FALSE,
event->new_window_state & GDK_WINDOW_STATE_STICKY);
}
if (event->changed_mask & GDK_WINDOW_STATE_ABOVE &&
- NAUTILUS_WINDOW (widget)->details->viewed_file != NULL) {
- nautilus_file_set_boolean_metadata (NAUTILUS_WINDOW (widget)->details->viewed_file,
+ viewed_file != NULL) {
+ nautilus_file_set_boolean_metadata (viewed_file,
NAUTILUS_METADATA_KEY_WINDOW_KEEP_ABOVE,
FALSE,
event->new_window_state & GDK_WINDOW_STATE_ABOVE);
@@ -240,13 +248,19 @@
}
void
-nautilus_spatial_window_save_geometry (NautilusSpatialWindow *window)
+nautilus_spatial_window_save_geometry (NautilusSpatialWindow *spatial_window)
{
+ NautilusWindow *window;
+ NautilusWindowSlot *slot;
+ NautilusFile *viewed_file;
char *geometry_string;
- g_assert (NAUTILUS_IS_WINDOW (window));
+ window = NAUTILUS_WINDOW (spatial_window);
+
+ slot = window->details->active_slot;
+ viewed_file = slot->viewed_file;
- if (NAUTILUS_WINDOW (window)->details->viewed_file == NULL) {
+ if (viewed_file == NULL) {
/* We never showed a file */
return;
}
@@ -255,7 +269,7 @@
!(gdk_window_get_state (GTK_WIDGET(window)->window) & GDK_WINDOW_STATE_MAXIMIZED)) {
geometry_string = eel_gtk_window_get_geometry_string (GTK_WINDOW (window));
- nautilus_file_set_metadata (NAUTILUS_WINDOW (window)->details->viewed_file,
+ nautilus_file_set_metadata (viewed_file,
NAUTILUS_METADATA_KEY_WINDOW_GEOMETRY,
NULL,
geometry_string);
@@ -268,16 +282,18 @@
nautilus_spatial_window_save_scroll_position (NautilusSpatialWindow *window)
{
NautilusWindow *parent;
+ NautilusWindowSlot *slot;
char *scroll_string;
parent = NAUTILUS_WINDOW(window);
-
- if (parent->content_view == NULL) {
+ slot = parent->details->active_slot;
+
+ if (slot->content_view == NULL) {
return;
}
- scroll_string = nautilus_view_get_first_visible_file (parent->content_view);
- nautilus_file_set_metadata (parent->details->viewed_file,
+ scroll_string = nautilus_view_get_first_visible_file (slot->content_view);
+ nautilus_file_set_metadata (slot->viewed_file,
NAUTILUS_METADATA_KEY_WINDOW_SCROLL_POSITION,
NULL,
scroll_string);
@@ -289,6 +305,9 @@
{
char *show_hidden_file_setting;
NautilusWindowShowHiddenFilesMode mode;
+ NautilusWindowSlot *slot;
+
+ slot = NAUTILUS_WINDOW (window)->details->active_slot;
mode = NAUTILUS_WINDOW (window)->details->show_hidden_files_mode;
if (mode != NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT) {
@@ -297,7 +316,7 @@
} else {
show_hidden_file_setting = "0";
}
- nautilus_file_set_metadata (NAUTILUS_WINDOW (window)->details->viewed_file,
+ nautilus_file_set_metadata (slot->viewed_file,
NAUTILUS_METADATA_KEY_WINDOW_SHOW_HIDDEN_FILES,
NULL,
show_hidden_file_setting);
@@ -313,7 +332,7 @@
GTK_WIDGET_CLASS (nautilus_spatial_window_parent_class)->show (widget);
- if (NAUTILUS_WINDOW (window)->details->search_mode &&
+ if (NAUTILUS_WINDOW (window)->details->active_slot->search_mode &&
window->details->query_editor != NULL) {
nautilus_query_editor_grab_focus (NAUTILUS_QUERY_EDITOR (window->details->query_editor));
}
@@ -355,8 +374,11 @@
NautilusWindow *window)
{
NautilusDirectory *directory;
+ NautilusWindowSlot *slot;
- directory = nautilus_directory_get_for_file (window->details->viewed_file);
+ slot = window->details->active_slot;
+
+ directory = nautilus_directory_get_for_file (slot->viewed_file);
g_assert (NAUTILUS_IS_SEARCH_DIRECTORY (directory));
nautilus_search_directory_set_query (NAUTILUS_SEARCH_DIRECTORY (directory),
@@ -372,6 +394,7 @@
real_set_search_mode (NautilusWindow *window, gboolean search_mode,
NautilusSearchDirectory *search_directory)
{
+ NautilusWindowSlot *slot;
NautilusSpatialWindow *spatial_window;
GtkWidget *query_editor;
NautilusQuery *query;
@@ -379,13 +402,15 @@
spatial_window = NAUTILUS_SPATIAL_WINDOW (window);
spatial_window->details->query_editor = NULL;
-
+
+ slot = window->details->active_slot;
+
if (search_mode) {
query_editor = nautilus_query_editor_new (nautilus_search_directory_is_saved_search (search_directory),
nautilus_search_directory_is_indexed (search_directory));
spatial_window->details->query_editor = query_editor;
- nautilus_window_add_extra_location_widget (window, query_editor);
+ nautilus_window_slot_add_extra_location_widget (slot, query_editor);
gtk_widget_show (query_editor);
nautilus_query_editor_grab_focus (NAUTILUS_QUERY_EDITOR (query_editor));
g_signal_connect_object (query_editor, "changed",
@@ -403,44 +428,36 @@
}
static NautilusIconInfo *
-real_get_icon (NautilusWindow *window)
+real_get_icon (NautilusWindow *window,
+ NautilusWindowSlot *slot)
{
- return nautilus_file_get_icon (window->details->viewed_file, 48,
+ return nautilus_file_get_icon (slot->viewed_file, 48,
NAUTILUS_FILE_ICON_FLAGS_IGNORE_VISITING);
}
-static gboolean
-real_set_title (NautilusWindow *window, const char *title)
+static void
+sync_window_title (NautilusWindow *window)
{
- gboolean changed;
+ NautilusWindowSlot *slot;
- changed = NAUTILUS_WINDOW_CLASS (nautilus_spatial_window_parent_class)->set_title (window, title);
+ slot = window->details->active_slot;
- if (changed && title[0] == '\0') {
+ if (slot->title == NULL || slot->title[0] == '\0') {
gtk_window_set_title (GTK_WINDOW (window), _("Nautilus"));
- } else if (changed) {
+ } else {
char *window_title;
- window_title = eel_str_middle_truncate (title, MAX_TITLE_LENGTH);
+ window_title = eel_str_middle_truncate (slot->title, MAX_TITLE_LENGTH);
gtk_window_set_title (GTK_WINDOW (window), window_title);
g_free (window_title);
}
-
- return changed;
}
static void
-real_set_content_view_widget (NautilusWindow *window,
- NautilusView *new_view)
+real_set_title (NautilusWindow *window,
+ const char *title)
{
- GtkWidget *widget;
-
- NAUTILUS_WINDOW_CLASS (nautilus_spatial_window_parent_class)->set_content_view_widget (window, new_view);
-
- widget = nautilus_view_get_widget (new_view);
-
- gtk_container_add (GTK_CONTAINER (NAUTILUS_SPATIAL_WINDOW (window)->details->content_box),
- widget);
+ sync_window_title (window);
}
static void
@@ -483,16 +500,45 @@
NAUTILUS_WINDOW_CLASS (nautilus_spatial_window_parent_class)->set_allow_up (window, allow);
}
+static NautilusWindowSlot *
+real_open_slot (NautilusWindow *window)
+{
+ NautilusWindowSlot *slot;
+
+ g_assert (window->details->active_slot == NULL);
+ g_assert (window->details->slots == NULL);
+
+ slot = g_object_new (NAUTILUS_TYPE_WINDOW_SLOT, NULL);
+ slot->window = window;
+ gtk_container_add (GTK_CONTAINER (NAUTILUS_SPATIAL_WINDOW (window)->details->content_box),
+ slot->content_box);
+ gtk_widget_show (slot->content_box);
+ return slot;
+}
+
+static void
+real_close_slot (NautilusWindow *window,
+ NautilusWindowSlot *slot)
+{
+ g_assert (window->details->active_slot == slot);
+ g_assert (g_list_length (window->details->slots) == 1);
+
+ /* nothing to do */
+}
+
static void
location_menu_item_activated_callback (GtkWidget *menu_item,
- NautilusSpatialWindow *window)
+ NautilusWindow *window)
{
+ NautilusWindowSlot *slot;
char *location;
GFile *current;
GFile *dest;
GdkEvent *event;
- location = nautilus_window_get_location_uri (NAUTILUS_WINDOW (window));
+ slot = window->details->active_slot;
+
+ location = nautilus_window_slot_get_location_uri (slot);
current = g_file_new_for_uri (location);
g_free (location);
@@ -521,8 +567,8 @@
close_behind = TRUE;
}
- nautilus_window_open_location_with_selection (NAUTILUS_WINDOW (window),
- dest, selection, close_behind);
+ nautilus_window_slot_open_location_with_selection
+ (slot, dest, selection, close_behind);
eel_g_object_list_free (selection);
}
@@ -613,9 +659,12 @@
GdkEventButton *event,
NautilusWindow *window)
{
- if (event->button == 3 &&
- window->content_view != NULL) {
- nautilus_view_pop_up_location_context_menu (window->content_view, event);
+ NautilusView *view;
+
+ view = window->details->active_slot->content_view;
+
+ if (event->button == 3 && view != NULL) {
+ nautilus_view_pop_up_location_context_menu (view, event);
}
return FALSE;
@@ -625,16 +674,19 @@
location_button_clicked_callback (GtkWidget *widget,
NautilusSpatialWindow *window)
{
+ NautilusWindowSlot *slot;
GtkWidget *popup, *menu_item, *first_item = NULL;
char *location;
GFile *uri;
GFile *child_uri;
GMainLoop *loop;
+ slot = NAUTILUS_WINDOW (window)->details->active_slot;
+
popup = gtk_menu_new ();
first_item = NULL;
- location = nautilus_window_get_location_uri (NAUTILUS_WINDOW (window));
+ location = nautilus_window_slot_get_location_uri (slot);
g_return_if_fail (location != NULL);
uri = g_file_new_for_uri (location);
@@ -715,14 +767,16 @@
get_dnd_icon_size (NautilusSpatialWindow *window)
{
NautilusWindow *parent;
+ NautilusView *view;
NautilusZoomLevel zoom_level;
parent = NAUTILUS_WINDOW(window);
+ view = parent->details->active_slot->content_view;
- if (parent->content_view == NULL) {
+ if (view == NULL) {
return NAUTILUS_ICON_SIZE_STANDARD;
} else {
- zoom_level = nautilus_view_get_zoom_level (parent->content_view);
+ zoom_level = nautilus_view_get_zoom_level (view);
return nautilus_get_icon_size_for_zoom_level (zoom_level);
}
@@ -733,9 +787,12 @@
GdkDragContext *context,
NautilusSpatialWindow *window)
{
+ NautilusWindowSlot *slot;
GdkPixbuf *pixbuf;
- pixbuf = nautilus_file_get_icon_pixbuf (NAUTILUS_WINDOW (window)->details->viewed_file,
+ slot = NAUTILUS_WINDOW (window)->details->active_slot;
+
+ pixbuf = nautilus_file_get_icon_pixbuf (slot->viewed_file,
get_dnd_icon_size (window),
FALSE,
NAUTILUS_FILE_ICON_FLAGS_IGNORE_VISITING | NAUTILUS_FILE_ICON_FLAGS_FOR_DRAG_ACCEPT);
@@ -754,13 +811,16 @@
gpointer data)
{
NautilusSpatialWindow *window;
+ NautilusWindowSlot *slot;
char *location;
int icon_size;
g_assert (NAUTILUS_IS_SPATIAL_WINDOW (iterator_context));
window = NAUTILUS_SPATIAL_WINDOW (iterator_context);
- location = nautilus_window_get_location_uri (NAUTILUS_WINDOW (window));
+ slot = NAUTILUS_WINDOW (window)->details->active_slot;
+
+ location = nautilus_window_slot_get_location_uri (slot);
icon_size = get_dnd_icon_size (window);
iteratee (location,
@@ -904,7 +964,7 @@
{
GtkRcStyle *rc_style;
GtkWidget *arrow;
- GtkWidget *hbox, *vbox, *eventbox, *extras_vbox;
+ GtkWidget *hbox, *vbox;
GtkActionGroup *action_group;
GtkUIManager *ui_manager;
GtkTargetList *targets;
@@ -924,21 +984,8 @@
GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_EXPAND | GTK_FILL | GTK_SHRINK,
0, 0);
gtk_widget_show (vbox);
+ window->details->content_box = vbox;
- eventbox = gtk_event_box_new ();
- gtk_widget_set_name (eventbox, "nautilus-extra-view-widget");
- gtk_box_pack_start (GTK_BOX (vbox), eventbox, FALSE, FALSE, 0);
- gtk_widget_show (eventbox);
-
- extras_vbox = gtk_vbox_new (FALSE, 6);
- gtk_container_set_border_width (GTK_CONTAINER (extras_vbox), 6);
- NAUTILUS_WINDOW (window)->details->extra_location_widgets = extras_vbox;
- gtk_container_add (GTK_CONTAINER (eventbox), extras_vbox);
-
- window->details->content_box = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), window->details->content_box, TRUE, TRUE, 0);
- gtk_widget_show (window->details->content_box);
-
window->details->location_button = gtk_button_new ();
g_signal_connect (window->details->location_button,
"button-press-event",
@@ -1038,8 +1085,6 @@
real_get_icon;
NAUTILUS_WINDOW_CLASS (class)->set_title =
real_set_title;
- NAUTILUS_WINDOW_CLASS (class)->set_content_view_widget =
- real_set_content_view_widget;
NAUTILUS_WINDOW_CLASS (class)->close =
real_window_close;
NAUTILUS_WINDOW_CLASS(class)->get_default_size = real_get_default_size;
@@ -1049,6 +1094,9 @@
NAUTILUS_WINDOW_CLASS(class)->set_allow_up =
real_set_allow_up;
+ NAUTILUS_WINDOW_CLASS (class)->open_slot = real_open_slot;
+ NAUTILUS_WINDOW_CLASS (class)->close_slot = real_close_slot;
+
binding_set = gtk_binding_set_by_class (class);
gtk_binding_entry_add_signal (binding_set, GDK_BackSpace, GDK_SHIFT_MASK,
"go_up", 1,
Modified: branches/multiview/src/nautilus-window-bookmarks.c
==============================================================================
--- branches/multiview/src/nautilus-window-bookmarks.c (original)
+++ branches/multiview/src/nautilus-window-bookmarks.c Thu Mar 20 23:38:01 2008
@@ -153,10 +153,12 @@
nautilus_window_add_bookmark_for_current_location (NautilusWindow *window)
{
NautilusBookmark *bookmark;
+ NautilusWindowSlot *slot;
- g_return_if_fail (NAUTILUS_IS_WINDOW (window));
+ g_assert (NAUTILUS_IS_WINDOW (window));
- bookmark = window->current_location_bookmark;
+ slot = window->details->active_slot;
+ bookmark = slot->current_location_bookmark;
if (!nautilus_bookmark_list_contains (nautilus_get_bookmark_list (), bookmark)) {
nautilus_bookmark_list_append (nautilus_get_bookmark_list (), bookmark);
Modified: branches/multiview/src/nautilus-window-manage-views.c
==============================================================================
--- branches/multiview/src/nautilus-window-manage-views.c (original)
+++ branches/multiview/src/nautilus-window-manage-views.c Thu Mar 20 23:38:01 2008
@@ -35,6 +35,8 @@
#include "nautilus-pathbar.h"
#include "nautilus-main.h"
#include "nautilus-window-private.h"
+#include "nautilus-window-slot.h"
+#include "nautilus-navigation-window-slot.h"
#include "nautilus-trash-bar.h"
#include "nautilus-x-content-bar.h"
#include "nautilus-zoom-control.h"
@@ -64,6 +66,7 @@
#include <libnautilus-private/nautilus-search-directory.h>
#include <libnautilus-private/nautilus-view-factory.h>
#include <libnautilus-private/nautilus-window-info.h>
+#include <libnautilus-private/nautilus-window-slot-info.h>
#include <libnautilus-private/nautilus-autorun.h>
/* FIXME bugzilla.gnome.org 41243:
@@ -79,38 +82,36 @@
*/
#define MAX_URI_IN_DIALOG_LENGTH 60
-static void connect_view (NautilusWindow *window,
+static void slot_connect_view (NautilusWindowSlot *slot,
NautilusView *view);
-static void disconnect_view (NautilusWindow *window,
+static void slot_disconnect_view (NautilusWindowSlot *slot,
NautilusView *view);
-static void begin_location_change (NautilusWindow *window,
+static void begin_location_change (NautilusWindowSlot *slot,
GFile *location,
GList *new_selection,
NautilusLocationChangeType type,
guint distance,
const char *scroll_pos);
-static void free_location_change (NautilusWindow *window);
-static void end_location_change (NautilusWindow *window);
-static void cancel_location_change (NautilusWindow *window);
+static void free_location_change (NautilusWindowSlot *slot);
+static void end_location_change (NautilusWindowSlot *slot);
+static void cancel_location_change (NautilusWindowSlot *slot);
static void got_file_info_for_view_selection_callback (NautilusFile *file,
gpointer callback_data);
-static void create_content_view (NautilusWindow *window,
+static void create_content_view (NautilusWindowSlot *slot,
const char *view_id);
static void display_view_selection_failure (NautilusWindow *window,
NautilusFile *file,
GFile *location,
GError *error);
-static void load_new_location (NautilusWindow *window,
+static void load_new_location (NautilusWindowSlot *slot,
GFile *location,
GList *selection,
gboolean tell_current_content_view,
gboolean tell_new_content_view);
-static void location_has_really_changed (NautilusWindow *window);
-static void update_for_new_location (NautilusWindow *window);
+static void location_has_really_changed (NautilusWindowSlot *slot);
+static void update_for_new_location (NautilusWindowSlot *slot);
static void zoom_parameters_changed_callback (NautilusView *view,
- NautilusWindow *window);
-static void update_extra_location_widgets_visibility (NautilusWindow *window);
-static void remove_extra_location_widgets (NautilusWindow *window);
+ NautilusWindowSlot *window);
void
nautilus_window_report_selection_changed (NautilusWindowInfo *window)
@@ -121,33 +122,37 @@
/* set_displayed_location:
*/
static void
-set_displayed_location (NautilusWindow *window, GFile *location)
+set_displayed_location (NautilusWindowSlot *slot, GFile *location)
{
+ NautilusWindow *window;
GFile *bookmark_location;
gboolean recreate;
char *name;
+
+ window = slot->window;
- if (window->current_location_bookmark == NULL || location == NULL) {
+ if (slot->current_location_bookmark == NULL || location == NULL) {
recreate = TRUE;
} else {
- bookmark_location = nautilus_bookmark_get_location (window->current_location_bookmark);
+ bookmark_location = nautilus_bookmark_get_location (slot->current_location_bookmark);
recreate = !g_file_equal (bookmark_location, location);
g_object_unref (bookmark_location);
}
if (recreate) {
/* We've changed locations, must recreate bookmark for current location. */
- if (window->last_location_bookmark != NULL) {
- g_object_unref (window->last_location_bookmark);
+ if (slot->last_location_bookmark != NULL) {
+ g_object_unref (slot->last_location_bookmark);
}
- window->last_location_bookmark = window->current_location_bookmark;
+ slot->last_location_bookmark = slot->current_location_bookmark;
name = g_file_get_uri (location);
- window->current_location_bookmark = (location == NULL) ? NULL
+ slot->current_location_bookmark = (location == NULL) ? NULL
: nautilus_bookmark_new (location, name);
g_free (name);
}
- nautilus_window_update_title (window);
- nautilus_window_update_icon (window);
+
+ nautilus_window_slot_update_title (slot);
+ nautilus_window_slot_update_icon (slot);
}
static void
@@ -172,47 +177,54 @@
* Back or Forward list.
*/
static void
-check_last_bookmark_location_matches_window (NautilusWindow *window)
+check_last_bookmark_location_matches_slot (NautilusWindowSlot *slot)
{
- check_bookmark_location_matches (window->last_location_bookmark,
- window->details->location);
+ check_bookmark_location_matches (slot->last_location_bookmark,
+ slot->location);
}
static void
handle_go_back (NautilusNavigationWindow *window, GFile *location)
{
+ NautilusWindowSlot *slot;
+ NautilusNavigationWindowSlot *navigation_slot;
guint i;
GList *link;
NautilusBookmark *bookmark;
- g_return_if_fail (NAUTILUS_IS_NAVIGATION_WINDOW (window));
+ g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
+
+ slot = NAUTILUS_WINDOW (window)->details->active_slot;
+ navigation_slot = (NautilusNavigationWindowSlot *) slot;
/* Going back. Move items from the back list to the forward list. */
- g_assert (g_list_length (window->back_list) > NAUTILUS_WINDOW (window)->details->location_change_distance);
- check_bookmark_location_matches (NAUTILUS_BOOKMARK (g_list_nth_data (window->back_list,
- NAUTILUS_WINDOW (window)->details->location_change_distance)),
+ g_assert (g_list_length (navigation_slot->back_list) > slot->location_change_distance);
+ check_bookmark_location_matches (NAUTILUS_BOOKMARK (g_list_nth_data (navigation_slot->back_list,
+ slot->location_change_distance)),
location);
- g_assert (NAUTILUS_WINDOW (window)->details->location != NULL);
+ g_assert (slot->location != NULL);
/* Move current location to Forward list */
- check_last_bookmark_location_matches_window (NAUTILUS_WINDOW (window));
+ check_last_bookmark_location_matches_slot (slot);
/* Use the first bookmark in the history list rather than creating a new one. */
- window->forward_list = g_list_prepend (window->forward_list,
- NAUTILUS_WINDOW (window)->last_location_bookmark);
- g_object_ref (window->forward_list->data);
+ navigation_slot->forward_list = g_list_prepend (navigation_slot->forward_list,
+ slot->last_location_bookmark);
+ g_object_ref (navigation_slot->forward_list->data);
/* Move extra links from Back to Forward list */
- for (i = 0; i < NAUTILUS_WINDOW (window)->details->location_change_distance; ++i) {
- bookmark = NAUTILUS_BOOKMARK (window->back_list->data);
- window->back_list = g_list_remove (window->back_list, bookmark);
- window->forward_list = g_list_prepend (window->forward_list, bookmark);
+ for (i = 0; i < slot->location_change_distance; ++i) {
+ bookmark = NAUTILUS_BOOKMARK (navigation_slot->back_list->data);
+ navigation_slot->back_list =
+ g_list_remove (navigation_slot->back_list, bookmark);
+ navigation_slot->forward_list =
+ g_list_prepend (navigation_slot->forward_list, bookmark);
}
/* One bookmark falls out of back/forward lists and becomes viewed location */
- link = window->back_list;
- window->back_list = g_list_remove_link (window->back_list, link);
+ link = navigation_slot->back_list;
+ navigation_slot->back_list = g_list_remove_link (navigation_slot->back_list, link);
g_object_unref (link->data);
g_list_free_1 (link);
}
@@ -220,38 +232,44 @@
static void
handle_go_forward (NautilusNavigationWindow *window, GFile *location)
{
+ NautilusWindowSlot *slot;
+ NautilusNavigationWindowSlot *navigation_slot;
guint i;
GList *link;
NautilusBookmark *bookmark;
- g_return_if_fail (NAUTILUS_IS_NAVIGATION_WINDOW (window));
+ g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
+
+ slot = NAUTILUS_WINDOW (window)->details->active_slot;
+ navigation_slot = (NautilusNavigationWindowSlot *) slot;
/* Going forward. Move items from the forward list to the back list. */
- g_assert (g_list_length (window->forward_list) > NAUTILUS_WINDOW (window)->details->location_change_distance);
- check_bookmark_location_matches (NAUTILUS_BOOKMARK (g_list_nth_data (window->forward_list,
- NAUTILUS_WINDOW (window)->details->location_change_distance)),
+ g_assert (g_list_length (navigation_slot->forward_list) > slot->location_change_distance);
+ check_bookmark_location_matches (NAUTILUS_BOOKMARK (g_list_nth_data (navigation_slot->forward_list,
+ slot->location_change_distance)),
location);
- g_assert (NAUTILUS_WINDOW (window)->details->location != NULL);
+ g_assert (slot->location != NULL);
/* Move current location to Back list */
-
- check_last_bookmark_location_matches_window (NAUTILUS_WINDOW (window));
+ check_last_bookmark_location_matches_slot (slot);
/* Use the first bookmark in the history list rather than creating a new one. */
- window->back_list = g_list_prepend (window->back_list,
- NAUTILUS_WINDOW (window)->last_location_bookmark);
- g_object_ref (window->back_list->data);
+ navigation_slot->back_list = g_list_prepend (navigation_slot->back_list,
+ slot->last_location_bookmark);
+ g_object_ref (navigation_slot->back_list->data);
/* Move extra links from Forward to Back list */
- for (i = 0; i < NAUTILUS_WINDOW (window)->details->location_change_distance; ++i) {
- bookmark = NAUTILUS_BOOKMARK (window->forward_list->data);
- window->forward_list = g_list_remove (window->forward_list, bookmark);
- window->back_list = g_list_prepend (window->back_list, bookmark);
+ for (i = 0; i < slot->location_change_distance; ++i) {
+ bookmark = NAUTILUS_BOOKMARK (navigation_slot->forward_list->data);
+ navigation_slot->forward_list =
+ g_list_remove (navigation_slot->back_list, bookmark);
+ navigation_slot->back_list =
+ g_list_prepend (navigation_slot->forward_list, bookmark);
}
/* One bookmark falls out of back/forward lists and becomes viewed location */
- link = window->forward_list;
- window->forward_list = g_list_remove_link (window->forward_list, link);
+ link = navigation_slot->forward_list;
+ navigation_slot->forward_list = g_list_remove_link (navigation_slot->forward_list, link);
g_object_unref (link->data);
g_list_free_1 (link);
}
@@ -260,22 +278,28 @@
handle_go_elsewhere (NautilusWindow *window, GFile *location)
{
#if !NEW_UI_COMPLETE
+ NautilusWindowSlot *slot;
+ NautilusNavigationWindowSlot *navigation_slot;
+
if (NAUTILUS_IS_NAVIGATION_WINDOW (window)) {
+ slot = window->details->active_slot;
+ navigation_slot = (NautilusNavigationWindowSlot *) slot;
+
/* Clobber the entire forward list, and move displayed location to back list */
nautilus_navigation_window_clear_forward_list (NAUTILUS_NAVIGATION_WINDOW (window));
- if (window->details->location != NULL) {
+ if (slot->location != NULL) {
/* If we're returning to the same uri somehow, don't put this uri on back list.
* This also avoids a problem where set_displayed_location
* didn't update last_location_bookmark since the uri didn't change.
*/
- if (!g_file_equal (window->details->location, location)) {
+ if (!g_file_equal (slot->location, location)) {
/* Store bookmark for current location in back list, unless there is no current location */
- check_last_bookmark_location_matches_window (window);
+ check_last_bookmark_location_matches_slot (slot);
/* Use the first bookmark in the history list rather than creating a new one. */
- NAUTILUS_NAVIGATION_WINDOW (window)->back_list = g_list_prepend (NAUTILUS_NAVIGATION_WINDOW (window)->back_list,
- window->last_location_bookmark);
- g_object_ref (NAUTILUS_NAVIGATION_WINDOW (window)->back_list->data);
+ navigation_slot->back_list = g_list_prepend (navigation_slot->back_list,
+ slot->last_location_bookmark);
+ g_object_ref (navigation_slot->back_list->data);
}
}
}
@@ -285,12 +309,15 @@
static void
update_up_button (NautilusWindow *window)
{
+ NautilusWindowSlot *slot;
gboolean allowed;
GFile *parent;
+ slot = window->details->active_slot;
+
allowed = FALSE;
- if (window->details->location != NULL) {
- parent = g_file_get_parent (window->details->location);
+ if (slot->location != NULL) {
+ parent = g_file_get_parent (slot->location);
allowed = parent != NULL;
if (parent != NULL) {
g_object_unref (parent);
@@ -302,30 +329,34 @@
static void
viewed_file_changed_callback (NautilusFile *file,
- NautilusWindow *window)
+ NautilusWindowSlot *slot)
{
+ NautilusWindow *window;
GFile *new_location;
gboolean is_in_trash, was_in_trash;
- char *uri;
+
+ window = slot->window;
g_assert (NAUTILUS_IS_FILE (file));
g_assert (NAUTILUS_IS_WINDOW (window));
- g_assert (window->details->viewed_file == file);
+
+ slot = window->details->active_slot;
+ g_assert (file == slot->viewed_file);
if (!nautilus_file_is_not_yet_confirmed (file)) {
- window->details->viewed_file_seen = TRUE;
+ slot->viewed_file_seen = TRUE;
}
- was_in_trash = window->details->viewed_file_in_trash;
+ was_in_trash = slot->viewed_file_in_trash;
- window->details->viewed_file_in_trash = is_in_trash = nautilus_file_is_in_trash (file);
+ slot->viewed_file_in_trash = is_in_trash = nautilus_file_is_in_trash (file);
/* Close window if the file it's viewing has been deleted or moved to trash. */
if (nautilus_file_is_gone (file) || (is_in_trash && !was_in_trash)) {
/* Don't close the window in the case where the
* file was never seen in the first place.
*/
- if (window->details->viewed_file_seen) {
+ if (slot->viewed_file_seen) {
/* Detecting a file is gone may happen in the
* middle of a pending location change, we
* need to cancel it before closing the window
@@ -339,7 +370,7 @@
* really needed, wouldn't it be needed for
* all other nautilus_window_close callers?
*/
- end_location_change (window);
+ end_location_change (slot);
if (NAUTILUS_IS_NAVIGATION_WINDOW (window)) {
/* auto-show existing parent. */
@@ -354,11 +385,18 @@
g_object_unref (parent);
}
+ /* multiview-TODO make _go_to_*() slot-specific */
if (go_to_file != NULL) {
/* the path bar URI will be set to go_to_uri immediately
* in begin_location_change, but we don't want the
* inexistant children to show up anymore */
- nautilus_path_bar_clear_buttons (NAUTILUS_PATH_BAR (NAUTILUS_NAVIGATION_WINDOW (window)->path_bar));
+ if (slot == window->details->active_slot) {
+ /* multiview-TODO also update NautilusWindowSlot
+ * [which as of writing doesn't save/store any path bar state]
+ */
+ nautilus_path_bar_clear_buttons (NAUTILUS_PATH_BAR (NAUTILUS_NAVIGATION_WINDOW (window)->path_bar));
+ }
+
nautilus_window_go_to (NAUTILUS_WINDOW (window), go_to_file);
g_object_unref (go_to_file);
} else {
@@ -374,37 +412,20 @@
/* If the file was renamed, update location and/or
* title. */
if (!g_file_equal (new_location,
- window->details->location)) {
- g_object_unref (window->details->location);
- window->details->location = new_location;
-
- /* Check if we can go up. */
- update_up_button (window);
-#if !NEW_UI_COMPLETE
- uri = g_file_get_uri (window->details->location);
- if (NAUTILUS_IS_NAVIGATION_WINDOW (window)) {
- /* Change the location bar and path bar to match the current location. */
- nautilus_navigation_bar_set_location
- (NAUTILUS_NAVIGATION_BAR (NAUTILUS_NAVIGATION_WINDOW (window)->navigation_bar),
- uri);
- nautilus_path_bar_set_path (NAUTILUS_PATH_BAR (NAUTILUS_NAVIGATION_WINDOW (window)->path_bar),
- window->details->location);
- }
- if (NAUTILUS_IS_SPATIAL_WINDOW (window)) {
- /* Change the location button to match the current location. */
- nautilus_spatial_window_set_location_button
- (NAUTILUS_SPATIAL_WINDOW (window),
- window->details->location);
- }
- g_free (uri);
-#endif
-
+ slot->location)) {
+ g_object_unref (slot->location);
+ slot->location = new_location;
+ if (slot == window->details->active_slot) {
+ nautilus_window_sync_location_widgets (window);
+ }
} else {
+ /* TODO?
+ * why do we update title & icon at all in this case? */
g_object_unref (new_location);
}
- nautilus_window_update_title (window);
- nautilus_window_update_icon (window);
+ nautilus_window_slot_update_title (slot);
+ nautilus_window_slot_update_icon (slot);
}
}
@@ -440,16 +461,16 @@
}
static void
-cancel_viewed_file_changed_callback (NautilusWindow *window)
+cancel_viewed_file_changed_callback (NautilusWindowSlot *slot)
{
NautilusFile *file;
- file = window->details->viewed_file;
+ file = slot->viewed_file;
if (file != NULL) {
g_signal_handlers_disconnect_by_func (G_OBJECT (file),
G_CALLBACK (viewed_file_changed_callback),
- window);
- nautilus_file_monitor_remove (file, &window->details->viewed_file);
+ slot);
+ nautilus_file_monitor_remove (file, &slot->viewed_file);
}
}
@@ -470,20 +491,23 @@
void
-nautilus_window_open_location_full (NautilusWindow *window,
- GFile *location,
- NautilusWindowOpenMode mode,
- NautilusWindowOpenFlags flags,
- GList *new_selection)
+nautilus_window_slot_open_location_full (NautilusWindowSlot *slot,
+ GFile *location,
+ NautilusWindowOpenMode mode,
+ NautilusWindowOpenFlags flags,
+ GList *new_selection)
{
+ NautilusWindow *window;
NautilusWindow *target_window;
gboolean do_load_location = TRUE;
GFile *old_location;
char *old_uri, *new_uri;
+
+ window = slot->window;
target_window = NULL;
- old_uri = nautilus_window_get_location_uri (window);
+ old_uri = nautilus_window_slot_get_location_uri (slot);
if (old_uri == NULL) {
old_uri = g_strdup ("(none)");
}
@@ -497,7 +521,7 @@
g_free (new_uri);
- old_location = nautilus_window_get_location (window);
+ old_location = nautilus_window_slot_get_location (slot);
switch (mode) {
case NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE :
if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_BROWSER)) {
@@ -587,14 +611,14 @@
g_object_unref (old_location);
}
- begin_location_change (target_window, location, new_selection,
+ begin_location_change (target_window->details->active_slot, location, new_selection,
NAUTILUS_LOCATION_CHANGE_STANDARD, 0, NULL);
}
void
-nautilus_window_open_location (NautilusWindow *window,
- GFile *location,
- gboolean close_behind)
+nautilus_window_slot_open_location (NautilusWindowSlot *slot,
+ GFile *location,
+ gboolean close_behind)
{
NautilusWindowOpenFlags flags;
@@ -603,16 +627,16 @@
flags = NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND;
}
- nautilus_window_open_location_full (window, location,
- NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
- flags, NULL);
+ nautilus_window_slot_open_location_full (slot, location,
+ NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
+ flags, NULL);
}
void
-nautilus_window_open_location_with_selection (NautilusWindow *window,
- GFile *location,
- GList *selection,
- gboolean close_behind)
+nautilus_window_slot_open_location_with_selection (NautilusWindowSlot *slot,
+ GFile *location,
+ GList *selection,
+ gboolean close_behind)
{
NautilusWindowOpenFlags flags;
@@ -620,48 +644,52 @@
if (close_behind) {
flags = NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND;
}
- nautilus_window_open_location_full (window, location,
- NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
- flags, selection);
+ nautilus_window_slot_open_location_full (slot, location,
+ NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
+ flags, selection);
}
-char *
-nautilus_window_get_view_label (NautilusWindow *window)
+#if 0
+static char *
+nautilus_window_slot_get_view_label (NautilusWindowSlot *slot)
{
const NautilusViewInfo *info;
- info = nautilus_view_factory_lookup (nautilus_window_get_content_view_id (window));
+ info = nautilus_view_factory_lookup (nautilus_window_slot_get_content_view_id (slot));
return g_strdup (info->label);
}
+#endif
-char *
-nautilus_window_get_view_error_label (NautilusWindow *window)
+static char *
+nautilus_window_slot_get_view_error_label (NautilusWindowSlot *slot)
{
const NautilusViewInfo *info;
- info = nautilus_view_factory_lookup (nautilus_window_get_content_view_id (window));
+ info = nautilus_view_factory_lookup (nautilus_window_slot_get_content_view_id (slot));
return g_strdup (info->error_label);
}
-char *
-nautilus_window_get_view_startup_error_label (NautilusWindow *window)
+static char *
+nautilus_window_slot_get_view_startup_error_label (NautilusWindowSlot *slot)
{
const NautilusViewInfo *info;
- info = nautilus_view_factory_lookup (nautilus_window_get_content_view_id (window));
+ info = nautilus_view_factory_lookup (nautilus_window_slot_get_content_view_id (slot));
return g_strdup (info->startup_error_label);
}
static void
-report_current_content_view_failure_to_user (NautilusWindow *window,
- NautilusView *view)
+report_current_content_view_failure_to_user (NautilusWindowSlot *slot)
{
+ NautilusWindow *window;
char *message;
- message = nautilus_window_get_view_startup_error_label (window);
+ window = slot->window;
+
+ message = nautilus_window_slot_get_view_startup_error_label (slot);
eel_show_error_dialog (message,
_("You can choose another view or go to a different location."),
GTK_WINDOW (window));
@@ -669,12 +697,18 @@
}
static void
-report_nascent_content_view_failure_to_user (NautilusWindow *window,
- NautilusView *view)
+report_nascent_content_view_failure_to_user (NautilusWindowSlot *slot,
+ NautilusView *view)
{
+ NautilusWindow *window;
char *message;
- message = nautilus_window_get_view_error_label (window);
+ window = slot->window;
+
+ /* TODO? why are we using the current view's error label here, instead of the next view's?
+ * This behavior has already been present in pre-slot days.
+ */
+ message = nautilus_window_slot_get_view_error_label (slot);
eel_show_error_dialog (message,
_("The location cannot be displayed with this viewer."),
GTK_WINDOW (window));
@@ -683,22 +717,22 @@
const char *
-nautilus_window_get_content_view_id (NautilusWindow *window)
+nautilus_window_slot_get_content_view_id (NautilusWindowSlot *slot)
{
- if (window->content_view == NULL) {
+ if (slot->content_view == NULL) {
return NULL;
}
- return nautilus_view_get_view_id (window->content_view);
+ return nautilus_view_get_view_id (slot->content_view);
}
gboolean
-nautilus_window_content_view_matches_iid (NautilusWindow *window,
- const char *iid)
+nautilus_window_slot_content_view_matches_iid (NautilusWindowSlot *slot,
+ const char *iid)
{
- if (window->content_view == NULL) {
+ if (slot->content_view == NULL) {
return FALSE;
}
- return eel_strcmp (nautilus_view_get_view_id (window->content_view),
+ return eel_strcmp (nautilus_view_get_view_id (slot->content_view),
iid) == 0;
}
@@ -719,42 +753,44 @@
* location begins here.
*/
static void
-begin_location_change (NautilusWindow *window,
+begin_location_change (NautilusWindowSlot *slot,
GFile *location,
GList *new_selection,
NautilusLocationChangeType type,
guint distance,
const char *scroll_pos)
{
+ NautilusWindow *window;
NautilusDirectory *directory;
NautilusFile *file;
gboolean force_reload;
char *current_pos;
- g_assert (NAUTILUS_IS_WINDOW (window));
+ g_assert (slot != NULL);
g_assert (location != NULL);
g_assert (type == NAUTILUS_LOCATION_CHANGE_BACK
|| type == NAUTILUS_LOCATION_CHANGE_FORWARD
|| distance == 0);
+ window = slot->window;
+ g_assert (NAUTILUS_IS_WINDOW (window));
g_object_ref (window);
- end_location_change (window);
-
- nautilus_window_allow_stop (window, TRUE);
- nautilus_window_set_status (window, " ");
+ end_location_change (slot);
- g_assert (window->details->pending_location == NULL);
- g_assert (window->details->pending_selection == NULL);
+ nautilus_window_slot_set_allow_stop (slot, TRUE);
+ nautilus_window_slot_set_status (slot, " ");
+
+ g_assert (slot->pending_location == NULL);
+ g_assert (slot->pending_selection == NULL);
- window->details->pending_location = g_object_ref (location);
- window->details->location_change_type = type;
- window->details->location_change_distance = distance;
- window->details->tried_mount = FALSE;
- window->details->pending_selection = eel_g_object_list_copy (new_selection);
+ slot->pending_location = g_object_ref (location);
+ slot->location_change_type = type;
+ slot->location_change_distance = distance;
+ slot->tried_mount = FALSE;
+ slot->pending_selection = eel_g_object_list_copy (new_selection);
-
- window->details->pending_scroll_to = g_strdup (scroll_pos);
+ slot->pending_scroll_to = g_strdup (scroll_pos);
directory = nautilus_directory_get (location);
@@ -780,41 +816,43 @@
nautilus_directory_unref (directory);
/* Set current_bookmark scroll pos */
- if (window->current_location_bookmark != NULL &&
- window->content_view != NULL) {
- current_pos = nautilus_view_get_first_visible_file (window->content_view);
- nautilus_bookmark_set_scroll_pos (window->current_location_bookmark, current_pos);
+ if (slot->current_location_bookmark != NULL &&
+ slot->content_view != NULL) {
+ current_pos = nautilus_view_get_first_visible_file (slot->content_view);
+ nautilus_bookmark_set_scroll_pos (slot->current_location_bookmark, current_pos);
g_free (current_pos);
}
/* Get the info needed for view selection */
- window->details->determine_view_file = nautilus_file_get (location);
-
- g_assert (window->details->determine_view_file != NULL);
+ slot->determine_view_file = nautilus_file_get (location);
+ g_assert (slot->determine_view_file != NULL);
/* if the currently viewed file is marked gone while loading the new location,
* this ensures that the window isn't destroyed */
- cancel_viewed_file_changed_callback (window);
+ cancel_viewed_file_changed_callback (slot);
- nautilus_file_call_when_ready (window->details->determine_view_file,
+ nautilus_file_call_when_ready (slot->determine_view_file,
NAUTILUS_FILE_ATTRIBUTE_INFO |
NAUTILUS_FILE_ATTRIBUTE_MOUNT |
NAUTILUS_FILE_ATTRIBUTE_METADATA,
got_file_info_for_view_selection_callback,
- window);
+ slot);
g_object_unref (window);
}
static void
-setup_new_window (NautilusWindow *window, NautilusFile *file)
+setup_new_spatial_window (NautilusWindowSlot *slot, NautilusFile *file)
{
+ NautilusWindow *window;
char *show_hidden_file_setting;
char *geometry_string;
char *scroll_string;
gboolean maximized, sticky, above;
-
+
+ window = slot->window;
+
if (NAUTILUS_IS_SPATIAL_WINDOW (window) && !NAUTILUS_IS_DESKTOP_WINDOW (window)) {
/* load show hidden state */
show_hidden_file_setting = nautilus_file_get_metadata
@@ -868,7 +906,7 @@
}
g_free (geometry_string);
- if (window->details->pending_selection == NULL) {
+ if (slot->pending_selection == NULL) {
/* If there is no pending selection, then load the saved scroll position. */
scroll_string = nautilus_file_get_metadata
(file, NAUTILUS_METADATA_KEY_WINDOW_SCROLL_POSITION,
@@ -876,19 +914,19 @@
} else {
/* If there is a pending selection, we want to scroll to an item in
* the pending selection list. */
- scroll_string = g_file_get_uri (window->details->pending_selection->data);
+ scroll_string = g_file_get_uri (slot->pending_selection->data);
}
/* scroll_string might be NULL if there was no saved scroll position. */
if (scroll_string != NULL) {
- window->details->pending_scroll_to = scroll_string;
+ slot->pending_scroll_to = scroll_string;
}
}
}
typedef struct {
GCancellable *cancellable;
- NautilusWindow *window;
+ NautilusWindowSlot *slot;
} MountNotMountedData;
static void
@@ -898,11 +936,13 @@
{
MountNotMountedData *data;
NautilusWindow *window;
+ NautilusWindowSlot *slot;
GError *error;
GCancellable *cancellable;
data = user_data;
- window = data->window;
+ slot = data->slot;
+ window = slot->window;
cancellable = data->cancellable;
g_free (data);
@@ -912,23 +952,23 @@
return;
}
- window->details->mount_cancellable = NULL;
+ slot->mount_cancellable = NULL;
- window->details->determine_view_file = nautilus_file_get (window->details->pending_location);
+ slot->determine_view_file = nautilus_file_get (slot->pending_location);
error = NULL;
if (!g_file_mount_enclosing_volume_finish (G_FILE (source_object), res, &error)) {
- window->details->mount_error = error;
- got_file_info_for_view_selection_callback (window->details->determine_view_file, window);
- window->details->mount_error = NULL;
+ slot->mount_error = error;
+ got_file_info_for_view_selection_callback (slot->determine_view_file, window);
+ slot->mount_error = NULL;
g_error_free (error);
} else {
- nautilus_file_invalidate_all_attributes (window->details->determine_view_file);
- nautilus_file_call_when_ready (window->details->determine_view_file,
+ nautilus_file_invalidate_all_attributes (slot->determine_view_file);
+ nautilus_file_call_when_ready (slot->determine_view_file,
NAUTILUS_FILE_ATTRIBUTE_INFO |
NAUTILUS_FILE_ATTRIBUTE_METADATA,
got_file_info_for_view_selection_callback,
- window);
+ slot);
}
g_object_unref (cancellable);
@@ -942,34 +982,39 @@
char *view_id;
char *mimetype;
NautilusWindow *window;
+ NautilusWindowSlot *slot;
NautilusFile *viewed_file;
GFile *location;
GMountOperation *mount_op;
MountNotMountedData *data;
-
- window = callback_data;
-
- g_assert (window->details->determine_view_file == file);
- window->details->determine_view_file = NULL;
- if (window->details->mount_error) {
- error = window->details->mount_error;
+ slot = callback_data;
+ g_assert (NAUTILUS_IS_WINDOW_SLOT (slot));
+ g_assert (slot->determine_view_file == file);
+
+ window = slot->window;
+ g_assert (NAUTILUS_IS_WINDOW (window));
+
+ slot->determine_view_file = NULL;
+
+ if (slot->mount_error) {
+ error = slot->mount_error;
} else {
error = nautilus_file_get_file_info_error (file);
}
if (error && error->domain == G_IO_ERROR && error->code == G_IO_ERROR_NOT_MOUNTED &&
- !window->details->tried_mount) {
- window->details->tried_mount = TRUE;
-
+ !slot->tried_mount) {
+ slot->tried_mount = TRUE;
+
mount_op = eel_mount_operation_new (GTK_WINDOW (window));
location = nautilus_file_get_location (file);
data = g_new0 (MountNotMountedData, 1);
data->cancellable = g_cancellable_new ();
- data->window = window;
- window->details->mount_cancellable = data->cancellable;
+ data->slot = slot;
+ slot->mount_cancellable = data->cancellable;
nautilus_inhibit_autorun_for_file (location);
- g_file_mount_enclosing_volume (location, 0, mount_op, window->details->mount_cancellable,
+ g_file_mount_enclosing_volume (location, 0, mount_op, slot->mount_cancellable,
mount_not_mounted_callback, data);
g_object_unref (location);
g_object_unref (mount_op);
@@ -979,7 +1024,7 @@
return;
}
- location = window->details->pending_location;
+ location = slot->pending_location;
view_id = NULL;
@@ -990,7 +1035,7 @@
mimetype = nautilus_file_get_mime_type (file);
/* If fallback, don't use view from metadata */
- if (window->details->location_change_type != NAUTILUS_LOCATION_CHANGE_FALLBACK) {
+ if (slot->location_change_type != NAUTILUS_LOCATION_CHANGE_FALLBACK) {
/* Look in metadata for view */
view_id = nautilus_file_get_metadata
(file, NAUTILUS_METADATA_KEY_DEFAULT_COMPONENT, NULL);
@@ -1022,11 +1067,11 @@
}
if (view_id != NULL) {
- if (!GTK_WIDGET_VISIBLE (window)) {
+ if (!GTK_WIDGET_VISIBLE (window) && NAUTILUS_IS_SPATIAL_WINDOW (window)) {
/* We now have the metadata to set up the window position, etc */
- setup_new_window (window, file);
+ setup_new_spatial_window (slot, file);
}
- create_content_view (window, view_id);
+ create_content_view (slot, view_id);
g_free (view_id);
} else {
display_view_selection_failure (window, file,
@@ -1068,14 +1113,14 @@
}
} else {
/* Clean up state of already-showing window */
- end_location_change (window);
+ end_location_change (slot);
/* We disconnected this, so we need to re-connect it */
- viewed_file = nautilus_file_get (window->details->location);
- nautilus_window_set_viewed_file (window, viewed_file);
- nautilus_file_monitor_add (viewed_file, &window->details->viewed_file, 0);
+ viewed_file = nautilus_file_get (slot->location);
+ nautilus_window_slot_set_viewed_file (slot, viewed_file);
+ nautilus_file_monitor_add (viewed_file, &slot->viewed_file, 0);
g_signal_connect_object (viewed_file, "changed",
- G_CALLBACK (viewed_file_changed_callback), window, 0);
+ G_CALLBACK (viewed_file_changed_callback), slot, 0);
nautilus_file_unref (viewed_file);
/* Leave the location bar showing the bad location that the user
@@ -1097,13 +1142,16 @@
* view, and the current location will be used.
*/
static void
-create_content_view (NautilusWindow *window,
+create_content_view (NautilusWindowSlot *slot,
const char *view_id)
{
+ NautilusWindow *window;
NautilusView *view;
GList *selection;
GtkAction *action;
+ window = slot->window;
+
/* FIXME bugzilla.gnome.org 41243:
* We should use inheritance instead of these special cases
* for the desktop window.
@@ -1126,41 +1174,41 @@
NAUTILUS_ACTION_ZOOM_NORMAL);
gtk_action_set_sensitive (action, FALSE);
- if (window->content_view != NULL &&
- eel_strcmp (nautilus_view_get_view_id (window->content_view),
+ if (slot->content_view != NULL &&
+ eel_strcmp (nautilus_view_get_view_id (slot->content_view),
view_id) == 0) {
/* reuse existing content view */
- view = window->content_view;
- window->new_content_view = view;
+ view = slot->content_view;
+ slot->new_content_view = view;
g_object_ref (view);
} else {
/* create a new content view */
view = nautilus_view_factory_create (view_id,
- NAUTILUS_WINDOW_INFO (window));
+ NAUTILUS_WINDOW_SLOT_INFO (slot));
eel_accessibility_set_name (view, _("Content View"));
eel_accessibility_set_description (view, _("View of the current folder"));
- connect_view (window, view);
+ slot_connect_view (slot, view);
- window->new_content_view = view;
+ slot->new_content_view = view;
}
/* Actually load the pending location and selection: */
- if (window->details->pending_location != NULL) {
- load_new_location (window,
- window->details->pending_location,
- window->details->pending_selection,
+ if (slot->pending_location != NULL) {
+ load_new_location (slot,
+ slot->pending_location,
+ slot->pending_selection,
FALSE,
TRUE);
- eel_g_object_list_free (window->details->pending_selection);
- window->details->pending_selection = NULL;
- } else if (window->details->location != NULL) {
- selection = nautilus_view_get_selection (window->content_view);
- load_new_location (window,
- window->details->location,
+ eel_g_object_list_free (slot->pending_selection);
+ slot->pending_selection = NULL;
+ } else if (slot->location != NULL) {
+ selection = nautilus_view_get_selection (slot->content_view);
+ load_new_location (slot,
+ slot->location,
selection,
FALSE,
TRUE);
@@ -1174,41 +1222,45 @@
}
static void
-load_new_location (NautilusWindow *window,
+load_new_location (NautilusWindowSlot *slot,
GFile *location,
GList *selection,
gboolean tell_current_content_view,
gboolean tell_new_content_view)
{
+ NautilusWindow *window;
GList *selection_copy;
NautilusView *view;
char *uri;
-
- g_assert (NAUTILUS_IS_WINDOW (window));
+
+ g_assert (slot != NULL);
g_assert (location != NULL);
+ window = slot->window;
+ g_assert (NAUTILUS_IS_WINDOW (window));
+
selection_copy = eel_g_object_list_copy (selection);
view = NULL;
/* Note, these may recurse into report_load_underway */
- if (window->content_view != NULL && tell_current_content_view) {
- view = window->content_view;
+ if (slot->content_view != NULL && tell_current_content_view) {
+ view = slot->content_view;
uri = g_file_get_uri (location);
- nautilus_view_load_location (window->content_view, uri);
+ nautilus_view_load_location (slot->content_view, uri);
g_free (uri);
}
- if (window->new_content_view != NULL && tell_new_content_view &&
+ if (slot->new_content_view != NULL && tell_new_content_view &&
(!tell_current_content_view ||
- window->new_content_view != window->content_view) ) {
- view = window->new_content_view;
+ slot->new_content_view != slot->content_view) ) {
+ view = slot->new_content_view;
uri = g_file_get_uri (location);
- nautilus_view_load_location (window->new_content_view, uri);
+ nautilus_view_load_location (slot->new_content_view, uri);
g_free (uri);
}
if (view != NULL) {
- /* window->new_content_view might have changed here if
+ /* slot->new_content_view might have changed here if
report_load_underway was called from load_location */
nautilus_view_set_selection (view, selection_copy);
}
@@ -1224,56 +1276,97 @@
nautilus_window_report_load_underway (NautilusWindow *window,
NautilusView *view)
{
- g_assert (NAUTILUS_IS_WINDOW (window));
+ NautilusWindowSlot *slot;
- if (view == window->new_content_view) {
- location_has_really_changed (window);
- } else if (view == window->content_view) {
- nautilus_window_allow_stop (window, TRUE);
- } else {
- g_warning ("Got load_underway report from unknown view");
+ g_assert (NAUTILUS_IS_WINDOW (window));
+
+ slot = nautilus_window_get_slot_for_view (window, view);
+ g_assert (slot != NULL);
+
+ if (view == slot->new_content_view) {
+ location_has_really_changed (slot);
+ } else { /* view == slot->content_view */
+ nautilus_window_slot_set_allow_stop (slot, TRUE);
+ }
+}
+
+/* reports location change to window's "loading-uri" clients, i.e.
+ * sidebar panels
+ *
+ * Usually, we emit the pending location.
+ *
+ * If current_location is true, this emission happens due to
+ * switching the active slot. In this case, we want to re-emit
+ * with the current location of the new slot if no URI is pending.
+ *
+ * If current_location is false, this emission happens due to
+ * switching the view INSIDE the active slot. In this case, we
+ * do not want to emit if no URI is pending.
+ */
+void
+nautilus_window_report_location_change (NautilusWindow *window,
+ gboolean current_location)
+{
+ NautilusWindowSlot *slot;
+ GFile *location_copy;
+ char *uri;
+
+ slot = window->details->active_slot;
+
+ location_copy = NULL;
+
+ if (slot->pending_location != NULL) {
+ location_copy = g_object_ref (slot->pending_location);
+ }
+
+ if (current_location &&
+ location_copy == NULL &&
+ slot->location != NULL) {
+ location_copy = g_object_ref (slot->location);
+ }
+
+ if (location_copy != NULL) {
+ uri = g_file_get_uri (location_copy);
+ g_signal_emit_by_name (window, "loading_uri", uri);
+ g_free (uri);
+ g_object_unref (location_copy);
}
}
/* This is called when we have decided we can actually change to the new view/location situation. */
static void
-location_has_really_changed (NautilusWindow *window)
+location_has_really_changed (NautilusWindowSlot *slot)
{
+ NautilusWindow *window;
GtkWidget *widget;
- GFile *location_copy;
- char *uri;
- location_copy = NULL;
+ window = slot->window;
- if (window->new_content_view != NULL) {
- widget = nautilus_view_get_widget (window->new_content_view);
+ if (slot->new_content_view != NULL) {
+ widget = nautilus_view_get_widget (slot->new_content_view);
/* Switch to the new content view. */
if (widget->parent == NULL) {
- disconnect_view (window, window->content_view);
- nautilus_window_set_content_view_widget (window, window->new_content_view);
+ slot_disconnect_view (slot, slot->content_view);
+ nautilus_window_slot_set_content_view_widget (slot, slot->new_content_view);
}
- g_object_unref (window->new_content_view);
- window->new_content_view = NULL;
+ g_object_unref (slot->new_content_view);
+ slot->new_content_view = NULL;
}
- if (window->details->pending_location != NULL) {
- location_copy = g_object_ref (window->details->pending_location);
+ if (slot->pending_location != NULL) {
/* Tell the window we are finished. */
- update_for_new_location (window);
+ update_for_new_location (slot);
}
- free_location_change (window);
+ free_location_change (slot);
- if (location_copy != NULL) {
- uri = g_file_get_uri (location_copy);
- g_signal_emit_by_name (window, "loading_uri", uri);
- g_free (uri);
- g_object_unref (location_copy);
+ if (slot == window->details->active_slot) {
+ nautilus_window_report_location_change (window, FALSE);
}
}
static void
-add_extension_extra_widgets (NautilusWindow *window, GFile *location)
+slot_add_extension_extra_widgets (NautilusWindowSlot *slot)
{
GList *providers, *l;
GtkWidget *widget;
@@ -1281,14 +1374,14 @@
providers = nautilus_module_get_extensions_for_type (NAUTILUS_TYPE_LOCATION_WIDGET_PROVIDER);
- uri = g_file_get_uri (location);
+ uri = g_file_get_uri (slot->location);
for (l = providers; l != NULL; l = l->next) {
NautilusLocationWidgetProvider *provider;
provider = NAUTILUS_LOCATION_WIDGET_PROVIDER (l->data);
- widget = nautilus_location_widget_provider_get_widget (provider, uri, GTK_WIDGET (window));
+ widget = nautilus_location_widget_provider_get_widget (provider, uri, GTK_WIDGET (slot->window));
if (widget != NULL) {
- nautilus_window_add_extra_location_widget (window, widget);
+ nautilus_window_slot_add_extra_location_widget (slot, widget);
}
}
g_free (uri);
@@ -1297,11 +1390,11 @@
}
static void
-nautilus_window_show_x_content_bar (NautilusWindow *window, GMount *mount, const char **x_content_types)
+nautilus_window_slot_show_x_content_bar (NautilusWindowSlot *slot, GMount *mount, const char **x_content_types)
{
unsigned int n;
- g_assert (NAUTILUS_IS_WINDOW (window));
+ g_assert (NAUTILUS_IS_WINDOW_SLOT (slot));
for (n = 0; x_content_types[n] != NULL; n++) {
GAppInfo *default_app;
@@ -1317,27 +1410,25 @@
GtkWidget *bar;
bar = nautilus_x_content_bar_new (mount, x_content_types[n]);
gtk_widget_show (bar);
- nautilus_window_add_extra_location_widget (window, bar);
+ nautilus_window_slot_add_extra_location_widget (slot, bar);
g_object_unref (default_app);
}
}
}
static void
-nautilus_window_show_trash_bar (NautilusWindow *window)
+nautilus_window_slot_show_trash_bar (NautilusWindowSlot *slot)
{
GtkWidget *bar;
- g_assert (NAUTILUS_IS_WINDOW (window));
-
bar = nautilus_trash_bar_new ();
gtk_widget_show (bar);
- nautilus_window_add_extra_location_widget (window, bar);
+ nautilus_window_slot_add_extra_location_widget (slot, bar);
}
typedef struct {
- NautilusWindow *window;
+ NautilusWindowSlot *slot;
GCancellable *cancellable;
GMount *mount;
} FindMountData;
@@ -1345,20 +1436,19 @@
static void
found_content_type_cb (const char **x_content_types, FindMountData *data)
{
- NautilusWindow *window;
+ NautilusWindowSlot *slot;
if (g_cancellable_is_cancelled (data->cancellable)) {
goto out;
}
-
- window = data->window;
-
+
+ slot = data->slot;
+
if (x_content_types != NULL && x_content_types[0] != NULL) {
- nautilus_window_show_x_content_bar (window, data->mount, x_content_types);
- update_extra_location_widgets_visibility (window);
+ nautilus_window_slot_show_x_content_bar (slot, data->mount, x_content_types);
}
- window->details->find_mount_cancellable = NULL;
+ slot->find_mount_cancellable = NULL;
out:
g_object_unref (data->mount);
@@ -1374,12 +1464,14 @@
FindMountData *data = user_data;
GMount *mount;
NautilusWindow *window;
+ NautilusWindowSlot *slot;
if (g_cancellable_is_cancelled (data->cancellable)) {
goto out;
}
-
- window = data->window;
+
+ slot = data->slot;
+ window = slot->window;
mount = g_file_find_enclosing_mount_finish (G_FILE (source_object),
res,
@@ -1393,94 +1485,157 @@
return;
}
- window->details->find_mount_cancellable = NULL;
+ data->slot->find_mount_cancellable = NULL;
out:
g_object_unref (data->cancellable);
g_free (data);
}
+void
+nautilus_window_sync_location_widgets (NautilusWindow *window)
+{
+ NautilusWindowSlot *slot;
+ char *uri;
+
+ slot = window->details->active_slot;
+
+ if (NAUTILUS_IS_NAVIGATION_WINDOW (window)) {
+ NautilusNavigationWindowSlot *navigation_slot;
+
+ navigation_slot = NAUTILUS_NAVIGATION_WINDOW_SLOT (slot);
+
+ /* Check if the back and forward buttons need enabling or disabling. */
+ update_up_button (window);
+ nautilus_navigation_window_allow_back (NAUTILUS_NAVIGATION_WINDOW (window),
+ navigation_slot->back_list != NULL);
+ nautilus_navigation_window_allow_forward (NAUTILUS_NAVIGATION_WINDOW (window),
+ navigation_slot->forward_list != NULL);
+
+ /* Change the location bar and path bar to match the current location. */
+ if (slot->location != NULL) {
+ /* this may be NULL if we just created the
+ * slot */
+ uri = nautilus_window_slot_get_location_uri (slot);
+ nautilus_navigation_bar_set_location (NAUTILUS_NAVIGATION_BAR (NAUTILUS_NAVIGATION_WINDOW (window)->navigation_bar),
+ uri);
+ g_free (uri);
+ nautilus_path_bar_set_path (NAUTILUS_PATH_BAR (NAUTILUS_NAVIGATION_WINDOW (window)->path_bar),
+ slot->location);
+ }
+ }
+
+ if (NAUTILUS_IS_SPATIAL_WINDOW (window)) {
+ /* Change the location button to match the current location. */
+ nautilus_spatial_window_set_location_button (NAUTILUS_SPATIAL_WINDOW (window),
+ slot->location);
+ }
+}
+
+static void
+nautilus_window_sync_search_mode (NautilusWindow *window)
+{
+ NautilusWindowSlot *slot;
+ NautilusDirectory *directory;
+
+ slot = window->details->active_slot;
+
+ directory = nautilus_directory_get (slot->location);
+ if (NAUTILUS_IS_SEARCH_DIRECTORY (directory)) {
+ nautilus_window_set_search_mode (window, TRUE, NAUTILUS_SEARCH_DIRECTORY (directory));
+ } else {
+ nautilus_window_set_search_mode (window, FALSE, NULL);
+ }
+ nautilus_directory_unref (directory);
+}
+
/* Handle the changes for the NautilusWindow itself. */
static void
-update_for_new_location (NautilusWindow *window)
+update_for_new_location (NautilusWindowSlot *slot)
{
+ NautilusWindow *window;
GFile *new_location;
NautilusFile *file;
NautilusDirectory *directory;
gboolean location_really_changed;
- char *uri;
FindMountData *data;
-
- new_location = window->details->pending_location;
- window->details->pending_location = NULL;
- set_displayed_location (window, new_location);
+ window = slot->window;
+
+ new_location = slot->pending_location;
+ slot->pending_location = NULL;
+
+ set_displayed_location (slot, new_location);
+
+ update_history (window, slot->location_change_type, new_location);
- update_history (window, window->details->location_change_type, new_location);
-
location_really_changed =
- window->details->location == NULL ||
- !g_file_equal (window->details->location, new_location);
+ slot->location == NULL ||
+ !g_file_equal (slot->location, new_location);
/* Set the new location. */
- if (window->details->location) {
- g_object_unref (window->details->location);
+ if (slot->location) {
+ g_object_unref (slot->location);
}
- window->details->location = new_location;
-
+ slot->location = new_location;
+
/* Create a NautilusFile for this location, so we can catch it
* if it goes away.
*/
- cancel_viewed_file_changed_callback (window);
- file = nautilus_file_get (window->details->location);
- nautilus_window_set_viewed_file (window, file);
- window->details->viewed_file_seen = !nautilus_file_is_not_yet_confirmed (file);
- window->details->viewed_file_in_trash = nautilus_file_is_in_trash (file);
- nautilus_file_monitor_add (file, &window->details->viewed_file, 0);
- g_signal_connect_object (file, "changed",
- G_CALLBACK (viewed_file_changed_callback), window, 0);
+ cancel_viewed_file_changed_callback (slot);
+ file = nautilus_file_get (slot->location);
+ nautilus_window_slot_set_viewed_file (slot, file);
+ slot->viewed_file_seen = !nautilus_file_is_not_yet_confirmed (file);
+ slot->viewed_file_in_trash = nautilus_file_is_in_trash (file);
+ nautilus_file_monitor_add (file, &slot->viewed_file, 0);
+ g_signal_connect_object (file, "changed",
+ G_CALLBACK (viewed_file_changed_callback), slot, 0);
nautilus_file_unref (file);
-
- /* Check if we can go up. */
- update_up_button (window);
+
+ if (slot == window->details->active_slot) {
+ /* Check if we can go up. */
+ update_up_button (window);
+ }
/* Set up the initial zoom levels */
- zoom_parameters_changed_callback (window->content_view,
- window);
+ zoom_parameters_changed_callback (slot->content_view,
+ slot);
- /* Set up the content view menu for this new location. */
- nautilus_window_load_view_as_menus (window);
-
- /* Load menus from nautilus extensions for this location */
- nautilus_window_load_extension_menus (window);
+ if (slot == window->details->active_slot) {
+ /* Set up the content view menu for this new location. */
+ nautilus_window_load_view_as_menus (window);
+
+ /* Load menus from nautilus extensions for this location */
+ nautilus_window_load_extension_menus (window);
+ }
if (location_really_changed) {
- remove_extra_location_widgets (window);
+ nautilus_window_slot_remove_extra_location_widgets (slot);
- directory = nautilus_directory_get (window->details->location);
- if (NAUTILUS_IS_SEARCH_DIRECTORY (directory)) {
- nautilus_window_set_search_mode (window, TRUE, NAUTILUS_SEARCH_DIRECTORY (directory));
- } else {
- nautilus_window_set_search_mode (window, FALSE, NULL);
+ directory = nautilus_directory_get (slot->location);
+
+ slot->search_mode = NAUTILUS_IS_SEARCH_DIRECTORY (directory);
+ if (slot == window->details->active_slot) {
+ nautilus_window_sync_search_mode (window);
}
if (nautilus_directory_is_in_trash (directory)) {
- nautilus_window_show_trash_bar (window);
+ nautilus_window_slot_show_trash_bar (slot);
}
/* need the mount to determine if we should put up the x-content cluebar */
- if (window->details->find_mount_cancellable != NULL) {
- g_cancellable_cancel (window->details->find_mount_cancellable);
- window->details->find_mount_cancellable = NULL;
+ if (slot->find_mount_cancellable != NULL) {
+ g_cancellable_cancel (slot->find_mount_cancellable);
+ slot->find_mount_cancellable = NULL;
}
data = g_new (FindMountData, 1);
- data->window = window;
+ data->slot = slot;
data->cancellable = g_cancellable_new ();
data->mount = NULL;
-
- window->details->find_mount_cancellable = data->cancellable;
- g_file_find_enclosing_mount_async (window->details->location,
+
+ slot->find_mount_cancellable = data->cancellable;
+ g_file_find_enclosing_mount_async (slot->location,
G_PRIORITY_DEFAULT,
data->cancellable,
found_mount_cb,
@@ -1488,33 +1643,15 @@
nautilus_directory_unref (directory);
- add_extension_extra_widgets (window, window->details->location);
-
- update_extra_location_widgets_visibility (window);
+ slot_add_extension_extra_widgets (slot);
}
-#if !NEW_UI_COMPLETE
- if (NAUTILUS_IS_NAVIGATION_WINDOW (window)) {
- /* Check if the back and forward buttons need enabling or disabling. */
- nautilus_navigation_window_allow_back (NAUTILUS_NAVIGATION_WINDOW (window), NAUTILUS_NAVIGATION_WINDOW (window)->back_list != NULL);
- nautilus_navigation_window_allow_forward (NAUTILUS_NAVIGATION_WINDOW (window), NAUTILUS_NAVIGATION_WINDOW (window)->forward_list != NULL);
-
- /* Change the location bar and path bar to match the current location. */
- uri = g_file_get_uri (window->details->location);
- nautilus_navigation_bar_set_location (NAUTILUS_NAVIGATION_BAR (NAUTILUS_NAVIGATION_WINDOW (window)->navigation_bar),
- uri);
- g_free (uri);
- nautilus_path_bar_set_path (NAUTILUS_PATH_BAR (NAUTILUS_NAVIGATION_WINDOW (window)->path_bar),
- window->details->location);
- nautilus_navigation_window_load_extension_toolbar_items (NAUTILUS_NAVIGATION_WINDOW (window));
- }
-
- if (NAUTILUS_IS_SPATIAL_WINDOW (window)) {
- /* Change the location button to match the current location. */
- nautilus_spatial_window_set_location_button (NAUTILUS_SPATIAL_WINDOW (window),
- window->details->location);
- }
-#endif
+ if (slot == window->details->active_slot) {
+ nautilus_window_sync_location_widgets (window);
+ if (NAUTILUS_IS_NAVIGATION_WINDOW (window)) {
+ nautilus_navigation_window_load_extension_toolbar_items (NAUTILUS_NAVIGATION_WINDOW (window));
+ }
+ }
}
/* A location load previously announced by load_underway
@@ -1523,137 +1660,149 @@
nautilus_window_report_load_complete (NautilusWindow *window,
NautilusView *view)
{
+ NautilusWindowSlot *slot;
+
g_assert (NAUTILUS_IS_WINDOW (window));
+ slot = nautilus_window_get_slot_for_view (window, view);
+ g_assert (slot != NULL);
+
/* Only handle this if we're expecting it.
* Don't handle it if its from an old view we've switched from */
- if (view == window->content_view) {
- if (window->details->pending_scroll_to != NULL) {
- nautilus_view_scroll_to_file (window->content_view,
- window->details->pending_scroll_to);
+ if (view == slot->content_view) {
+ if (slot->pending_scroll_to != NULL) {
+ nautilus_view_scroll_to_file (slot->content_view,
+ slot->pending_scroll_to);
}
- end_location_change (window);
+ end_location_change (slot);
}
}
static void
-end_location_change (NautilusWindow *window)
+end_location_change (NautilusWindowSlot *slot)
{
+ NautilusWindow *window;
char *uri;
- uri = nautilus_window_get_location_uri (window);
+ window = slot->window;
+
+ uri = nautilus_window_slot_get_location_uri (slot);
if (uri) {
nautilus_debug_log (FALSE, NAUTILUS_DEBUG_LOG_DOMAIN_USER,
"finished loading window %p: %s", window, uri);
g_free (uri);
}
- nautilus_window_allow_stop (window, FALSE);
+ nautilus_window_slot_set_allow_stop (slot, FALSE);
/* Now we can free pending_scroll_to, since the load_complete
* callback already has been emitted.
*/
- g_free (window->details->pending_scroll_to);
- window->details->pending_scroll_to = NULL;
+ g_free (slot->pending_scroll_to);
+ slot->pending_scroll_to = NULL;
- free_location_change (window);
+ free_location_change (slot);
}
static void
-free_location_change (NautilusWindow *window)
+free_location_change (NautilusWindowSlot *slot)
{
- if (window->details->pending_location) {
- g_object_unref (window->details->pending_location);
+ if (slot->pending_location) {
+ g_object_unref (slot->pending_location);
}
- window->details->pending_location = NULL;
+ slot->pending_location = NULL;
- eel_g_object_list_free (window->details->pending_selection);
- window->details->pending_selection = NULL;
+ eel_g_object_list_free (slot->pending_selection);
+ slot->pending_selection = NULL;
/* Don't free pending_scroll_to, since thats needed until
* the load_complete callback.
*/
- if (window->details->mount_cancellable != NULL) {
- g_cancellable_cancel (window->details->mount_cancellable);
- window->details->mount_cancellable = NULL;
+ if (slot->mount_cancellable != NULL) {
+ g_cancellable_cancel (slot->mount_cancellable);
+ slot->mount_cancellable = NULL;
}
- if (window->details->determine_view_file != NULL) {
+ if (slot->determine_view_file != NULL) {
nautilus_file_cancel_call_when_ready
- (window->details->determine_view_file,
- got_file_info_for_view_selection_callback, window);
- window->details->determine_view_file = NULL;
+ (slot->determine_view_file,
+ got_file_info_for_view_selection_callback, slot);
+ slot->determine_view_file = NULL;
}
- if (window->new_content_view != NULL) {
- disconnect_view (window, window->new_content_view);
- g_object_unref (window->new_content_view);
- window->new_content_view = NULL;
+ if (slot->new_content_view != NULL) {
+ slot_disconnect_view (slot, slot->new_content_view);
+ g_object_unref (slot->new_content_view);
+ slot->new_content_view = NULL;
}
}
static void
-cancel_location_change (NautilusWindow *window)
+cancel_location_change (NautilusWindowSlot *slot)
{
GList *selection;
-
- if (window->details->pending_location != NULL
- && window->details->location != NULL
- && window->content_view != NULL) {
+
+ if (slot->pending_location != NULL
+ && slot->location != NULL
+ && slot->content_view != NULL) {
/* No need to tell the new view - either it is the
* same as the old view, in which case it will already
* be told, or it is the very pending change we wish
* to cancel.
*/
- selection = nautilus_view_get_selection (window->content_view);
- load_new_location (window,
- window->details->location,
+ selection = nautilus_view_get_selection (slot->content_view);
+ load_new_location (slot,
+ slot->location,
selection,
TRUE,
FALSE);
eel_g_object_list_free (selection);
}
- end_location_change (window);
+ end_location_change (slot);
}
void
nautilus_window_report_view_failed (NautilusWindow *window,
NautilusView *view)
{
+ NautilusWindowSlot *slot;
gboolean do_close_window;
GFile *fallback_load_location;
+
g_warning ("A view failed. The UI will handle this with a dialog but this should be debugged.");
+ slot = nautilus_window_get_slot_for_view (window, view);
+ g_assert (slot != NULL);
do_close_window = FALSE;
fallback_load_location = NULL;
- if (view == window->content_view) {
- disconnect_view (window, window->content_view);
- nautilus_window_set_content_view_widget (window, NULL);
-
- report_current_content_view_failure_to_user (window, view);
+ if (view == slot->content_view) {
+ slot_disconnect_view (slot, slot->content_view);
+ nautilus_window_slot_set_content_view_widget (slot, NULL);
+
+ report_current_content_view_failure_to_user (slot);
} else {
/* Only report error on first try */
- if (window->details->location_change_type != NAUTILUS_LOCATION_CHANGE_FALLBACK) {
- report_nascent_content_view_failure_to_user (window, view);
+ if (slot->location_change_type != NAUTILUS_LOCATION_CHANGE_FALLBACK) {
+ report_nascent_content_view_failure_to_user (slot, view);
- fallback_load_location = g_object_ref (window->details->pending_location);
+ fallback_load_location = g_object_ref (slot->pending_location);
} else {
if (!GTK_WIDGET_VISIBLE (window)) {
do_close_window = TRUE;
}
}
}
-
- cancel_location_change (window);
+
+ cancel_location_change (slot);
if (fallback_load_location != NULL) {
/* We loose the pending selection change here, but who cares... */
- begin_location_change (window, fallback_load_location, NULL,
+ begin_location_change (slot, fallback_load_location, NULL,
NAUTILUS_LOCATION_CHANGE_FALLBACK, 0, NULL);
g_object_unref (fallback_load_location);
}
@@ -1768,66 +1917,76 @@
void
-nautilus_window_stop_loading (NautilusWindow *window)
+nautilus_window_slot_stop_loading (NautilusWindowSlot *slot)
{
- nautilus_view_stop_loading (window->content_view);
+ nautilus_view_stop_loading (slot->content_view);
- if (window->new_content_view != NULL) {
- nautilus_view_stop_loading (window->new_content_view);
+ if (slot->new_content_view != NULL) {
+ nautilus_view_stop_loading (slot->new_content_view);
}
- cancel_location_change (window);
+ cancel_location_change (slot);
}
void
-nautilus_window_set_content_view (NautilusWindow *window,
- const char *id)
+nautilus_window_slot_set_content_view (NautilusWindowSlot *slot,
+ const char *id)
{
+ NautilusWindow *window;
NautilusFile *file;
- char *location;
-
- g_return_if_fail (NAUTILUS_IS_WINDOW (window));
- g_return_if_fail (window->details->location != NULL);
- g_return_if_fail (id != NULL);
+ char *uri;
- location = nautilus_window_get_location_uri (window);
+ g_assert (slot != NULL);
+ g_assert (slot->location != NULL);
+ g_assert (id != NULL);
+
+ window = slot->window;
+ g_assert (NAUTILUS_IS_WINDOW (window));
+
+ uri = nautilus_window_slot_get_location_uri (slot);
nautilus_debug_log (FALSE, NAUTILUS_DEBUG_LOG_DOMAIN_USER,
"change view of window %p: \"%s\" to \"%s\"",
- window, location, id);
- g_free (location);
+ window, uri, id);
+ g_free (uri);
- if (nautilus_window_content_view_matches_iid (window, id)) {
+ if (nautilus_window_slot_content_view_matches_iid (slot, id)) {
return;
}
- end_location_change (window);
+ end_location_change (slot);
- file = nautilus_file_get (window->details->location);
+ file = nautilus_file_get (slot->location);
nautilus_file_set_metadata
(file, NAUTILUS_METADATA_KEY_DEFAULT_COMPONENT, NULL, id);
nautilus_file_unref (file);
- nautilus_window_allow_stop (window, TRUE);
+ nautilus_window_slot_set_allow_stop (slot, TRUE);
- if (nautilus_view_get_selection_count (window->content_view) == 0) {
+ if (nautilus_view_get_selection_count (slot->content_view) == 0) {
/* If there is no selection, queue a scroll to the same icon that
* is currently visible */
- window->details->pending_scroll_to = nautilus_view_get_first_visible_file (window->content_view);
+ slot->pending_scroll_to = nautilus_view_get_first_visible_file (slot->content_view);
}
- window->details->location_change_type = NAUTILUS_LOCATION_CHANGE_RELOAD;
+ slot->location_change_type = NAUTILUS_LOCATION_CHANGE_RELOAD;
- create_content_view (window, id);
+ create_content_view (slot, id);
}
static void
zoom_level_changed_callback (NautilusView *view,
- NautilusWindow *window)
+ NautilusWindowSlot *slot)
{
+ NautilusWindow *window;
GtkAction *action;
gboolean supports_zooming;
-
+
+ window = slot->window;
g_assert (NAUTILUS_IS_WINDOW (window));
+ if (slot != window->details->active_slot) {
+ return;
+ }
+
/* This is called each time the component successfully completed
* a zooming operation.
*/
@@ -1854,13 +2013,19 @@
static void
zoom_parameters_changed_callback (NautilusView *view,
- NautilusWindow *window)
+ NautilusWindowSlot *slot)
{
+ NautilusWindow *window;
float zoom_level;
GtkAction *action;
+ window = slot->window;
g_assert (NAUTILUS_IS_WINDOW (window));
+ if (slot != window->details->active_slot) {
+ return;
+ }
+
/* The initial zoom level of a component is allowed to be 0.0 if
* there is no file loaded yet. In this case we need to set the
* commands insensitive but display the zoom control nevertheless
@@ -1886,77 +2051,95 @@
/* "zoom_parameters_changed" always implies "zoom_level_changed",
* but you won't get both signals, so we need to pass it down.
*/
- zoom_level_changed_callback (view, window);
+ zoom_level_changed_callback (view, slot);
}
static void
title_changed_callback (NautilusView *view,
- NautilusWindow *window)
+ NautilusWindowSlot *slot)
{
- g_assert (NAUTILUS_IS_WINDOW (window));
+ g_assert (NAUTILUS_IS_WINDOW (slot->window));
- nautilus_window_update_title (window);
- nautilus_window_update_icon (window);
+ nautilus_window_slot_update_title (slot);
+ nautilus_window_slot_update_icon (slot);
}
static void
-connect_view (NautilusWindow *window,
- NautilusView *view)
+slot_connect_view (NautilusWindowSlot *slot,
+ NautilusView *view)
{
g_signal_connect (view, "title_changed",
- G_CALLBACK (title_changed_callback), window);
+ G_CALLBACK (title_changed_callback), slot);
g_signal_connect (view, "zoom_level_changed",
- G_CALLBACK (zoom_level_changed_callback), window);
+ G_CALLBACK (zoom_level_changed_callback), slot);
g_signal_connect (view, "zoom_parameters_changed",
- G_CALLBACK (zoom_parameters_changed_callback), window);
+ G_CALLBACK (zoom_parameters_changed_callback), slot);
}
static void
-disconnect_view (NautilusWindow *window,
- NautilusView *view)
+slot_disconnect_view (NautilusWindowSlot *slot,
+ NautilusView *view)
{
if (view == NULL) {
return;
}
- g_signal_handlers_disconnect_by_func (view, title_changed_callback, window);
- g_signal_handlers_disconnect_by_func (view, zoom_level_changed_callback, window);
- g_signal_handlers_disconnect_by_func (view, zoom_parameters_changed_callback, window);
+ g_signal_handlers_disconnect_by_func (view, title_changed_callback, slot);
+ g_signal_handlers_disconnect_by_func (view, zoom_level_changed_callback, slot);
+ g_signal_handlers_disconnect_by_func (view, zoom_parameters_changed_callback, slot);
}
void
nautilus_window_manage_views_destroy (NautilusWindow *window)
{
+ NautilusWindowSlot *slot;
+ GList *l;
+
/* Disconnect view signals here so they don't trigger when
* views are destroyed.
*/
- if (window->content_view != NULL) {
- disconnect_view (window, window->content_view);
- }
- if (window->new_content_view != NULL) {
- disconnect_view (window, window->new_content_view);
+ for (l = window->details->slots; l != NULL; l = l->next) {
+ slot = l->data;
+
+ if (slot->content_view != NULL) {
+ slot_disconnect_view (slot, slot->content_view);
+ }
+ if (slot->new_content_view != NULL) {
+ slot_disconnect_view (slot, slot->new_content_view);
+ }
}
}
void
nautilus_window_manage_views_finalize (NautilusWindow *window)
{
- free_location_change (window);
- cancel_viewed_file_changed_callback (window);
+
+ NautilusWindowSlot *slot;
+ GList *l;
+
+ for (l = window->details->slots; l != NULL; l = l->next) {
+ slot = l->data;
+ free_location_change (slot);
+ cancel_viewed_file_changed_callback (slot);
+ }
}
void
nautilus_navigation_window_back_or_forward (NautilusNavigationWindow *window,
gboolean back, guint distance)
{
+ NautilusWindowSlot *slot;
+ NautilusNavigationWindowSlot *navigation_slot;
GList *list;
GFile *location;
char *scroll_pos;
guint len;
NautilusBookmark *bookmark;
-
- list = back ? window->back_list : window->forward_list;
+
+ slot = NAUTILUS_WINDOW (window)->details->active_slot;
+ navigation_slot = (NautilusNavigationWindowSlot *) slot;
+ list = back ? navigation_slot->back_list : navigation_slot->forward_list;
len = (guint) g_list_length (list);
@@ -1973,7 +2156,7 @@
location = nautilus_bookmark_get_location (bookmark);
scroll_pos = nautilus_bookmark_get_scroll_pos (bookmark);
begin_location_change
- (NAUTILUS_WINDOW (window),
+ (slot,
location, NULL,
back ? NAUTILUS_LOCATION_CHANGE_BACK : NAUTILUS_LOCATION_CHANGE_FORWARD,
distance,
@@ -1985,73 +2168,41 @@
/* reload the contents of the window */
void
-nautilus_window_reload (NautilusWindow *window)
+nautilus_window_slot_reload (NautilusWindowSlot *slot)
{
GFile *location;
char *current_pos;
GList *selection;
-
- g_return_if_fail (NAUTILUS_IS_WINDOW (window));
- if (window->details->location == NULL) {
+ g_assert (NAUTILUS_IS_WINDOW_SLOT (slot));
+
+ if (slot->location == NULL) {
return;
}
- /* window->details->location can be free'd during the processing
+ /* peek_slot_field (window, location) can be free'd during the processing
* of begin_location_change, so make a copy
*/
- location = g_object_ref (window->details->location);
+ location = g_object_ref (slot->location);
current_pos = NULL;
selection = NULL;
- if (window->content_view != NULL) {
- current_pos = nautilus_view_get_first_visible_file (window->content_view);
- selection = nautilus_view_get_selection (window->content_view);
+ if (slot->content_view != NULL) {
+ current_pos = nautilus_view_get_first_visible_file (slot->content_view);
+ selection = nautilus_view_get_selection (slot->content_view);
}
begin_location_change
- (window, location, selection,
+ (slot, location, selection,
NAUTILUS_LOCATION_CHANGE_RELOAD, 0, current_pos);
g_free (current_pos);
g_object_unref (location);
eel_g_object_list_free (selection);
}
-static void
-remove_all (GtkWidget *widget,
- gpointer data)
-{
- GtkContainer *container;
- container = GTK_CONTAINER (data);
-
- gtk_container_remove (container, widget);
-}
-
-static void
-remove_extra_location_widgets (NautilusWindow *window)
-{
- gtk_container_foreach (GTK_CONTAINER (window->details->extra_location_widgets),
- remove_all,
- window->details->extra_location_widgets);
-}
-
void
-nautilus_window_add_extra_location_widget (NautilusWindow *window,
- GtkWidget *widget)
+nautilus_window_reload (NautilusWindow *window)
{
- gtk_box_pack_start (GTK_BOX (window->details->extra_location_widgets),
- widget, TRUE, TRUE, 0);
-}
+ g_assert (NAUTILUS_IS_WINDOW (window));
-static void
-update_extra_location_widgets_visibility (NautilusWindow *window)
-{
- GList *children;
-
- children = gtk_container_get_children (GTK_CONTAINER (window->details->extra_location_widgets));
-
- if (children != NULL) {
- gtk_widget_show (window->details->extra_location_widgets);
- } else {
- gtk_widget_hide (window->details->extra_location_widgets);
- }
- g_list_free (children);
+ nautilus_window_slot_reload (window->details->active_slot);
}
+
Modified: branches/multiview/src/nautilus-window-manage-views.h
==============================================================================
--- branches/multiview/src/nautilus-window-manage-views.h (original)
+++ branches/multiview/src/nautilus-window-manage-views.h Thu Mar 20 23:38:01 2008
@@ -32,38 +32,41 @@
void nautilus_window_manage_views_destroy (NautilusWindow *window);
void nautilus_window_manage_views_finalize (NautilusWindow *window);
-void nautilus_window_open_location (NautilusWindow *window,
+
+void nautilus_navigation_window_set_sidebar_panels (NautilusNavigationWindow *window,
+ GList *view_identifier_list);
+
+/* view interaction (through slots) */
+void nautilus_window_slot_open_location (NautilusWindowSlot *slot,
GFile *location,
gboolean close_behind);
-void nautilus_window_open_location_with_selection (NautilusWindow *window,
+void nautilus_window_slot_open_location_with_selection (NautilusWindowSlot *slot,
GFile *location,
GList *selection,
gboolean close_behind);
-void nautilus_window_open_location_full (NautilusWindow *window,
+void nautilus_window_slot_open_location_full (NautilusWindowSlot *slot,
GFile *location,
NautilusWindowOpenMode mode,
NautilusWindowOpenFlags flags,
GList *new_selection);
-void nautilus_window_stop_loading (NautilusWindow *window);
-void nautilus_window_set_content_view (NautilusWindow *window,
+void nautilus_window_slot_stop_loading (NautilusWindowSlot *slot);
+
+void nautilus_window_slot_set_content_view (NautilusWindowSlot *slot,
const char *id);
-gboolean nautilus_window_content_view_matches_iid (NautilusWindow *window,
+const char *nautilus_window_slot_get_content_view_id (NautilusWindowSlot *slot);
+gboolean nautilus_window_slot_content_view_matches_iid (NautilusWindowSlot *slot,
const char *iid);
-const char *nautilus_window_get_content_view_id (NautilusWindow *window);
-char *nautilus_window_get_view_label (NautilusWindow *window);
-char *nautilus_window_get_view_error_label (NautilusWindow *window);
-char *nautilus_window_get_view_startup_error_label (NautilusWindow *window);
-void nautilus_navigation_window_set_sidebar_panels (NautilusNavigationWindow *window,
- GList *view_identifier_list);
-/* NautilusWindowInfo implementation: */
+/* NautilusWindowInfo implementation, exposed to the view API */
void nautilus_window_report_load_underway (NautilusWindow *window,
NautilusView *view);
-void nautilus_window_report_selection_changed (NautilusWindowInfo *window);
+void nautilus_window_report_selection_changed (NautilusWindow *window);
void nautilus_window_report_view_failed (NautilusWindow *window,
NautilusView *view);
void nautilus_window_report_load_complete (NautilusWindow *window,
NautilusView *view);
+void nautilus_window_report_location_change (NautilusWindow *window,
+ gboolean current_location);
#endif /* NAUTILUS_WINDOW_MANAGE_VIEWS_H */
Modified: branches/multiview/src/nautilus-window-menus.c
==============================================================================
--- branches/multiview/src/nautilus-window-menus.c (original)
+++ branches/multiview/src/nautilus-window-menus.c Thu Mar 20 23:38:01 2008
@@ -199,9 +199,11 @@
gpointer user_data)
{
NautilusWindow *window = NAUTILUS_WINDOW (user_data);
+ NautilusWindowSlot *slot;
GtkWidget *dialog;
GFile *location;
- location = nautilus_window_get_location (window);
+ slot = window->details->active_slot;
+ location = nautilus_window_slot_get_location (slot);
dialog = nautilus_connect_server_dialog_new (window, location);
if (location) {
g_object_unref (location);
@@ -239,7 +241,13 @@
action_stop_callback (GtkAction *action,
gpointer user_data)
{
- nautilus_window_stop_loading (NAUTILUS_WINDOW (user_data));
+ NautilusWindow *window;
+ NautilusWindowSlot *slot;
+
+ window = NAUTILUS_WINDOW (user_data);
+ slot = window->details->active_slot;
+
+ nautilus_window_slot_stop_loading (slot);
}
static void
@@ -751,6 +759,7 @@
static GList *
get_extension_menus (NautilusWindow *window)
{
+ NautilusWindowSlot *slot;
GList *providers;
GList *items;
GList *l;
@@ -758,6 +767,8 @@
providers = nautilus_module_get_extensions_for_type (NAUTILUS_TYPE_MENU_PROVIDER);
items = NULL;
+ slot = window->details->active_slot;
+
for (l = providers; l != NULL; l = l->next) {
NautilusMenuProvider *provider;
GList *file_items;
@@ -765,7 +776,7 @@
provider = NAUTILUS_MENU_PROVIDER (l->data);
file_items = nautilus_menu_provider_get_background_items (provider,
GTK_WIDGET (window),
- window->details->viewed_file);
+ slot->viewed_file);
items = g_list_concat (items, file_items);
}
Modified: branches/multiview/src/nautilus-window-private.h
==============================================================================
--- branches/multiview/src/nautilus-window-private.h (original)
+++ branches/multiview/src/nautilus-window-private.h Thu Mar 20 23:38:01 2008
@@ -29,6 +29,7 @@
#define NAUTILUS_WINDOW_PRIVATE_H
#include "nautilus-window.h"
+#include "nautilus-window-slot.h"
#include "nautilus-spatial-window.h"
#include "nautilus-navigation-window.h"
@@ -37,23 +38,12 @@
#include <bonobo/bonobo-ui-toolbar-button-item.h>
#include <libnautilus-private/nautilus-directory.h>
-typedef enum {
- NAUTILUS_LOCATION_CHANGE_STANDARD,
- NAUTILUS_LOCATION_CHANGE_BACK,
- NAUTILUS_LOCATION_CHANGE_FORWARD,
- NAUTILUS_LOCATION_CHANGE_RELOAD,
- NAUTILUS_LOCATION_CHANGE_REDIRECT,
- NAUTILUS_LOCATION_CHANGE_FALLBACK
-} NautilusLocationChangeType;
-
/* FIXME bugzilla.gnome.org 42575: Migrate more fields into here. */
struct NautilusWindowDetails
{
GtkWidget *table;
GtkWidget *statusbar;
GtkWidget *menubar;
-
- GtkWidget *extra_location_widgets;
GtkUIManager *ui_manager;
GtkActionGroup *main_action_group; /* owned by ui_manager */
@@ -66,25 +56,18 @@
GtkActionGroup *bookmarks_action_group;
guint refresh_bookmarks_menu_idle_id;
guint bookmarks_merge_id;
-
- /* Current location. */
- GFile *location;
- char *title;
- NautilusFile *viewed_file;
- gboolean viewed_file_seen;
- gboolean viewed_file_in_trash;
- gboolean allow_stop;
-
- /* New location. */
- NautilusLocationChangeType location_change_type;
- guint location_change_distance;
- GFile *pending_location;
- char *pending_scroll_to;
- GList *pending_selection;
- NautilusFile *determine_view_file;
- GCancellable *mount_cancellable;
- GError *mount_error;
- gboolean tried_mount;
+
+ /* available slots, and active slot.
+ * Both of them may never be NULL.
+ */
+ GList *slots;
+ NautilusWindowSlot *active_slot;
+
+ NautilusWindowShowHiddenFilesMode show_hidden_files_mode;
+
+ /* View As menu */
+ GList *short_list_viewers;
+ char *extra_viewer;
/* View As choices */
GtkActionGroup *view_as_action_group; /* owned by ui_manager */
@@ -92,17 +75,6 @@
GtkRadioAction *extra_viewer_radio_action;
guint short_list_merge_id;
guint extra_viewer_merge_id;
- GList *short_list_viewers;
- char *extra_viewer;
-
- /* Deferred location change. */
- GFile *location_to_change_to_at_idle;
- guint location_change_at_idle_id;
-
- NautilusWindowShowHiddenFilesMode show_hidden_files_mode;
- gboolean search_mode;
-
- GCancellable *find_mount_cancellable;
};
struct _NautilusNavigationWindowDetails {
@@ -132,7 +104,7 @@
guint extensions_toolbar_merge_id;
GtkActionGroup *extensions_toolbar_action_group;
-
+
/* Throbber */
gboolean throbber_active;
GtkWidget *throbber;
@@ -178,6 +150,7 @@
NautilusBookmark *bookmark);
void nautilus_window_set_status (NautilusWindow *window,
+ NautilusWindowSlot *slot,
const char *status);
void nautilus_window_load_view_as_menus (NautilusWindow *window);
void nautilus_window_load_extension_menus (NautilusWindow *window);
@@ -201,11 +174,18 @@
void nautilus_window_zoom_to_level (NautilusWindow *window,
NautilusZoomLevel level);
void nautilus_window_zoom_to_default (NautilusWindow *window);
-void nautilus_window_show_view_as_dialog (NautilusWindow *window);
-void nautilus_window_set_content_view_widget (NautilusWindow *window,
- NautilusView *content_view);
-void nautilus_window_set_viewed_file (NautilusWindow *window,
- NautilusFile *file);
+
+NautilusWindowSlot *nautilus_window_open_slot (NautilusWindow *window);
+void nautilus_window_close_slot (NautilusWindow *window,
+ NautilusWindowSlot *slot);
+
+NautilusWindowSlot *nautilus_window_get_slot_for_view (NautilusWindow *window,
+ NautilusView *view);
+
+NautilusWindowSlot * nautilus_window_get_active_slot (NautilusWindow *window);
+void nautilus_window_set_active_slot (NautilusWindow *window,
+ NautilusWindowSlot *slot);
+
void nautilus_send_history_list_changed (void);
void nautilus_window_add_current_location_to_history_list (NautilusWindow *window);
void nautilus_remove_from_history_list_no_notify (GFile *location);
@@ -215,9 +195,17 @@
GIcon *icon);
GList * nautilus_get_history_list (void);
void nautilus_window_bookmarks_preference_changed_callback (gpointer user_data);
-void nautilus_window_update_icon (NautilusWindow *window);
void nautilus_window_constructed (NautilusWindow *window);
+
+/* sync window GUI with current slot. Used when changing slots,
+ * and when updating the slot state.
+ */
+void nautilus_window_sync_status (NautilusWindow *window);
+void nautilus_window_sync_allow_stop (NautilusWindow *window);
+void nautilus_window_sync_title (NautilusWindow *window);
+void nautilus_window_sync_location_widgets (NautilusWindow *window);
+
/* Navigation window menus */
void nautilus_navigation_window_initialize_actions (NautilusNavigationWindow *window);
void nautilus_navigation_window_initialize_menus (NautilusNavigationWindow *window);
Added: branches/multiview/src/nautilus-window-slot.c
==============================================================================
--- (empty file)
+++ branches/multiview/src/nautilus-window-slot.c Thu Mar 20 23:38:01 2008
@@ -0,0 +1,367 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+
+ nautilus-window-slot.c: Nautilus window slot
+
+ 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: Christian Neumair <cneumair gnome org>
+*/
+#include "nautilus-window-slot.h"
+#include "nautilus-navigation-window-slot.h"
+
+#include "nautilus-window-private.h"
+#include "nautilus-window-manage-views.h"
+#include <libnautilus-private/nautilus-file.h>
+#include <libnautilus-private/nautilus-file-utilities.h>
+#include <libnautilus-private/nautilus-window-slot-info.h>
+#include <eel/eel-gtk-macros.h>
+#include <eel/eel-string.h>
+
+static void nautilus_window_slot_init (NautilusWindowSlot *slot);
+static void nautilus_window_slot_class_init (NautilusWindowSlotClass *class);
+static void nautilus_window_slot_finalize (GObject *object);
+
+static void nautilus_window_slot_info_iface_init (NautilusWindowSlotInfoIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (NautilusWindowSlot,
+ nautilus_window_slot,
+ G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (NAUTILUS_TYPE_WINDOW_SLOT_INFO,
+ nautilus_window_slot_info_iface_init))
+
+static void
+real_active (NautilusWindowSlot *slot)
+{
+ NautilusWindow *window;
+
+ window = slot->window;
+
+ /* sync window to new slot */
+ nautilus_window_sync_status (window);
+ nautilus_window_sync_allow_stop (window);
+ nautilus_window_sync_title (window);
+ nautilus_window_sync_location_widgets (window);
+
+ if (slot->viewed_file != NULL) {
+ nautilus_window_load_view_as_menus (window);
+ nautilus_window_load_extension_menus (window);
+ }
+}
+
+static void
+nautilus_window_slot_active (NautilusWindowSlot *slot)
+{
+ NautilusWindow *window;
+
+ g_assert (NAUTILUS_IS_WINDOW_SLOT (slot));
+
+ window = NAUTILUS_WINDOW (slot->window);
+ g_assert (slot == window->details->active_slot);
+
+ EEL_CALL_METHOD (NAUTILUS_WINDOW_SLOT_CLASS, slot,
+ active, (slot));
+}
+
+static void
+real_inactive (NautilusWindowSlot *slot)
+{
+ NautilusWindow *window;
+
+ window = NAUTILUS_WINDOW (slot->window);
+ g_assert (slot == window->details->active_slot);
+
+ /* multiview-TODO write back locaton widget state */
+}
+
+static void
+nautilus_window_slot_inactive (NautilusWindowSlot *slot)
+{
+ NautilusWindow *window;
+
+ g_assert (NAUTILUS_IS_WINDOW_SLOT (slot));
+ g_assert (slot == window->details->active_slot);
+
+ EEL_CALL_METHOD (NAUTILUS_WINDOW_SLOT_CLASS, slot,
+ inactive, (slot));
+}
+
+
+static void
+nautilus_window_slot_init (NautilusWindowSlot *slot)
+{
+ GtkWidget *content_box, *eventbox, *extras_vbox;
+
+ content_box = gtk_vbox_new (FALSE, 0);
+ slot->content_box = content_box;
+ gtk_widget_show (content_box);
+
+ eventbox = gtk_event_box_new ();
+ gtk_widget_set_name (eventbox, "nautilus-extra-view-widget");
+ gtk_box_pack_start (GTK_BOX (content_box), eventbox, FALSE, FALSE, 0);
+ gtk_widget_show (eventbox);
+
+ extras_vbox = gtk_vbox_new (FALSE, 6);
+ gtk_container_set_border_width (GTK_CONTAINER (extras_vbox), 6);
+ slot->extra_location_widgets = extras_vbox;
+ gtk_container_add (GTK_CONTAINER (eventbox), extras_vbox);
+
+ slot->view_box = gtk_vbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (content_box), slot->view_box, TRUE, TRUE, 0);
+ gtk_widget_show (slot->view_box);
+}
+
+static void
+nautilus_window_slot_class_init (NautilusWindowSlotClass *class)
+{
+ class->active = real_active;
+ class->inactive = real_inactive;
+ G_OBJECT_CLASS (class)->finalize = nautilus_window_slot_finalize;
+}
+
+static int
+nautilus_window_slot_get_selection_count (NautilusWindowSlot *slot)
+{
+ g_assert (NAUTILUS_IS_WINDOW_SLOT (slot));
+
+ if (slot->content_view != NULL) {
+ return nautilus_view_get_selection_count (slot->content_view);
+ }
+ return 0;
+}
+
+GFile *
+nautilus_window_slot_get_location (NautilusWindowSlot *slot)
+{
+ g_assert (slot != NULL);
+ g_assert (NAUTILUS_IS_WINDOW (slot->window));
+
+ if (slot->location != NULL) {
+ return g_object_ref (slot->location);
+ }
+ return NULL;
+}
+
+char *
+nautilus_window_slot_get_location_uri (NautilusWindowSlotInfo *slot)
+{
+ g_assert (NAUTILUS_IS_WINDOW_SLOT (slot));
+
+ if (slot->location) {
+ return g_file_get_uri (slot->location);
+ }
+ return NULL;
+}
+
+char *
+nautilus_window_slot_get_title (NautilusWindowSlot *slot)
+{
+ char *title;
+
+ g_assert (NAUTILUS_IS_WINDOW_SLOT (slot));
+
+ title = NULL;
+ if (slot->new_content_view != NULL) {
+ title = nautilus_view_get_title (slot->new_content_view);
+ } else if (slot->content_view != NULL) {
+ title = nautilus_view_get_title (slot->content_view);
+ }
+
+ if (title == NULL) {
+ title = nautilus_compute_title_for_location (slot->location);
+ }
+
+ return title;
+}
+
+static NautilusWindow *
+nautilus_window_slot_get_window (NautilusWindowSlot *slot)
+{
+ g_assert (NAUTILUS_IS_WINDOW_SLOT (slot));
+ return slot->window;
+}
+
+/* nautilus_window_slot_set_title:
+ *
+ * Sets slot->title, and if it changed
+ * synchronizes the actual GtkWindow title which
+ * might look a bit different (e.g. with "file browser:" added)
+ */
+static void
+nautilus_window_slot_set_title (NautilusWindowSlot *slot,
+ const char *title)
+{
+ NautilusWindow *window;
+ gboolean changed;
+
+ g_assert (NAUTILUS_IS_WINDOW_SLOT (slot));
+
+ window = NAUTILUS_WINDOW (slot->window);
+
+ changed = FALSE;
+
+ if (eel_strcmp (title, slot->title) != 0) {
+ changed = TRUE;
+
+ g_free (slot->title);
+ slot->title = g_strdup (title);
+ }
+
+ if (eel_strlen (slot->title) > 0 && slot->current_location_bookmark &&
+ nautilus_bookmark_set_name (slot->current_location_bookmark,
+ slot->title)) {
+ changed = TRUE;
+
+ /* Name of item in history list changed, tell listeners. */
+ nautilus_send_history_list_changed ();
+ }
+
+ if (changed && window->details->active_slot == slot) {
+ nautilus_window_sync_title (window);
+ }
+}
+
+
+/* nautilus_window_slot_update_title:
+ *
+ * Re-calculate the slot title.
+ * Called when the location or view has changed.
+ * @slot: The NautilusWindowSlot in question.
+ *
+ */
+void
+nautilus_window_slot_update_title (NautilusWindowSlot *slot)
+{
+ char *title;
+
+ title = nautilus_window_slot_get_title (slot);
+ nautilus_window_slot_set_title (slot, title);
+ g_free (title);
+}
+
+/* nautilus_window_slot_update_icon:
+ *
+ * Re-calculate the slot icon
+ * Called when the location or view or icon set has changed.
+ * @slot: The NautilusWindowSlot in question.
+ */
+void
+nautilus_window_slot_update_icon (NautilusWindowSlot *slot)
+{
+ NautilusWindow *window;
+ NautilusIconInfo *info;
+ const char *icon_name;
+ GdkPixbuf *pixbuf;
+
+ window = slot->window;
+
+ g_return_if_fail (NAUTILUS_IS_WINDOW (window));
+
+ info = EEL_CALL_METHOD_WITH_RETURN_VALUE (NAUTILUS_WINDOW_CLASS, window,
+ get_icon, (window, slot));
+
+ icon_name = NULL;
+ if (info) {
+ icon_name = nautilus_icon_info_get_used_name (info);
+ if (icon_name != NULL) {
+ gtk_window_set_icon_name (GTK_WINDOW (window), icon_name);
+ } else {
+ pixbuf = nautilus_icon_info_get_pixbuf_nodefault (info);
+
+ if (pixbuf) {
+ gtk_window_set_icon (GTK_WINDOW (window), pixbuf);
+ g_object_unref (pixbuf);
+ }
+ }
+
+ g_object_unref (info);
+ }
+}
+
+
+static void
+remove_all (GtkWidget *widget,
+ gpointer data)
+{
+ GtkContainer *container;
+ container = GTK_CONTAINER (data);
+
+ gtk_container_remove (container, widget);
+}
+
+void
+nautilus_window_slot_remove_extra_location_widgets (NautilusWindowSlot *slot)
+{
+ gtk_container_foreach (GTK_CONTAINER (slot->extra_location_widgets),
+ remove_all,
+ slot->extra_location_widgets);
+ gtk_widget_hide (slot->extra_location_widgets);
+}
+
+void
+nautilus_window_slot_add_extra_location_widget (NautilusWindowSlot *slot,
+ GtkWidget *widget)
+{
+ gtk_box_pack_start (GTK_BOX (slot->extra_location_widgets),
+ widget, TRUE, TRUE, 0);
+ gtk_widget_show (slot->extra_location_widgets);
+}
+
+static void
+nautilus_window_slot_finalize (GObject *object)
+{
+ NautilusWindowSlot *slot = NAUTILUS_WINDOW_SLOT (object);
+
+ nautilus_window_slot_set_viewed_file (slot, NULL);
+ /* TODO? why do we unref here? the file is NULL.
+ * It was already here before the slot move, though */
+ nautilus_file_unref (slot->viewed_file);
+
+ if (slot->location) {
+ /* TODO? why do we ref here, instead of unreffing?
+ * It was already here before the slot move, though */
+ g_object_ref (slot->location);
+ }
+ eel_g_list_free_deep (slot->pending_selection);
+
+ if (slot->current_location_bookmark != NULL) {
+ g_object_unref (slot->current_location_bookmark);
+ }
+ if (slot->last_location_bookmark != NULL) {
+ g_object_unref (slot->last_location_bookmark);
+ }
+
+ if (slot->find_mount_cancellable != NULL) {
+ g_cancellable_cancel (slot->find_mount_cancellable);
+ slot->find_mount_cancellable = NULL;
+ }
+
+ g_free (slot->title);
+}
+
+static void
+nautilus_window_slot_info_iface_init (NautilusWindowSlotInfoIface *iface)
+{
+ iface->active = nautilus_window_slot_active;
+ iface->inactive = nautilus_window_slot_inactive;
+ iface->get_window = nautilus_window_slot_get_window;
+ iface->get_selection_count = nautilus_window_slot_get_selection_count;
+ iface->get_current_location = nautilus_window_slot_get_location_uri;
+ iface->set_status = nautilus_window_slot_set_status;
+ iface->get_title = nautilus_window_slot_get_title;
+ iface->open_location = nautilus_window_slot_open_location_full;
+}
Added: branches/multiview/src/nautilus-window-slot.h
==============================================================================
--- (empty file)
+++ branches/multiview/src/nautilus-window-slot.h Thu Mar 20 23:38:01 2008
@@ -0,0 +1,132 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+
+ nautilus-window-slot.h: Nautilus window slot
+
+ 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: Christian Neumair <cneumair gnome org>
+*/
+
+#ifndef NAUTILUS_WINDOW_SLOT_H
+#define NAUTILUS_WINDOW_SLOT_H
+
+#include "nautilus-window.h"
+
+#define NAUTILUS_TYPE_WINDOW_SLOT (nautilus_window_slot_get_type())
+#define NAUTILUS_WINDOW_SLOT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NAUTILUS_TYPE_WINDOW_SLOT, NautilusWindowSlotClass))
+#define NAUTILUS_WINDOW_SLOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_WINDOW_SLOT, NautilusWindowSlot))
+#define NAUTILUS_IS_WINDOW_SLOT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_WINDOW_SLOT))
+#define NAUTILUS_IS_WINDOW_SLOT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NAUTILUS_TYPE_WINDOW_SLOT))
+#define NAUTILUS_WINDOW_SLOT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NAUTILUS_TYPE_WINDOW_SLOT, NautilusWindowSlotClass))
+
+typedef enum {
+ NAUTILUS_LOCATION_CHANGE_STANDARD,
+ NAUTILUS_LOCATION_CHANGE_BACK,
+ NAUTILUS_LOCATION_CHANGE_FORWARD,
+ NAUTILUS_LOCATION_CHANGE_RELOAD,
+ NAUTILUS_LOCATION_CHANGE_REDIRECT,
+ NAUTILUS_LOCATION_CHANGE_FALLBACK
+} NautilusLocationChangeType;
+
+struct NautilusWindowSlotClass {
+ GObjectClass parent_class;
+
+ void (* active) (NautilusWindowSlot *slot);
+ void (* inactive) (NautilusWindowSlot *slot);
+};
+
+/* Each NautilusWindowSlot corresponds to
+ * a location in the window for displaying
+ * a NautilusView.
+ *
+ * For navigation windows, this would be a
+ * tab, while spatial windows only have one slot.
+ */
+struct NautilusWindowSlot {
+ GObject parent;
+
+ NautilusWindow *window;
+
+ /* content_box contains
+ * 1) an event box containing extra_location_widgets
+ * 2) the view box for the content view
+ */
+ GtkWidget *content_box;
+ GtkWidget *extra_location_widgets;
+ GtkWidget *view_box;
+
+ NautilusView *content_view;
+ NautilusView *new_content_view;
+
+ /* Information about bookmarks */
+ NautilusBookmark *current_location_bookmark;
+ NautilusBookmark *last_location_bookmark;
+
+ /* Current location. */
+ GFile *location;
+ char *title;
+ char *status_text;
+
+ NautilusFile *viewed_file;
+ gboolean viewed_file_seen;
+ gboolean viewed_file_in_trash;
+
+ gboolean allow_stop;
+
+ gboolean search_mode;
+
+ /* New location. */
+ NautilusLocationChangeType location_change_type;
+ guint location_change_distance;
+ GFile *pending_location;
+ char *pending_scroll_to;
+ GList *pending_selection;
+ NautilusFile *determine_view_file;
+ GCancellable *mount_cancellable;
+ GError *mount_error;
+ gboolean tried_mount;
+
+ GCancellable *find_mount_cancellable;
+};
+
+GType nautilus_window_slot_get_type (void);
+
+char * nautilus_window_slot_get_title (NautilusWindowSlot *slot);
+void nautilus_window_slot_update_title (NautilusWindowSlot *slot);
+void nautilus_window_slot_update_icon (NautilusWindowSlot *slot);
+
+GFile * nautilus_window_slot_get_location (NautilusWindowSlot *slot);
+char * nautilus_window_slot_get_location_uri (NautilusWindowSlot *slot);
+
+void nautilus_window_slot_close (NautilusWindowSlot *slot);
+void nautilus_window_slot_reload (NautilusWindowSlot *slot);
+
+void nautilus_window_slot_set_content_view_widget (NautilusWindowSlot *slot,
+ NautilusView *content_view);
+void nautilus_window_slot_set_viewed_file (NautilusWindowSlot *slot,
+ NautilusFile *file);
+void nautilus_window_slot_set_allow_stop (NautilusWindowSlot *slot,
+ gboolean allow_stop);
+void nautilus_window_slot_set_status (NautilusWindowSlot *slot,
+ const char *status);
+
+void nautilus_window_slot_add_extra_location_widget (NautilusWindowSlot *slot,
+ GtkWidget *widget);
+void nautilus_window_slot_remove_extra_location_widgets (NautilusWindowSlot *slot);
+
+#endif /* NAUTILUS_WINDOW_SLOT_H */
Modified: branches/multiview/src/nautilus-window-toolbars.c
==============================================================================
--- branches/multiview/src/nautilus-window-toolbars.c (original)
+++ branches/multiview/src/nautilus-window-toolbars.c Thu Mar 20 23:38:01 2008
@@ -137,6 +137,7 @@
static GList *
get_extension_toolbar_items (NautilusNavigationWindow *window)
{
+ NautilusWindowSlot *slot;
GList *items;
GList *providers;
GList *l;
@@ -144,6 +145,8 @@
providers = nautilus_module_get_extensions_for_type (NAUTILUS_TYPE_MENU_PROVIDER);
items = NULL;
+ slot = NAUTILUS_WINDOW (window)->details->active_slot;
+
for (l = providers; l != NULL; l = l->next) {
NautilusMenuProvider *provider;
GList *file_items;
@@ -152,7 +155,7 @@
file_items = nautilus_menu_provider_get_toolbar_items
(provider,
GTK_WIDGET (window),
- NAUTILUS_WINDOW (window)->details->viewed_file);
+ slot->viewed_file);
items = g_list_concat (items, file_items);
}
Modified: branches/multiview/src/nautilus-window.c
==============================================================================
--- branches/multiview/src/nautilus-window.c (original)
+++ branches/multiview/src/nautilus-window.c Thu Mar 20 23:38:01 2008
@@ -109,7 +109,7 @@
char *id;
} ActivateViewData;
-static void cancel_view_as_callback (NautilusWindow *window);
+static void cancel_view_as_callback (NautilusWindowSlot *slot);
static void nautilus_window_info_iface_init (NautilusWindowInfoIface *iface);
static void action_view_as_callback (GtkAction *action,
ActivateViewData *data);
@@ -192,8 +192,6 @@
/* Keep the main event loop alive as long as the window exists */
nautilus_main_event_loop_register (GTK_OBJECT (window));
-
- nautilus_window_allow_stop (window, FALSE);
}
/* Unconditionally synchronize the GtkUIManager of WINDOW. */
@@ -217,11 +215,10 @@
return FALSE;
}
-void
-nautilus_window_set_status (NautilusWindow *window, const char *text)
+static void
+nautilus_window_push_status (NautilusWindow *window,
+ const char *text)
{
- g_return_if_fail (NAUTILUS_IS_WINDOW (window));
-
if (text != NULL && text[0] != '\0') {
gtk_statusbar_push (GTK_STATUSBAR (window->details->statusbar), 0, text);
} else {
@@ -230,11 +227,20 @@
}
void
+nautilus_window_sync_status (NautilusWindow *window)
+{
+ NautilusWindowSlot *slot;
+
+ slot = window->details->active_slot;
+ nautilus_window_push_status (window, slot->status_text);
+}
+
+void
nautilus_window_go_to (NautilusWindow *window, GFile *location)
{
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
- nautilus_window_open_location (window, location, FALSE);
+ nautilus_window_slot_open_location (window->details->active_slot, location, FALSE);
}
@@ -243,7 +249,7 @@
{
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
- nautilus_window_open_location_with_selection (window, location, new_selection, FALSE);
+ nautilus_window_slot_open_location_with_selection (window->details->active_slot, location, new_selection, FALSE);
}
static gboolean
@@ -256,24 +262,27 @@
void
nautilus_window_go_up (NautilusWindow *window, gboolean close_behind)
{
+ NautilusWindowSlot *slot;
GFile *parent;
GList *selection;
- g_return_if_fail (NAUTILUS_IS_WINDOW (window));
+ g_assert (NAUTILUS_IS_WINDOW (window));
+
+ slot = window->details->active_slot;
- if (window->details->location == NULL) {
+ if (slot->location == NULL) {
return;
}
- parent = g_file_get_parent (window->details->location);
+ parent = g_file_get_parent (slot->location);
if (parent == NULL) {
return;
}
- selection = g_list_prepend (NULL, g_object_ref (window->details->location));
+ selection = g_list_prepend (NULL, g_object_ref (slot->location));
- nautilus_window_open_location_with_selection (window, parent, selection, close_behind);
+ nautilus_window_slot_open_location_with_selection (slot, parent, selection, close_behind);
g_object_unref (parent);
@@ -308,9 +317,12 @@
static void
update_cursor (NautilusWindow *window)
{
+ NautilusWindowSlot *slot;
GdkCursor *cursor;
- if (window->details->allow_stop) {
+ slot = window->details->active_slot;
+
+ if (slot->allow_stop) {
cursor = gdk_cursor_new (GDK_WATCH);
gdk_window_set_cursor (GTK_WIDGET (window)->window, cursor);
gdk_cursor_unref (cursor);
@@ -320,26 +332,66 @@
}
void
-nautilus_window_allow_stop (NautilusWindow *window, gboolean allow)
+nautilus_window_sync_allow_stop (NautilusWindow *window)
{
+ NautilusWindowSlot *slot;
GtkAction *action;
-
- g_return_if_fail (NAUTILUS_IS_WINDOW (window));
+ gboolean allow_stop;
+
+ g_assert (NAUTILUS_IS_WINDOW (window));
+
+ slot = window->details->active_slot;
+ if (slot == NULL) {
+ return;
+ }
action = gtk_action_group_get_action (window->details->main_action_group,
NAUTILUS_ACTION_STOP);
- gtk_action_set_sensitive (action, allow);
+ allow_stop = gtk_action_get_sensitive (action);
- if (window->details->allow_stop != allow) {
- window->details->allow_stop = allow;
+ if (allow_stop != slot->allow_stop) {
+ gtk_action_set_sensitive (action, slot->allow_stop);
if (GTK_WIDGET_REALIZED (GTK_WIDGET (window))) {
update_cursor (window);
}
+
+ EEL_CALL_METHOD (NAUTILUS_WINDOW_CLASS, window,
+ set_throbber_active, (window, slot->allow_stop));
+ }
+}
+
+void
+nautilus_window_slot_set_allow_stop (NautilusWindowSlot *slot,
+ gboolean allow)
+{
+ NautilusWindow *window;
+
+ g_assert (NAUTILUS_IS_WINDOW_SLOT (slot));
+
+ slot->allow_stop = allow;
+
+ window = NAUTILUS_WINDOW (slot->window);
+ if (slot == window->details->active_slot) {
+ nautilus_window_sync_allow_stop (window);
+ }
+}
+
+void
+nautilus_window_slot_set_status (NautilusWindowSlot *slot,
+ const char *status)
+{
+ NautilusWindow *window;
+
+ g_assert (NAUTILUS_IS_WINDOW_SLOT (slot));
+
+ g_free (slot->status_text);
+ slot->status_text = g_strdup (status);
+
+ window = NAUTILUS_WINDOW (slot->window);
+ if (slot == window->details->active_slot) {
+ nautilus_window_sync_status (window);
}
-
- EEL_CALL_METHOD (NAUTILUS_WINDOW_CLASS, window,
- set_throbber_active, (window, allow));
}
void
@@ -357,12 +409,15 @@
void
nautilus_window_go_home (NautilusWindow *window)
{
+ NautilusWindowSlot *slot;
GFile *home;
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
+ slot = window->details->active_slot;
+
home = g_file_new_for_path (g_get_home_dir ());
- nautilus_window_open_location (window, home, FALSE);
+ nautilus_window_slot_open_location (slot, home, FALSE);
g_object_unref (home);
}
@@ -376,24 +431,17 @@
prompt_for_location, (window, initial));
}
-char *
+static char *
nautilus_window_get_location_uri (NautilusWindow *window)
{
- g_return_val_if_fail (NAUTILUS_IS_WINDOW (window), NULL);
+ NautilusWindowSlot *slot;
- if (window->details->location) {
- return g_file_get_uri (window->details->location);
- }
- return NULL;
-}
+ g_assert (NAUTILUS_IS_WINDOW (window));
-GFile *
-nautilus_window_get_location (NautilusWindow *window)
-{
- g_return_val_if_fail (NAUTILUS_IS_WINDOW (window), NULL);
+ slot = window->details->active_slot;
- if (window->details->location != NULL) {
- return g_object_ref (window->details->location);
+ if (slot->location) {
+ return g_file_get_uri (slot->location);
}
return NULL;
}
@@ -403,9 +451,12 @@
gboolean search_mode,
NautilusSearchDirectory *search_directory)
{
+ NautilusWindowSlot *slot;
+
g_assert (NAUTILUS_IS_WINDOW (window));
- window->details->search_mode = search_mode;
+ slot = window->details->active_slot;
+ slot->search_mode = search_mode;
EEL_CALL_METHOD (NAUTILUS_WINDOW_CLASS, window,
set_search_mode, (window, search_mode, search_directory));
@@ -415,10 +466,13 @@
void
nautilus_window_zoom_in (NautilusWindow *window)
{
- g_return_if_fail (NAUTILUS_IS_WINDOW (window));
+ NautilusWindowSlot *slot;
- if (window->content_view != NULL) {
- nautilus_view_bump_zoom_level (window->content_view, 1);
+ g_assert (window != NULL);
+
+ slot = window->details->active_slot;
+ if (slot->content_view != NULL) {
+ nautilus_view_bump_zoom_level (slot->content_view, 1);
}
}
@@ -426,28 +480,39 @@
nautilus_window_zoom_to_level (NautilusWindow *window,
NautilusZoomLevel level)
{
- if (window->content_view != NULL) {
- nautilus_view_zoom_to_level (window->content_view, level);
+ NautilusWindowSlot *slot;
+
+ g_assert (window != NULL);
+
+ slot = window->details->active_slot;
+ if (slot->content_view != NULL) {
+ nautilus_view_zoom_to_level (slot->content_view, level);
}
}
void
nautilus_window_zoom_out (NautilusWindow *window)
{
- g_return_if_fail (NAUTILUS_IS_WINDOW (window));
+ NautilusWindowSlot *slot;
- if (window->content_view != NULL) {
- nautilus_view_bump_zoom_level (window->content_view, -1);
+ g_assert (window != NULL);
+
+ slot = window->details->active_slot;
+ if (slot->content_view != NULL) {
+ nautilus_view_bump_zoom_level (slot->content_view, -1);
}
}
void
nautilus_window_zoom_to_default (NautilusWindow *window)
{
- g_return_if_fail (NAUTILUS_IS_WINDOW (window));
+ NautilusWindowSlot *slot;
- if (window->content_view != NULL) {
- nautilus_view_restore_default_zoom_level (window->content_view);
+ g_assert (window != NULL);
+
+ slot = window->details->active_slot;
+ if (slot->content_view != NULL) {
+ nautilus_view_restore_default_zoom_level (slot->content_view);
}
}
@@ -579,24 +644,31 @@
nautilus_window_destroy (GtkObject *object)
{
NautilusWindow *window;
+ NautilusWindowSlot *slot;
GtkWidget *widget;
+ GList *l;
window = NAUTILUS_WINDOW (object);
- cancel_view_as_callback (window);
-
+
nautilus_window_manage_views_destroy (window);
- if (window->content_view) {
- g_object_unref (window->content_view);
- window->content_view = NULL;
- }
+ for (l = window->details->slots; l != NULL; l = l->next) {
+ slot = l->data;
- if (window->new_content_view) {
- widget = nautilus_view_get_widget (window->new_content_view);
- gtk_widget_destroy (widget);
- g_object_unref (window->new_content_view);
- window->new_content_view = NULL;
+ cancel_view_as_callback (slot);
+
+ if (slot->content_view) {
+ g_object_unref (slot->content_view);
+ slot->content_view = NULL;
+ }
+
+ if (slot->new_content_view) {
+ widget = nautilus_view_get_widget (slot->new_content_view);
+ gtk_widget_destroy (widget);
+ g_object_unref (slot->new_content_view);
+ slot->new_content_view = NULL;
+ }
}
GTK_OBJECT_CLASS (nautilus_window_parent_class)->destroy (object);
@@ -606,6 +678,8 @@
nautilus_window_finalize (GObject *object)
{
NautilusWindow *window;
+ NautilusWindowSlot *slot;
+ GList *l;
window = NAUTILUS_WINDOW (object);
@@ -613,37 +687,16 @@
nautilus_window_manage_views_finalize (window);
- nautilus_window_set_viewed_file (window, NULL);
-
- nautilus_file_unref (window->details->viewed_file);
-
free_stored_viewers (window);
- if (window->details->location) {
- g_object_ref (window->details->location);
+ for (l = window->details->slots; l != NULL; l = l->next) {
+ slot = NAUTILUS_WINDOW_SLOT (l->data);
+ g_object_unref (G_OBJECT (slot));
}
- eel_g_list_free_deep (window->details->pending_selection);
- if (window->current_location_bookmark != NULL) {
- g_object_unref (window->current_location_bookmark);
- }
- if (window->last_location_bookmark != NULL) {
- g_object_unref (window->last_location_bookmark);
- }
g_object_unref (window->details->ui_manager);
- if (window->details->location_change_at_idle_id != 0) {
- g_source_remove (window->details->location_change_at_idle_id);
- }
-
- g_free (window->details->title);
-
- if (window->details->find_mount_cancellable != NULL) {
- g_cancellable_cancel (window->details->find_mount_cancellable);
- window->details->find_mount_cancellable = NULL;
- }
-
G_OBJECT_CLASS (nautilus_window_parent_class)->finalize (object);
}
@@ -661,6 +714,10 @@
window = NAUTILUS_WINDOW (object);
+ NautilusWindowSlot *slot;
+ slot = nautilus_window_open_slot (window);
+ nautilus_window_set_active_slot (window, slot);
+
nautilus_window_initialize_menus_constructed (window);
return object;
@@ -669,19 +726,28 @@
void
nautilus_window_show_window (NautilusWindow *window)
{
+ NautilusWindowSlot *slot;
+ GList *l;
+
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
EEL_CALL_METHOD (NAUTILUS_WINDOW_CLASS, window,
show_window, (window));
- nautilus_window_update_title (window);
- nautilus_window_update_icon (window);
+ for (l = window->details->slots; l != NULL; l = l->next) {
+ slot = l->data;
+
+ nautilus_window_slot_update_title (slot);
+ nautilus_window_slot_update_icon (slot);
+ }
gtk_widget_show (GTK_WIDGET (window));
- if (window->details->viewed_file) {
+ slot = window->details->active_slot;
+
+ if (slot->viewed_file) {
if (NAUTILUS_IS_SPATIAL_WINDOW (window)) {
- nautilus_file_set_has_open_window (window->details->viewed_file, TRUE);
+ nautilus_file_set_has_open_window (slot->viewed_file, TRUE);
}
}
}
@@ -697,6 +763,106 @@
gtk_widget_destroy (GTK_WIDGET (window));
}
+NautilusWindowSlot *
+nautilus_window_open_slot (NautilusWindow *window)
+{
+ NautilusWindowSlot *slot;
+
+ g_assert (NAUTILUS_IS_WINDOW (window));
+
+ slot = EEL_CALL_METHOD_WITH_RETURN_VALUE (NAUTILUS_WINDOW_CLASS, window,
+ open_slot, (window));
+
+ g_assert (NAUTILUS_IS_WINDOW_SLOT (slot));
+ g_assert (window == slot->window);
+
+ window->details->slots = g_list_append (window->details->slots, slot);
+
+ return slot;
+}
+
+void
+nautilus_window_close_slot (NautilusWindow *window,
+ NautilusWindowSlot *slot)
+{
+ g_assert (NAUTILUS_IS_WINDOW (window));
+ g_assert (NAUTILUS_IS_WINDOW_SLOT (slot));
+ g_assert (window == slot->window);
+ g_assert (g_list_find (window->details->slots, slot) != NULL);
+
+ EEL_CALL_METHOD (NAUTILUS_WINDOW_CLASS, window,
+ close_slot, (window, slot));
+
+ window->details->slots = g_list_remove (window->details->slots, slot);
+ nautilus_window_slot_set_allow_stop (slot, FALSE);
+}
+
+void
+nautilus_window_set_active_slot (NautilusWindow *window,
+ NautilusWindowSlot *new_slot)
+{
+ NautilusWindowSlot *old_slot;
+
+ g_assert (NAUTILUS_IS_WINDOW (window));
+ g_assert (NAUTILUS_IS_WINDOW_SLOT (new_slot));
+ g_assert (window == new_slot->window);
+
+ g_assert (g_list_find (window->details->slots, new_slot) != NULL);
+
+ old_slot = window->details->active_slot;
+
+ if (old_slot == new_slot) {
+ return;
+ }
+
+ if (old_slot != NULL) {
+ /* inform window */
+ if (old_slot->content_view != NULL) {
+ nautilus_window_disconnect_content_view (window, old_slot->content_view);
+ }
+
+ /* inform slot & view */
+ g_signal_emit_by_name (old_slot, "inactive");
+ }
+
+ window->details->active_slot = new_slot;
+
+ /* inform sidebar panels */
+ nautilus_window_report_location_change (window, TRUE);
+ /* TODO decide whether "selection-changed" should be emitted */
+
+ if (new_slot->content_view != NULL) {
+ /* inform window */
+ nautilus_window_connect_content_view (window, new_slot->content_view);
+ }
+
+ /* inform slot & view */
+ g_signal_emit_by_name (new_slot, "active");
+}
+
+void
+nautilus_window_slot_close (NautilusWindowSlot *slot)
+{
+ NautilusWindow *window;
+
+ window = slot->window;
+
+ if (g_list_length (window->details->slots) > 1) {
+ EEL_CALL_METHOD (NAUTILUS_WINDOW_CLASS, window,
+ close_slot, (window, slot));
+ g_object_unref (slot);
+ } else {
+ /* no slot_closed will be emitted for the last slot.
+ * All the NautilusWindowInfo clients life inside the window, so they
+ * will be destroyed anyway.
+ *
+ * This is just for convenience, because otherwise we'd have to handle
+ * windows without any active slot.
+ */
+ nautilus_window_close (window);
+ }
+}
+
static void
nautilus_window_size_request (GtkWidget *widget,
GtkRequisition *requisition)
@@ -799,9 +965,15 @@
action_view_as_callback (GtkAction *action,
ActivateViewData *data)
{
+ NautilusWindow *window;
+ NautilusWindowSlot *slot;
+
+ window = data->window;
+
if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
- nautilus_window_set_content_view (data->window,
- data->id);
+ slot = window->details->active_slot;
+ nautilus_window_slot_set_content_view (slot,
+ data->id);
}
}
@@ -929,9 +1101,12 @@
static void
replace_extra_viewer_in_view_as_menus (NautilusWindow *window)
{
+ NautilusWindowSlot *slot;
const char *id;
- id = nautilus_window_get_content_view_id (window);
+ slot = window->details->active_slot;
+
+ id = nautilus_window_slot_get_content_view_id (slot);
update_extra_viewer_in_view_as_menus (window, id);
}
@@ -947,6 +1122,7 @@
static void
nautilus_window_synch_view_as_menus (NautilusWindow *window)
{
+ NautilusWindowSlot *slot;
int index;
char action_name[32];
GList *node;
@@ -954,13 +1130,15 @@
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
- if (window->content_view == NULL) {
+ slot = window->details->active_slot;
+
+ if (slot->content_view == NULL) {
return;
}
for (node = window->details->short_list_viewers, index = 1;
node != NULL;
node = node->next, ++index) {
- if (nautilus_window_content_view_matches_iid (window, (char *)node->data)) {
+ if (nautilus_window_slot_content_view_matches_iid (slot, (char *)node->data)) {
break;
}
}
@@ -994,13 +1172,16 @@
static void
refresh_stored_viewers (NautilusWindow *window)
{
+ NautilusWindowSlot *slot;
GList *viewers;
char *uri, *mimetype;
- uri = nautilus_file_get_uri (window->details->viewed_file);
- mimetype = nautilus_file_get_mime_type (window->details->viewed_file);
+ slot = window->details->active_slot;
+
+ uri = nautilus_file_get_uri (slot->viewed_file);
+ mimetype = nautilus_file_get_mime_type (slot->viewed_file);
viewers = nautilus_view_factory_get_views_for_uri (uri,
- nautilus_file_get_file_type (window->details->viewed_file),
+ nautilus_file_get_file_type (slot->viewed_file),
mimetype);
g_free (uri);
g_free (mimetype);
@@ -1012,9 +1193,12 @@
static void
real_load_view_as_menu (NautilusWindow *window)
{
+ NautilusWindowSlot *slot;
GList *node;
int index;
guint merge_id;
+
+ slot = window->details->active_slot;
if (window->details->short_list_merge_id != 0) {
gtk_ui_manager_remove_ui (window->details->ui_manager,
@@ -1033,8 +1217,6 @@
window->details->view_as_action_group = NULL;
}
- g_free (window->details->extra_viewer);
- window->details->extra_viewer = NULL;
refresh_stored_viewers (window);
@@ -1069,35 +1251,40 @@
gpointer callback_data)
{
NautilusWindow *window;
-
- window = NAUTILUS_WINDOW (callback_data);
+ NautilusWindowSlot *slot;
+
+ slot = callback_data;
+ window = NAUTILUS_WINDOW (slot->window);
EEL_CALL_METHOD (NAUTILUS_WINDOW_CLASS, window,
load_view_as_menu, (window));
}
static void
-cancel_view_as_callback (NautilusWindow *window)
+cancel_view_as_callback (NautilusWindowSlot *slot)
{
- nautilus_file_cancel_call_when_ready (window->details->viewed_file,
+ nautilus_file_cancel_call_when_ready (slot->viewed_file,
load_view_as_menus_callback,
- window);
+ slot);
}
void
nautilus_window_load_view_as_menus (NautilusWindow *window)
{
+ NautilusWindowSlot *slot;
NautilusFileAttributes attributes;
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
attributes = nautilus_mime_actions_get_required_file_attributes ();
- cancel_view_as_callback (window);
- nautilus_file_call_when_ready (window->details->viewed_file,
+ slot = window->details->active_slot;
+
+ cancel_view_as_callback (slot);
+ nautilus_file_call_when_ready (slot->viewed_file,
attributes,
load_view_as_menus_callback,
- window);
+ slot);
}
void
@@ -1115,189 +1302,131 @@
static char *
real_get_title (NautilusWindow *window)
{
- char *title;
-
- title = NULL;
-
- if (window->new_content_view != NULL) {
- title = nautilus_view_get_title (window->new_content_view);
- } else if (window->content_view != NULL) {
- title = nautilus_view_get_title (window->content_view);
- }
-
- if (title == NULL) {
- title = nautilus_compute_title_for_location (window->details->location);
- }
-
- return title;
-}
-
-static char *
-nautilus_window_get_cached_title (NautilusWindow *window)
-{
- return g_strdup (window->details->title);
-}
+ g_assert (NAUTILUS_IS_WINDOW (window));
-static char *
-nautilus_window_get_title (NautilusWindow *window)
-{
- return EEL_CALL_METHOD_WITH_RETURN_VALUE (NAUTILUS_WINDOW_CLASS, window,
- get_title, (window));
+ return nautilus_window_slot_get_title (window->details->active_slot);
}
-static gboolean
+static void
real_set_title (NautilusWindow *window,
const char *title)
{
- gboolean changed;
+ NautilusWindowSlot *slot;
char *copy;
- changed = FALSE;
+ slot = window->details->active_slot;
- if (eel_strcmp (title, window->details->title) != 0) {
- changed = TRUE;
+ copy = g_strdup (slot->title);
+ g_signal_emit_by_name (window, "title_changed",
+ slot->title);
+ g_free (copy);
+}
- g_free (window->details->title);
- window->details->title = g_strdup (title);
- }
+void
+nautilus_window_sync_title (NautilusWindow *window)
+{
+ NautilusWindowSlot *slot;
- if (eel_strlen (window->details->title) > 0 && window->current_location_bookmark &&
- nautilus_bookmark_set_name (window->current_location_bookmark, window->details->title)) {
- changed = TRUE;
+ slot = window->details->active_slot;
- /* Name of item in history list changed, tell listeners. */
- nautilus_send_history_list_changed ();
- }
+ EEL_CALL_METHOD (NAUTILUS_WINDOW_CLASS, window,
+ set_title, (window, slot->title));
+}
+
+static void
+real_connect_content_view (NautilusWindow *window,
+ NautilusView *view)
+{
+ NautilusWindowSlot *slot;
+
+ slot = window->details->active_slot;
- if (changed) {
- copy = g_strdup (window->details->title);
- g_signal_emit_by_name (window, "title_changed",
- copy);
- g_free (copy);
+ /* Update displayed view in menu. Only do this if we're not switching
+ * locations though, because if we are switching locations we'll
+ * install a whole new set of views in the menu later (the current
+ * views in the menu are for the old location).
+ */
+ if (slot->pending_location == NULL) {
+ nautilus_window_synch_view_as_menus (window);
}
- return changed;
+ nautilus_view_grab_focus (view);
}
-/* Sets window->details->title, and the actual GtkWindow title which
- * might look a bit different (e.g. with "file browser:" added) */
static void
-nautilus_window_set_title (NautilusWindow *window,
- const char *title)
+real_disconnect_content_view (NautilusWindow *window,
+ NautilusView *view)
{
- g_return_if_fail (NAUTILUS_IS_WINDOW (window));
-
- EEL_CALL_METHOD (NAUTILUS_WINDOW_CLASS, window,
- set_title, (window, title));
+ g_assert (NAUTILUS_IS_WINDOW (window));
+ g_assert (NAUTILUS_IS_VIEW (view));
+ /* nothing to do... */
}
-/* update_title:
- *
- * Re-calculate the window title.
- * Called when the location or view has changed.
- * @window: The NautilusWindow in question.
- *
- */
void
-nautilus_window_update_title (NautilusWindow *window)
+nautilus_window_connect_content_view (NautilusWindow *window,
+ NautilusView *view)
{
- char *title;
+ g_assert (NAUTILUS_IS_WINDOW (window));
+ g_assert (NAUTILUS_IS_VIEW (view));
- g_return_if_fail (NAUTILUS_IS_WINDOW (window));
-
- title = nautilus_window_get_title (window);
- nautilus_window_set_title (window, title);
-
- g_free (title);
+ EEL_CALL_METHOD (NAUTILUS_WINDOW_CLASS, window,
+ connect_content_view, (window, view));
}
-/* nautilus_window_update_icon:
- *
- * Re-calculate the window icon
- * Called when the location or view or icon set has changed.
- * @window: The NautilusWindow in question.
- *
- */
void
-nautilus_window_update_icon (NautilusWindow *window)
+nautilus_window_disconnect_content_view (NautilusWindow *window,
+ NautilusView *view)
{
- NautilusIconInfo *info;
- const char *icon_name;
- GdkPixbuf *pixbuf;
-
- g_return_if_fail (NAUTILUS_IS_WINDOW (window));
-
- info = EEL_CALL_METHOD_WITH_RETURN_VALUE (NAUTILUS_WINDOW_CLASS, window,
- get_icon, (window));
+ g_assert (NAUTILUS_IS_WINDOW (window));
+ g_assert (NAUTILUS_IS_VIEW (view));
- icon_name = NULL;
- if (info) {
- icon_name = nautilus_icon_info_get_used_name (info);
- if (icon_name != NULL) {
- gtk_window_set_icon_name (GTK_WINDOW (window), icon_name);
- } else {
- pixbuf = nautilus_icon_info_get_pixbuf_nodefault (info);
-
- if (pixbuf) {
- gtk_window_set_icon (GTK_WINDOW (window), pixbuf);
- g_object_unref (pixbuf);
- }
- }
-
- g_object_unref (info);
- }
+ EEL_CALL_METHOD (NAUTILUS_WINDOW_CLASS, window,
+ disconnect_content_view, (window, view));
}
-static void
-real_set_content_view_widget (NautilusWindow *window,
- NautilusView *new_view)
+void
+nautilus_window_slot_set_content_view_widget (NautilusWindowSlot *slot,
+ NautilusView *new_view)
{
+ NautilusWindow *window;
GtkWidget *widget;
-
+ gboolean inform_window;
+
+ window = slot->window;
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
- g_return_if_fail (new_view == NULL || NAUTILUS_IS_VIEW (new_view));
-
- if (new_view == window->content_view) {
- return;
- }
-
- if (window->content_view != NULL) {
- widget = nautilus_view_get_widget (window->content_view);
+
+ inform_window = slot == window->details->active_slot;
+
+ if (slot->content_view != NULL) {
+ /* disconnect old view */
+ if (inform_window) {
+ nautilus_window_disconnect_content_view (window, slot->content_view);
+ }
+
+ widget = nautilus_view_get_widget (slot->content_view);
gtk_widget_destroy (widget);
- g_object_unref (window->content_view);
- window->content_view = NULL;
+ g_object_unref (slot->content_view);
+ slot->content_view = NULL;
}
if (new_view != NULL) {
widget = nautilus_view_get_widget (new_view);
+ gtk_container_add (GTK_CONTAINER (slot->view_box),
+ GTK_WIDGET (new_view));
+
gtk_widget_show (widget);
- }
- window->content_view = new_view;
- g_object_ref (window->content_view);
+ slot->content_view = new_view;
+ g_object_ref (slot->content_view);
- /* Update displayed view in menu. Only do this if we're not switching
- * locations though, because if we are switching locations we'll
- * install a whole new set of views in the menu later (the current
- * views in the menu are for the old location).
- */
- if (window->details->pending_location == NULL) {
- nautilus_window_synch_view_as_menus (window);
+ /* connect new view */
+ if (inform_window) {
+ nautilus_window_connect_content_view (window, new_view);
+ }
}
-}
-
-void
-nautilus_window_set_content_view_widget (NautilusWindow *window,
- NautilusView *frame)
-{
- g_return_if_fail (NAUTILUS_IS_WINDOW (window));
-
- EEL_CALL_METHOD (NAUTILUS_WINDOW_CLASS, window,
- set_content_view_widget, (window, frame));
- nautilus_view_grab_focus (frame);
}
/**
@@ -1328,37 +1457,40 @@
}
void
-nautilus_window_set_viewed_file (NautilusWindow *window,
- NautilusFile *file)
+nautilus_window_slot_set_viewed_file (NautilusWindowSlot *slot,
+ NautilusFile *file)
{
+ NautilusWindow *window;
NautilusFileAttributes attributes;
- if (window->details->viewed_file == file) {
+ window = slot->window;
+
+ if (slot->viewed_file == file) {
return;
}
nautilus_file_ref (file);
- cancel_view_as_callback (window);
+ cancel_view_as_callback (slot);
- if (window->details->viewed_file != NULL) {
+ if (slot->viewed_file != NULL) {
if (NAUTILUS_IS_SPATIAL_WINDOW (window)) {
- nautilus_file_set_has_open_window (window->details->viewed_file,
+ nautilus_file_set_has_open_window (slot->viewed_file,
FALSE);
}
- nautilus_file_monitor_remove (window->details->viewed_file,
- window);
+ nautilus_file_monitor_remove (slot->viewed_file,
+ slot);
}
if (file != NULL) {
attributes =
NAUTILUS_FILE_ATTRIBUTE_INFO |
NAUTILUS_FILE_ATTRIBUTE_LINK_INFO;
- nautilus_file_monitor_add (file, window, attributes);
+ nautilus_file_monitor_add (file, slot, attributes);
}
- nautilus_file_unref (window->details->viewed_file);
- window->details->viewed_file = file;
+ nautilus_file_unref (slot->viewed_file);
+ slot->viewed_file = file;
}
void
@@ -1472,13 +1604,44 @@
static void
real_add_current_location_to_history_list (NautilusWindow *window)
{
+ NautilusWindowSlot *slot;
+
g_assert (NAUTILUS_IS_WINDOW (window));
+
+ slot = window->details->active_slot;
- if (add_to_history_list (window->current_location_bookmark)) {
+ if (add_to_history_list (slot->current_location_bookmark)) {
nautilus_send_history_list_changed ();
}
}
+#if 0
+static void
+real_add_slot (NautilusWindow *window,
+ NautilusWindowSlot *slot)
+{
+ window->details->slots =
+}
+#endif
+
+NautilusWindowSlot *
+nautilus_window_get_slot_for_view (NautilusWindow *window,
+ NautilusView *view)
+{
+ NautilusWindowSlot *slot;
+ GList *l;
+
+ for (l = window->details->slots; l != NULL; l = l->next) {
+ slot = l->data;
+ if (slot->content_view == view ||
+ slot->new_content_view == view) {
+ return slot;
+ }
+ }
+
+ return NULL;
+}
+
void
nautilus_window_add_current_location_to_history_list (NautilusWindow *window)
{
@@ -1491,7 +1654,8 @@
void
nautilus_forget_history (void)
{
- GList *window_node;
+ NautilusWindowSlot *slot;
+ GList *window_node, *l;
/* Clear out each window's back & forward lists. Also, remove
* each window's current location bookmark from history list
@@ -1512,8 +1676,14 @@
nautilus_navigation_window_allow_back (window, FALSE);
nautilus_navigation_window_allow_forward (window, FALSE);
}
+
+ for (l = NAUTILUS_WINDOW (window_node->data)->details->slots;
+ l != NULL; l = l->next) {
+ slot = l->data;
+ history_list = g_list_remove (history_list,
+ slot->current_location_bookmark);
+ }
- history_list = g_list_remove (history_list, NAUTILUS_WINDOW (window_node->data)->current_location_bookmark);
}
/* Clobber history list. */
@@ -1537,25 +1707,28 @@
}
static GList *
-nautilus_window_get_history (NautilusWindow *window)
+nautilus_window_get_history (NautilusWindowInfo *window)
{
return eel_g_object_list_copy (history_list);
}
-
static NautilusWindowType
nautilus_window_get_window_type (NautilusWindow *window)
{
- g_return_val_if_fail (NAUTILUS_IS_WINDOW (window), NAUTILUS_WINDOW_SPATIAL);
-
return NAUTILUS_WINDOW_GET_CLASS (window)->window_type;
}
static int
nautilus_window_get_selection_count (NautilusWindow *window)
{
- if (window->content_view != NULL) {
- return nautilus_view_get_selection_count (window->content_view);
+ NautilusWindowSlot *slot;
+
+ g_assert (NAUTILUS_IS_WINDOW (window));
+
+ slot = window->details->active_slot;
+
+ if (slot->content_view != NULL) {
+ return nautilus_view_get_selection_count (slot->content_view);
}
return 0;
}
@@ -1563,14 +1736,20 @@
static GList *
nautilus_window_get_selection (NautilusWindow *window)
{
- if (window->content_view != NULL) {
- return nautilus_view_get_selection (window->content_view);
+ NautilusWindowSlot *slot;
+
+ g_assert (NAUTILUS_IS_WINDOW (window));
+
+ slot = window->details->active_slot;
+
+ if (slot->content_view != NULL) {
+ return nautilus_view_get_selection (slot->content_view);
}
return NULL;
}
static NautilusWindowShowHiddenFilesMode
-nautilus_window_get_hidden_files_mode (NautilusWindow *window)
+nautilus_window_get_hidden_files_mode (NautilusWindowInfo *window)
{
return window->details->show_hidden_files_mode;
}
@@ -1586,11 +1765,31 @@
}
static NautilusBookmarkList *
-nautilus_window_get_bookmark_list (NautilusWindow *window)
+nautilus_window_get_bookmark_list (NautilusWindowInfo *window)
{
return nautilus_get_bookmark_list ();
}
+static char *
+nautilus_window_get_cached_title (NautilusWindow *window)
+{
+ NautilusWindowSlot *slot;
+
+ g_assert (NAUTILUS_IS_WINDOW (window));
+
+ slot = window->details->active_slot;
+
+ return g_strdup (slot->title);
+}
+
+NautilusWindowSlot *
+nautilus_window_get_active_slot (NautilusWindow *window)
+{
+ g_assert (NAUTILUS_IS_WINDOW (window));
+
+ return window->details->active_slot;
+}
+
static void
nautilus_window_info_iface_init (NautilusWindowInfoIface *iface)
{
@@ -1598,10 +1797,9 @@
iface->report_load_complete = nautilus_window_report_load_complete;
iface->report_selection_changed = nautilus_window_report_selection_changed;
iface->report_view_failed = nautilus_window_report_view_failed;
- iface->open_location = nautilus_window_open_location_full;
iface->show_window = nautilus_window_show_window;
iface->close_window = nautilus_window_close;
- iface->set_status = nautilus_window_set_status;
+ iface->push_status = nautilus_window_push_status;
iface->get_window_type = nautilus_window_get_window_type;
iface->get_title = nautilus_window_get_cached_title;
iface->get_history = nautilus_window_get_history;
@@ -1612,6 +1810,7 @@
iface->get_selection = nautilus_window_get_selection;
iface->get_hidden_files_mode = nautilus_window_get_hidden_files_mode;
iface->set_hidden_files_mode = nautilus_window_set_hidden_files_mode;
+ iface->get_active_slot = nautilus_window_get_active_slot;
}
static void
@@ -1631,7 +1830,8 @@
class->add_current_location_to_history_list = real_add_current_location_to_history_list;
class->get_title = real_get_title;
class->set_title = real_set_title;
- class->set_content_view_widget = real_set_content_view_widget;
+ class->connect_content_view = real_connect_content_view;
+ class->disconnect_content_view = real_disconnect_content_view;
class->load_view_as_menu = real_load_view_as_menu;
class->set_allow_up = real_set_allow_up;
Modified: branches/multiview/src/nautilus-window.h
==============================================================================
--- branches/multiview/src/nautilus-window.h (original)
+++ branches/multiview/src/nautilus-window.h Thu Mar 20 23:38:01 2008
@@ -51,6 +51,15 @@
typedef struct NautilusWindow NautilusWindow;
#endif
+#ifndef NAUTILUS_WINDOW_SLOT_DEFINED
+#define NAUTILUS_WINDOW_SLOT_DEFINED
+typedef struct NautilusWindowSlot NautilusWindowSlot;
+#endif
+
+typedef struct NautilusWindowSlotClass NautilusWindowSlotClass;
+
+GType nautilus_window_slot_get_type (void);
+
typedef struct {
GtkWindowClass parent_spot;
@@ -67,12 +76,22 @@
void (* add_current_location_to_history_list) (NautilusWindow *window);
char * (* get_title) (NautilusWindow *window);
- gboolean (* set_title) (NautilusWindow *window, const char *title);
- NautilusIconInfo * (* get_icon) (NautilusWindow *window);
+ void (* set_title) (NautilusWindow *window,
+ const char *title);
+ NautilusIconInfo * (* get_icon) (NautilusWindow *window,
+ NautilusWindowSlot *slot);
void (* load_view_as_menu) (NautilusWindow *window);
- void (* set_content_view_widget) (NautilusWindow *window,
+
+ /* these are called
+ * A) when switching the view within the active slot
+ * B) when switching the active slot
+ */
+ void (* connect_content_view) (NautilusWindow *window,
+ NautilusView *new_view);
+ void (* disconnect_content_view) (NautilusWindow *window,
NautilusView *new_view);
+
void (* set_throbber_active) (NautilusWindow *window,
gboolean active);
void (* set_allow_up) (NautilusWindow *window, gboolean allow);
@@ -83,6 +102,12 @@
void (* show_window) (NautilusWindow *window);
void (* close) (NautilusWindow *window);
+ NautilusWindowSlot * (* open_slot) (NautilusWindow *window);
+ void (* close_slot) (NautilusWindow *window,
+ NautilusWindowSlot *slot);
+ void (* set_active_slot) (NautilusWindow *window,
+ NautilusWindowSlot *slot);
+
/* Signals used only for keybindings */
gboolean (* go_up) (NautilusWindow *window, gboolean close);
} NautilusWindowClass;
@@ -102,25 +127,17 @@
/** CORBA-related elements **/
NautilusApplication *application;
-
- /** State information **/
-
- /* Information about current location/selection */
- NautilusBookmark *current_location_bookmark;
- NautilusBookmark *last_location_bookmark;
-
- /* Current views stuff */
- NautilusView *content_view;
-
- /* Pending changes */
- NautilusView *new_content_view;
};
GType nautilus_window_get_type (void);
void nautilus_window_show_window (NautilusWindow *window);
void nautilus_window_close (NautilusWindow *window);
-char * nautilus_window_get_location_uri (NautilusWindow *window);
-GFile * nautilus_window_get_location (NautilusWindow *window);
+
+void nautilus_window_connect_content_view (NautilusWindow *window,
+ NautilusView *view);
+void nautilus_window_disconnect_content_view (NautilusWindow *window,
+ NautilusView *view);
+
void nautilus_window_go_to (NautilusWindow *window,
GFile *location);
void nautilus_window_go_to_with_selection (NautilusWindow *window,
@@ -135,7 +152,6 @@
gboolean search_mode,
NautilusSearchDirectory *search_directory);
void nautilus_window_launch_cd_burner (NautilusWindow *window);
-void nautilus_window_update_title (NautilusWindow *window);
void nautilus_window_display_error (NautilusWindow *window,
const char *error_msg);
void nautilus_window_reload (NautilusWindow *window);
@@ -149,8 +165,6 @@
void nautilus_window_allow_burn_cd (NautilusWindow *window,
gboolean allow);
GtkUIManager * nautilus_window_get_ui_manager (NautilusWindow *window);
-void nautilus_window_add_extra_location_widget (NautilusWindow *window,
- GtkWidget *widget);
gboolean nautilus_window_has_menubar_and_statusbar (NautilusWindow *window);
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]