diff options
45 files changed, 412 insertions, 1201 deletions
diff --git a/libnautilus-private/Makefile.am b/libnautilus-private/Makefile.am index 88c628af4..fbc4338f5 100644 --- a/libnautilus-private/Makefile.am +++ b/libnautilus-private/Makefile.am @@ -171,14 +171,8 @@ libnautilus_private_la_SOURCES = \ nautilus-vfs-directory.h \ nautilus-vfs-file.c \ nautilus-vfs-file.h \ - nautilus-view-factory.c \ - nautilus-view-factory.h \ nautilus-view.c \ nautilus-view.h \ - nautilus-window-info.c \ - nautilus-window-info.h \ - nautilus-window-slot-info.c \ - nautilus-window-slot-info.h \ $(NULL) nodist_libnautilus_private_la_SOURCES =\ diff --git a/libnautilus-private/nautilus-dnd.c b/libnautilus-private/nautilus-dnd.c index 592c4387b..91e0e47c0 100644 --- a/libnautilus-private/nautilus-dnd.c +++ b/libnautilus-private/nautilus-dnd.c @@ -29,8 +29,6 @@ #include "nautilus-program-choosing.h" #include "nautilus-link.h" -#include "nautilus-window-slot-info.h" -#include "nautilus-window-info.h" #include "nautilus-view.h" #include <eel/eel-glib-extensions.h> #include <eel/eel-gtk-extensions.h> diff --git a/libnautilus-private/nautilus-dnd.h b/libnautilus-private/nautilus-dnd.h index 35e7a9ec6..0c45b8883 100644 --- a/libnautilus-private/nautilus-dnd.h +++ b/libnautilus-private/nautilus-dnd.h @@ -28,7 +28,6 @@ #define NAUTILUS_DND_H #include <gtk/gtk.h> -#include <libnautilus-private/nautilus-window-slot-info.h> /* Drag & Drop target names. */ #define NAUTILUS_ICON_DND_GNOME_ICON_LIST_TYPE "x-special/gnome-icon-list" diff --git a/libnautilus-private/nautilus-window-info.c b/libnautilus-private/nautilus-window-info.c deleted file mode 100644 index 0b5ba2e01..000000000 --- a/libnautilus-private/nautilus-window-info.c +++ /dev/null @@ -1,287 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- - - nautilus-window-info.c: Interface for nautilus window - - Copyright (C) 2004 Red Hat 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: Alexander Larsson <alexl@redhat.com> -*/ - -#include <config.h> -#include "nautilus-window-info.h" - -enum { - LOADING_URI, - SELECTION_CHANGED, - TITLE_CHANGED, - HIDDEN_FILES_MODE_CHANGED, - LAST_SIGNAL -}; - -static guint nautilus_window_info_signals[LAST_SIGNAL] = { 0 }; - -static void -nautilus_window_info_base_init (gpointer g_class) -{ - static gboolean initialized = FALSE; - - if (! initialized) { - nautilus_window_info_signals[LOADING_URI] = - g_signal_new ("loading_uri", - NAUTILUS_TYPE_WINDOW_INFO, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (NautilusWindowInfoIface, loading_uri), - NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, - G_TYPE_STRING); - - nautilus_window_info_signals[SELECTION_CHANGED] = - g_signal_new ("selection_changed", - NAUTILUS_TYPE_WINDOW_INFO, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (NautilusWindowInfoIface, selection_changed), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - nautilus_window_info_signals[TITLE_CHANGED] = - g_signal_new ("title_changed", - NAUTILUS_TYPE_WINDOW_INFO, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (NautilusWindowInfoIface, title_changed), - NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, - G_TYPE_STRING); - - nautilus_window_info_signals[HIDDEN_FILES_MODE_CHANGED] = - g_signal_new ("hidden_files_mode_changed", - NAUTILUS_TYPE_WINDOW_INFO, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (NautilusWindowInfoIface, hidden_files_mode_changed), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - initialized = TRUE; - } -} - -GType -nautilus_window_info_get_type (void) -{ - static GType type = 0; - - if (!type) { - const GTypeInfo info = { - sizeof (NautilusWindowInfoIface), - nautilus_window_info_base_init, - NULL, - NULL, - NULL, - NULL, - 0, - 0, - NULL - }; - - type = g_type_register_static (G_TYPE_INTERFACE, - "NautilusWindowInfo", - &info, 0); - g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); - } - - return type; -} - -void -nautilus_window_info_report_load_underway (NautilusWindowInfo *window, - NautilusView *view) -{ - g_return_if_fail (NAUTILUS_IS_WINDOW_INFO (window)); - g_return_if_fail (NAUTILUS_IS_VIEW (view)); - - (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->report_load_underway) (window, - view); -} - -void -nautilus_window_info_report_load_complete (NautilusWindowInfo *window, - NautilusView *view) -{ - g_return_if_fail (NAUTILUS_IS_WINDOW_INFO (window)); - g_return_if_fail (NAUTILUS_IS_VIEW (view)); - - (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->report_load_complete) (window, - view); -} - -void -nautilus_window_info_report_view_failed (NautilusWindowInfo *window, - NautilusView *view) -{ - g_return_if_fail (NAUTILUS_IS_WINDOW_INFO (window)); - g_return_if_fail (NAUTILUS_IS_VIEW (view)); - - (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->report_view_failed) (window, - view); -} - -void -nautilus_window_info_report_selection_changed (NautilusWindowInfo *window) -{ - g_return_if_fail (NAUTILUS_IS_WINDOW_INFO (window)); - - (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->report_selection_changed) (window); -} - -void -nautilus_window_info_view_visible (NautilusWindowInfo *window, - NautilusView *view) -{ - g_return_if_fail (NAUTILUS_IS_WINDOW_INFO (window)); - - (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->view_visible) (window, view); -} - -void -nautilus_window_info_close (NautilusWindowInfo *window) -{ - g_return_if_fail (NAUTILUS_IS_WINDOW_INFO (window)); - - (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->close_window) (window); -} - -void -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)->push_status) (window, - status); -} - -NautilusWindowType -nautilus_window_info_get_window_type (NautilusWindowInfo *window) -{ - g_return_val_if_fail (NAUTILUS_IS_WINDOW_INFO (window), NAUTILUS_WINDOW_SPATIAL); - - return (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->get_window_type) (window); -} - -char * -nautilus_window_info_get_title (NautilusWindowInfo *window) -{ - g_return_val_if_fail (NAUTILUS_IS_WINDOW_INFO (window), NULL); - - return (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->get_title) (window); -} - -GList * -nautilus_window_info_get_history (NautilusWindowInfo *window) -{ - g_return_val_if_fail (NAUTILUS_IS_WINDOW_INFO (window), NULL); - - return (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->get_history) (window); -} - -char * -nautilus_window_info_get_current_location (NautilusWindowInfo *window) -{ - g_return_val_if_fail (NAUTILUS_IS_WINDOW_INFO (window), NULL); - - return (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->get_current_location) (window); -} - -int -nautilus_window_info_get_selection_count (NautilusWindowInfo *window) -{ - g_return_val_if_fail (NAUTILUS_IS_WINDOW_INFO (window), 0); - - return (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->get_selection_count) (window); -} - -GList * -nautilus_window_info_get_selection (NautilusWindowInfo *window) -{ - g_return_val_if_fail (NAUTILUS_IS_WINDOW_INFO (window), NULL); - - return (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->get_selection) (window); -} - -NautilusWindowShowHiddenFilesMode -nautilus_window_info_get_hidden_files_mode (NautilusWindowInfo *window) -{ - g_return_val_if_fail (NAUTILUS_IS_WINDOW_INFO (window), NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT); - - return (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->get_hidden_files_mode) (window); -} - -void -nautilus_window_info_set_hidden_files_mode (NautilusWindowInfo *window, - NautilusWindowShowHiddenFilesMode mode) -{ - g_return_if_fail (NAUTILUS_IS_WINDOW_INFO (window)); - - (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->set_hidden_files_mode) (window, - mode); -} - -GtkUIManager * -nautilus_window_info_get_ui_manager (NautilusWindowInfo *window) -{ - g_return_val_if_fail (NAUTILUS_IS_WINDOW_INFO (window), NULL); - - 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); -} - -NautilusWindowSlotInfo * -nautilus_window_info_get_extra_slot (NautilusWindowInfo *window) -{ - g_return_val_if_fail (NAUTILUS_IS_WINDOW_INFO (window), NULL); - - return (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->get_extra_slot) (window); -} - -gboolean -nautilus_window_info_get_initiated_unmount (NautilusWindowInfo *window) -{ - g_return_val_if_fail (NAUTILUS_IS_WINDOW_INFO (window), FALSE); - - return (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->get_initiated_unmount) (window); -} - -void -nautilus_window_info_set_initiated_unmount (NautilusWindowInfo *window, gboolean initiated_unmount) -{ - g_return_if_fail (NAUTILUS_IS_WINDOW_INFO (window)); - - (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->set_initiated_unmount) (window, - initiated_unmount); - -} diff --git a/libnautilus-private/nautilus-window-info.h b/libnautilus-private/nautilus-window-info.h deleted file mode 100644 index d798a7711..000000000 --- a/libnautilus-private/nautilus-window-info.h +++ /dev/null @@ -1,184 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- - - nautilus-window-info.h: Interface for nautilus windows - - Copyright (C) 2004 Red Hat 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: Alexander Larsson <alexl@redhat.com> -*/ - -#ifndef NAUTILUS_WINDOW_INFO_H -#define NAUTILUS_WINDOW_INFO_H - -#include <glib-object.h> -#include <libnautilus-private/nautilus-view.h> -#include <gtk/gtk.h> - -G_BEGIN_DECLS - -typedef enum -{ - NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT, - NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_ENABLE, - NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DISABLE -} NautilusWindowShowHiddenFilesMode; - - -typedef enum { - NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE, - NAUTILUS_WINDOW_OPEN_IN_SPATIAL, - NAUTILUS_WINDOW_OPEN_IN_NAVIGATION -} NautilusWindowOpenMode; - -typedef enum { - /* used in spatial mode */ - NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND = 1<<0, - /* used in navigation mode */ - NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW = 1<<1, - NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB = 1<<2 -} NautilusWindowOpenFlags; - -typedef enum { - NAUTILUS_WINDOW_SPATIAL, - NAUTILUS_WINDOW_NAVIGATION, - NAUTILUS_WINDOW_DESKTOP -} NautilusWindowType; - -#define NAUTILUS_TYPE_WINDOW_INFO (nautilus_window_info_get_type ()) -#define NAUTILUS_WINDOW_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_WINDOW_INFO, NautilusWindowInfo)) -#define NAUTILUS_IS_WINDOW_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_WINDOW_INFO)) -#define NAUTILUS_WINDOW_INFO_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NAUTILUS_TYPE_WINDOW_INFO, NautilusWindowInfoIface)) - -#ifndef NAUTILUS_WINDOW_DEFINED -#define NAUTILUS_WINDOW_DEFINED -/* Using NautilusWindow for the vtable to make implementing this in - * NautilusWindow easier */ -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; - -typedef void (* NautilusWindowGoToCallback) (NautilusWindow *window, - GError *error, - gpointer user_data); - -struct _NautilusWindowInfoIface -{ - GTypeInterface g_iface; - - /* signals: */ - - void (* loading_uri) (NautilusWindowInfo *window, - const char *uri); - /* Emitted when the view in the window changes the selection */ - void (* selection_changed) (NautilusWindowInfo *window); - void (* title_changed) (NautilusWindowInfo *window, - const char *title); - void (* hidden_files_mode_changed)(NautilusWindowInfo *window); - - /* VTable: */ - /* A view calls this once after a load_location, once it starts loading the - * directory. Might be called directly, or later on the mainloop. - * This can also be called at any other time if the view needs to - * re-load the location. But the view needs to call load_complete first if - * its currently loading. */ - void (* report_load_underway) (NautilusWindowInfo *window, - NautilusView *view); - /* A view calls this once after reporting load_underway, when the location - has been fully loaded, or when the load was stopped - (by an error or by the user). */ - void (* report_load_complete) (NautilusWindowInfo *window, - NautilusView *view); - /* This can be called at any time when there has been a catastrophic failure of - the view. It will result in the view being removed. */ - void (* report_view_failed) (NautilusWindowInfo *window, - NautilusView *view); - void (* report_selection_changed) (NautilusWindowInfo *window); - - /* Returns the number of selected items in the view */ - int (* get_selection_count) (NautilusWindowInfo *window); - - /* Returns a list of uris for th selected items in the view, caller frees it */ - GList *(* get_selection) (NautilusWindowInfo *window); - - char * (* get_current_location) (NautilusWindowInfo *window); - void (* push_status) (NautilusWindowInfo *window, - const char *status); - char * (* get_title) (NautilusWindowInfo *window); - GList *(* get_history) (NautilusWindowInfo *window); - NautilusWindowType - (* get_window_type) (NautilusWindowInfo *window); - NautilusWindowShowHiddenFilesMode - (* get_hidden_files_mode) (NautilusWindowInfo *window); - void (* set_hidden_files_mode) (NautilusWindowInfo *window, - NautilusWindowShowHiddenFilesMode mode); - - NautilusWindowSlotInfo * (* get_active_slot) (NautilusWindowInfo *window); - NautilusWindowSlotInfo * (* get_extra_slot) (NautilusWindowInfo *window); - - gboolean (* get_initiated_unmount) (NautilusWindowInfo *window); - void (* set_initiated_unmount) (NautilusWindowInfo *window, - gboolean initiated_unmount); - - void (* view_visible) (NautilusWindowInfo *window, - NautilusView *view); - void (* close_window) (NautilusWindowInfo *window); - GtkUIManager * (* get_ui_manager) (NautilusWindowInfo *window); -}; - -GType nautilus_window_info_get_type (void); -void nautilus_window_info_report_load_underway (NautilusWindowInfo *window, - NautilusView *view); -void nautilus_window_info_report_load_complete (NautilusWindowInfo *window, - NautilusView *view); -void nautilus_window_info_report_view_failed (NautilusWindowInfo *window, - NautilusView *view); -void nautilus_window_info_report_selection_changed (NautilusWindowInfo *window); -NautilusWindowSlotInfo * nautilus_window_info_get_active_slot (NautilusWindowInfo *window); -NautilusWindowSlotInfo * nautilus_window_info_get_extra_slot (NautilusWindowInfo *window); -void nautilus_window_info_view_visible (NautilusWindowInfo *window, - NautilusView *view); -void nautilus_window_info_close (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); -GList * nautilus_window_info_get_history (NautilusWindowInfo *window); -char * nautilus_window_info_get_current_location (NautilusWindowInfo *window); -int nautilus_window_info_get_selection_count (NautilusWindowInfo *window); -GList * nautilus_window_info_get_selection (NautilusWindowInfo *window); -NautilusWindowShowHiddenFilesMode nautilus_window_info_get_hidden_files_mode (NautilusWindowInfo *window); -void nautilus_window_info_set_hidden_files_mode (NautilusWindowInfo *window, - NautilusWindowShowHiddenFilesMode mode); -gboolean nautilus_window_info_get_initiated_unmount (NautilusWindowInfo *window); -void nautilus_window_info_set_initiated_unmount (NautilusWindowInfo *window, - gboolean initiated_unmount); -GtkUIManager * nautilus_window_info_get_ui_manager (NautilusWindowInfo *window); - -G_END_DECLS - -#endif /* NAUTILUS_WINDOW_INFO_H */ diff --git a/libnautilus-private/nautilus-window-slot-info.c b/libnautilus-private/nautilus-window-slot-info.c deleted file mode 100644 index 8b2f2f4b9..000000000 --- a/libnautilus-private/nautilus-window-slot-info.c +++ /dev/null @@ -1,157 +0,0 @@ -/* -*- 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_make_hosting_pane_active (NautilusWindowSlotInfo *slot) -{ - g_assert (NAUTILUS_IS_WINDOW_SLOT_INFO (slot)); - (* NAUTILUS_WINDOW_SLOT_INFO_GET_IFACE (slot)->make_hosting_pane_active) (slot); -} - -void -nautilus_window_slot_info_open_location_full (NautilusWindowSlotInfo *slot, - GFile *location, - NautilusWindowOpenMode mode, - NautilusWindowOpenFlags flags, - GList *selection, - NautilusWindowGoToCallback callback, - gpointer user_data) -{ - g_assert (NAUTILUS_IS_WINDOW_SLOT_INFO (slot)); - - (* NAUTILUS_WINDOW_SLOT_INFO_GET_IFACE (slot)->open_location) (slot, - location, - mode, - flags, - selection, - callback, - user_data); -} - -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); -} - -NautilusView * -nautilus_window_slot_info_get_current_view (NautilusWindowSlotInfo *slot) -{ - g_assert (NAUTILUS_IS_WINDOW_SLOT_INFO (slot)); - - return (* NAUTILUS_WINDOW_SLOT_INFO_GET_IFACE (slot)->get_current_view) (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); -} - diff --git a/libnautilus-private/nautilus-window-slot-info.h b/libnautilus-private/nautilus-window-slot-info.h deleted file mode 100644 index 5515278d2..000000000 --- a/libnautilus-private/nautilus-window-slot-info.h +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- 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" -#include "nautilus-view.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); - NautilusView * (* get_current_view) (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, - NautilusWindowGoToCallback callback, - gpointer user_data); - void (* make_hosting_pane_active) (NautilusWindowSlotInfo *slot); -}; - - -GType nautilus_window_slot_info_get_type (void); -NautilusWindowInfo * nautilus_window_slot_info_get_window (NautilusWindowSlotInfo *slot); - -#define nautilus_window_slot_info_open_location(slot, location, mode, flags, selection) \ - nautilus_window_slot_info_open_location_full(slot, location, mode, \ - flags, selection, NULL, NULL) - -void nautilus_window_slot_info_open_location_full (NautilusWindowSlotInfo *slot, - GFile *location, - NautilusWindowOpenMode mode, - NautilusWindowOpenFlags flags, - GList *selection, - NautilusWindowGoToCallback callback, - gpointer user_data); -void nautilus_window_slot_info_set_status (NautilusWindowSlotInfo *slot, - const char *status); -void nautilus_window_slot_info_make_hosting_pane_active (NautilusWindowSlotInfo *slot); - -char * nautilus_window_slot_info_get_current_location (NautilusWindowSlotInfo *slot); -NautilusView * nautilus_window_slot_info_get_current_view (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 */ diff --git a/src/Makefile.am b/src/Makefile.am index aac8971ef..d522f6095 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -121,6 +121,8 @@ nautilus_SOURCES = \ nautilus-trash-bar.h \ nautilus-view-as-action.c \ nautilus-view-as-action.h \ + nautilus-view-factory.c \ + nautilus-view-factory.h \ nautilus-window-bookmarks.c \ nautilus-window-bookmarks.h \ nautilus-window-manage-views.c \ diff --git a/src/file-manager/fm-desktop-icon-view.c b/src/file-manager/fm-desktop-icon-view.c index 8d96f3a13..6a4fb4e39 100644 --- a/src/file-manager/fm-desktop-icon-view.c +++ b/src/file-manager/fm-desktop-icon-view.c @@ -25,9 +25,11 @@ */ #include <config.h> + #include "fm-icon-container.h" #include "fm-desktop-icon-view.h" #include "fm-actions.h" +#include "nautilus-view-factory.h" #include <X11/Xatom.h> #include <gtk/gtk.h> @@ -45,7 +47,6 @@ #include <libnautilus-private/nautilus-file-utilities.h> #include <libnautilus-private/nautilus-ui-utilities.h> #include <libnautilus-private/nautilus-global-preferences.h> -#include <libnautilus-private/nautilus-view-factory.h> #include <libnautilus-private/nautilus-link.h> #include <libnautilus-private/nautilus-metadata.h> #include <libnautilus-private/nautilus-monitor.h> @@ -849,7 +850,7 @@ real_supports_zooming (FMDirectoryView *view) } static NautilusView * -fm_desktop_icon_view_create (NautilusWindowSlotInfo *slot) +fm_desktop_icon_view_create (NautilusWindowSlot *slot) { FMIconView *view; diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c index a6d63d8ad..9f76c325f 100644 --- a/src/file-manager/fm-directory-view.c +++ b/src/file-manager/fm-directory-view.c @@ -156,8 +156,8 @@ static int scripts_directory_uri_length; struct FMDirectoryViewDetails { - NautilusWindowInfo *window; - NautilusWindowSlotInfo *slot; + NautilusWindow *window; + NautilusWindowSlot *slot; NautilusDirectory *model; NautilusFile *directory_as_file; NautilusFile *location_popup_directory_as_file; @@ -572,7 +572,7 @@ create_templates_parameters_free (CreateTemplateParameters *parameters) g_free (parameters); } -NautilusWindowInfo * +NautilusWindow * fm_directory_view_get_nautilus_window (FMDirectoryView *view) { g_assert (view->details->window != NULL); @@ -580,7 +580,7 @@ fm_directory_view_get_nautilus_window (FMDirectoryView *view) return view->details->window; } -NautilusWindowSlotInfo * +NautilusWindowSlot * fm_directory_view_get_nautilus_window_slot (FMDirectoryView *view) { g_assert (view->details->slot != NULL); @@ -853,8 +853,8 @@ open_location (FMDirectoryView *directory_view, window = fm_directory_view_get_containing_window (directory_view); DEBUG ("open_location window=%p: %s", window, new_uri); location = g_file_new_for_uri (new_uri); - nautilus_window_slot_info_open_location (directory_view->details->slot, - location, mode, flags, NULL); + nautilus_window_slot_open_location_full (directory_view->details->slot, + location, mode, flags, NULL, NULL, NULL); g_object_unref (location); } @@ -2017,7 +2017,7 @@ real_unmerge_menus (FMDirectoryView *view) return; } - ui_manager = nautilus_window_info_get_ui_manager (view->details->window); + ui_manager = nautilus_window_get_ui_manager (view->details->window); nautilus_ui_unmerge_ui (ui_manager, &view->details->dir_merge_id, @@ -2370,7 +2370,7 @@ fm_directory_view_display_selection_info (FMDirectoryView *view) g_free (folder_item_count_str); g_free (non_folder_str); - nautilus_window_slot_info_set_status (view->details->slot, + nautilus_window_slot_set_status (view->details->slot, status_string); g_free (status_string); } @@ -2378,7 +2378,7 @@ fm_directory_view_display_selection_info (FMDirectoryView *view) void fm_directory_view_send_selection_change (FMDirectoryView *view) { - nautilus_window_info_report_selection_changed (view->details->window); + nautilus_window_report_selection_changed (view->details->window); view->details->send_selection_change_to_shell = FALSE; } @@ -2439,11 +2439,11 @@ done_loading (FMDirectoryView *view, } /* This can be called during destruction, in which case there - * is no NautilusWindowInfo any more. + * is no NautilusWindow any more. */ if (view->details->window != NULL) { if (all_files_seen) { - nautilus_window_info_report_load_complete (view->details->window, NAUTILUS_VIEW (view)); + nautilus_window_report_load_complete (view->details->window, NAUTILUS_VIEW (view)); } schedule_update_menus (view); @@ -3582,7 +3582,7 @@ fm_directory_view_get_ui_manager (FMDirectoryView *view) if (view->details->window == NULL) { return NULL; } - return nautilus_window_info_get_ui_manager (view->details->window); + return nautilus_window_get_ui_manager (view->details->window); } /** @@ -4376,7 +4376,7 @@ add_application_to_open_with_menu (FMDirectoryView *view, action); g_object_unref (action); - gtk_ui_manager_add_ui (nautilus_window_info_get_ui_manager (view->details->window), + gtk_ui_manager_add_ui (nautilus_window_get_ui_manager (view->details->window), view->details->open_with_merge_id, menu_placeholder, action_name, @@ -4386,12 +4386,12 @@ add_application_to_open_with_menu (FMDirectoryView *view, path = g_strdup_printf ("%s/%s", menu_placeholder, action_name); menuitem = gtk_ui_manager_get_widget ( - nautilus_window_info_get_ui_manager (view->details->window), + nautilus_window_get_ui_manager (view->details->window), path); gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (menuitem), TRUE); g_free (path); - gtk_ui_manager_add_ui (nautilus_window_info_get_ui_manager (view->details->window), + gtk_ui_manager_add_ui (nautilus_window_get_ui_manager (view->details->window), view->details->open_with_merge_id, popup_placeholder, action_name, @@ -4401,7 +4401,7 @@ add_application_to_open_with_menu (FMDirectoryView *view, path = g_strdup_printf ("%s/%s", popup_placeholder, action_name); menuitem = gtk_ui_manager_get_widget ( - nautilus_window_info_get_ui_manager (view->details->window), + nautilus_window_get_ui_manager (view->details->window), path); gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (menuitem), TRUE); @@ -4477,7 +4477,7 @@ reset_open_with_menu (FMDirectoryView *view, GList *selection) /* Clear any previous inserted items in the applications and viewers placeholders */ - ui_manager = nautilus_window_info_get_ui_manager (view->details->window); + ui_manager = nautilus_window_get_ui_manager (view->details->window); nautilus_ui_unmerge_ui (ui_manager, &view->details->open_with_merge_id, &view->details->open_with_action_group); @@ -4543,7 +4543,7 @@ reset_open_with_menu (FMDirectoryView *view, GList *selection) popup_path = FM_DIRECTORY_VIEW_POPUP_PATH_APPLICATIONS_PLACEHOLDER; } - gtk_ui_manager_add_ui (nautilus_window_info_get_ui_manager (view->details->window), + gtk_ui_manager_add_ui (nautilus_window_get_ui_manager (view->details->window), view->details->open_with_merge_id, menu_path, "separator", @@ -4796,7 +4796,7 @@ add_extension_menu_items (FMDirectoryView *view, GtkUIManager *ui_manager; GList *l; - ui_manager = nautilus_window_info_get_ui_manager (view->details->window); + ui_manager = nautilus_window_get_ui_manager (view->details->window); for (l = menu_items; l; l = l->next) { NautilusMenuItem *item; @@ -4856,7 +4856,7 @@ reset_extension_actions_menu (FMDirectoryView *view, GList *selection) GtkUIManager *ui_manager; /* Clear any previous inserted items in the extension actions placeholder */ - ui_manager = nautilus_window_info_get_ui_manager (view->details->window); + ui_manager = nautilus_window_get_ui_manager (view->details->window); nautilus_ui_unmerge_ui (ui_manager, &view->details->extensions_menu_merge_id, @@ -5032,12 +5032,12 @@ get_strings_for_environment_variables (FMDirectoryView *view, GList *selected_fi static FMDirectoryView * get_directory_view_of_extra_pane (FMDirectoryView *view) { - NautilusWindowSlotInfo *slot; + NautilusWindowSlot *slot; NautilusView *next_view; - slot = nautilus_window_info_get_extra_slot (fm_directory_view_get_nautilus_window (view)); + slot = nautilus_window_get_extra_slot (fm_directory_view_get_nautilus_window (view)); if (slot != NULL) { - next_view = nautilus_window_slot_info_get_current_view (slot); + next_view = nautilus_window_slot_get_current_view (slot); if (FM_IS_DIRECTORY_VIEW (next_view)) { return FM_DIRECTORY_VIEW (next_view); @@ -5211,7 +5211,7 @@ add_script_to_scripts_menus (FMDirectoryView *directory_view, action, NULL); g_object_unref (action); - ui_manager = nautilus_window_info_get_ui_manager (directory_view->details->window); + ui_manager = nautilus_window_get_ui_manager (directory_view->details->window); gtk_ui_manager_add_ui (ui_manager, directory_view->details->scripts_merge_id, @@ -5256,7 +5256,7 @@ add_submenu_to_directory_menus (FMDirectoryView *directory_view, char *uri; GtkUIManager *ui_manager; - ui_manager = nautilus_window_info_get_ui_manager (directory_view->details->window); + ui_manager = nautilus_window_get_ui_manager (directory_view->details->window); uri = nautilus_file_get_uri (file); name = nautilus_file_get_display_name (file); pixbuf = get_menu_icon_for_file (file); @@ -5374,7 +5374,7 @@ update_scripts_menu (FMDirectoryView *view) occur before we finish. */ view->details->scripts_invalid = FALSE; - ui_manager = nautilus_window_info_get_ui_manager (view->details->window); + ui_manager = nautilus_window_get_ui_manager (view->details->window); nautilus_ui_unmerge_ui (ui_manager, &view->details->scripts_merge_id, &view->details->scripts_action_group); @@ -5462,7 +5462,7 @@ add_template_to_templates_menus (FMDirectoryView *directory_view, action); g_object_unref (action); - ui_manager = nautilus_window_info_get_ui_manager (directory_view->details->window); + ui_manager = nautilus_window_get_ui_manager (directory_view->details->window); gtk_ui_manager_add_ui (ui_manager, directory_view->details->templates_merge_id, @@ -5637,7 +5637,7 @@ update_templates_menu (FMDirectoryView *view) occur before we finish. */ view->details->templates_invalid = FALSE; - ui_manager = nautilus_window_info_get_ui_manager (view->details->window); + ui_manager = nautilus_window_get_ui_manager (view->details->window); nautilus_ui_unmerge_ui (ui_manager, &view->details->templates_merge_id, &view->details->templates_action_group); @@ -5712,7 +5712,7 @@ create_popup_menu (FMDirectoryView *view, const char *popup_path) { GtkWidget *menu; - menu = gtk_ui_manager_get_widget (nautilus_window_info_get_ui_manager (view->details->window), + menu = gtk_ui_manager_get_widget (nautilus_window_get_ui_manager (view->details->window), popup_path); gtk_menu_set_screen (GTK_MENU (menu), gtk_widget_get_screen (GTK_WIDGET (view))); @@ -5783,7 +5783,7 @@ copy_or_cut_files (FMDirectoryView *view, } } - nautilus_window_slot_info_set_status (view->details->slot, + nautilus_window_slot_set_status (view->details->slot, status_string); g_free (status_string); } @@ -5834,13 +5834,13 @@ static void move_copy_selection_to_next_pane (FMDirectoryView *view, int copy_action) { - NautilusWindowSlotInfo *slot; + NautilusWindowSlot *slot; char *dest_location; - slot = nautilus_window_info_get_extra_slot (fm_directory_view_get_nautilus_window (view)); + slot = nautilus_window_get_extra_slot (fm_directory_view_get_nautilus_window (view)); g_return_if_fail (slot != NULL); - dest_location = nautilus_window_slot_info_get_current_location (slot); + dest_location = nautilus_window_slot_get_current_location (slot); g_return_if_fail (dest_location != NULL); move_copy_selection_to_location (view, copy_action, dest_location); @@ -5859,16 +5859,16 @@ action_copy_to_next_pane_callback (GtkAction *action, gpointer callback_data) static void action_move_to_next_pane_callback (GtkAction *action, gpointer callback_data) { - NautilusWindowSlotInfo *slot; + NautilusWindowSlot *slot; char *dest_location; FMDirectoryView *view; view = FM_DIRECTORY_VIEW (callback_data); - slot = nautilus_window_info_get_extra_slot (fm_directory_view_get_nautilus_window (view)); + slot = nautilus_window_get_extra_slot (fm_directory_view_get_nautilus_window (view)); g_return_if_fail (slot != NULL); - dest_location = nautilus_window_slot_info_get_current_location (slot); + dest_location = nautilus_window_slot_get_current_location (slot); g_return_if_fail (dest_location != NULL); move_copy_selection_to_location (view, GDK_ACTION_MOVE, dest_location); @@ -5953,7 +5953,7 @@ paste_clipboard_data (FMDirectoryView *view, copied_files_atom); if (item_uris == NULL|| destination_uri == NULL) { - nautilus_window_slot_info_set_status (view->details->slot, + nautilus_window_slot_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, @@ -7005,7 +7005,7 @@ fm_directory_view_init_show_hidden_files (FMDirectoryView *view) } show_hidden_changed = FALSE; - mode = nautilus_window_info_get_hidden_files_mode (view->details->window); + mode = nautilus_window_get_hidden_files_mode (view->details->window); if (mode == NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT) { show_hidden_default_setting = g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES); @@ -7398,7 +7398,7 @@ real_merge_menus (FMDirectoryView *view) const char *ui; char *tooltip; - ui_manager = nautilus_window_info_get_ui_manager (view->details->window); + ui_manager = nautilus_window_get_ui_manager (view->details->window); action_group = gtk_action_group_new ("DirViewActions"); gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE); @@ -7545,7 +7545,7 @@ showing_trash_directory (FMDirectoryView *view) static gboolean should_show_empty_trash (FMDirectoryView *view) { - return (showing_trash_directory (view) || nautilus_window_info_get_window_type (view->details->window) == NAUTILUS_WINDOW_NAVIGATION); + return (showing_trash_directory (view) || nautilus_window_get_window_type (view->details->window) == NAUTILUS_WINDOW_NAVIGATION); } static gboolean @@ -8280,7 +8280,7 @@ real_update_location_menu (FMDirectoryView *view) show_open_folder_window = FALSE; show_open_in_new_tab = FALSE; - if (nautilus_window_info_get_window_type (view->details->window) == NAUTILUS_WINDOW_NAVIGATION) { + if (nautilus_window_get_window_type (view->details->window) == NAUTILUS_WINDOW_NAVIGATION) { if (g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_ALWAYS_USE_BROWSER)) { label = _("Open in New _Window"); } else { @@ -8564,7 +8564,7 @@ real_update_menus (FMDirectoryView *view) NULL); menuitem = gtk_ui_manager_get_widget ( - nautilus_window_info_get_ui_manager (view->details->window), + nautilus_window_get_ui_manager (view->details->window), FM_DIRECTORY_VIEW_MENU_PATH_OPEN); /* Only force displaying the icon if it is an application icon */ @@ -8572,7 +8572,7 @@ real_update_menus (FMDirectoryView *view) GTK_IMAGE_MENU_ITEM (menuitem), app_icon != NULL); menuitem = gtk_ui_manager_get_widget ( - nautilus_window_info_get_ui_manager (view->details->window), + nautilus_window_get_ui_manager (view->details->window), FM_DIRECTORY_VIEW_POPUP_PATH_OPEN); /* Only force displaying the icon if it is an application icon */ @@ -8592,10 +8592,10 @@ real_update_menus (FMDirectoryView *view) show_open_alternate = file_list_all_are_folders (selection) && selection_count > 0 && - !(nautilus_window_info_get_window_type (view->details->window) == NAUTILUS_WINDOW_DESKTOP && + !(nautilus_window_get_window_type (view->details->window) == NAUTILUS_WINDOW_DESKTOP && g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_ALWAYS_USE_BROWSER)); show_open_folder_window = FALSE; - if (nautilus_window_info_get_window_type (view->details->window) == NAUTILUS_WINDOW_NAVIGATION) { + if (nautilus_window_get_window_type (view->details->window) == NAUTILUS_WINDOW_NAVIGATION) { if (g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_ALWAYS_USE_BROWSER)) { if (selection_count == 0 || selection_count == 1) { label_with_underscore = g_strdup (_("Open in New _Window")); @@ -8633,7 +8633,7 @@ real_update_menus (FMDirectoryView *view) gtk_action_set_visible (action, show_open_alternate); /* Open in New Tab action */ - if (nautilus_window_info_get_window_type (view->details->window) == NAUTILUS_WINDOW_NAVIGATION) { + if (nautilus_window_get_window_type (view->details->window) == NAUTILUS_WINDOW_NAVIGATION) { if (g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_ALWAYS_USE_BROWSER)) { if (selection_count == 0 || selection_count == 1) { @@ -8669,7 +8669,7 @@ real_update_menus (FMDirectoryView *view) } /* next pane actions, only in navigation mode */ - if (nautilus_window_info_get_window_type (view->details->window) != NAUTILUS_WINDOW_NAVIGATION) { + if (nautilus_window_get_window_type (view->details->window) != NAUTILUS_WINDOW_NAVIGATION) { action = gtk_action_group_get_action (view->details->dir_action_group, FM_ACTION_COPY_TO_NEXT_PANE); gtk_action_set_visible (action, FALSE); @@ -9301,7 +9301,7 @@ finish_loading (FMDirectoryView *view) { NautilusFileAttributes attributes; - nautilus_window_info_report_load_underway (view->details->window, + nautilus_window_report_load_underway (view->details->window, NAUTILUS_VIEW (view)); /* Tell interested parties that we've begun loading this directory now. @@ -9310,7 +9310,7 @@ finish_loading (FMDirectoryView *view) fm_directory_view_begin_loading (view); /* Assume we have now all information to show window */ - nautilus_window_info_view_visible (view->details->window, NAUTILUS_VIEW (view)); + nautilus_window_view_visible (view->details->window, NAUTILUS_VIEW (view)); if (nautilus_directory_are_all_files_seen (view->details->model)) { /* Unschedule a pending update and schedule a new one with the minimal @@ -9520,9 +9520,9 @@ fm_directory_view_reset_to_defaults (FMDirectoryView *view) EEL_CALL_METHOD (FM_DIRECTORY_VIEW_CLASS, view, reset_to_defaults, (view)); - mode = nautilus_window_info_get_hidden_files_mode (view->details->window); + mode = nautilus_window_get_hidden_files_mode (view->details->window); if (mode != NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT) { - nautilus_window_info_set_hidden_files_mode (view->details->window, + nautilus_window_set_hidden_files_mode (view->details->window, NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT); } } @@ -9682,7 +9682,7 @@ fm_directory_view_set_initiated_unmount (FMDirectoryView *view, gboolean initiated_unmount) { if (view->details->window != NULL) { - nautilus_window_info_set_initiated_unmount(view->details->window, + nautilus_window_set_initiated_unmount(view->details->window, initiated_unmount); } } @@ -10530,8 +10530,8 @@ fm_directory_view_set_property (GObject *object, GParamSpec *pspec) { FMDirectoryView *directory_view; - NautilusWindowSlotInfo *slot; - NautilusWindowInfo *window; + NautilusWindowSlot *slot; + NautilusWindow *window; directory_view = FM_DIRECTORY_VIEW (object); @@ -10539,8 +10539,8 @@ fm_directory_view_set_property (GObject *object, 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); + slot = NAUTILUS_WINDOW_SLOT (g_value_get_object (value)); + window = nautilus_window_slot_get_window (slot); directory_view->details->slot = slot; directory_view->details->window = window; @@ -10628,7 +10628,7 @@ fm_directory_view_parent_set (GtkWidget *widget, g_assert (old_parent == NULL); if (view->details->slot == - nautilus_window_info_get_active_slot (view->details->window)) { + nautilus_window_get_active_slot (view->details->window)) { view->details->active = TRUE; fm_directory_view_merge_menus (view); @@ -10785,7 +10785,7 @@ fm_directory_view_class_init (FMDirectoryViewClass *klass) g_param_spec_object ("window-slot", "Window Slot", "The parent window slot reference", - NAUTILUS_TYPE_WINDOW_SLOT_INFO, + NAUTILUS_TYPE_WINDOW_SLOT, G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); diff --git a/src/file-manager/fm-directory-view.h b/src/file-manager/fm-directory-view.h index 07402a049..32d332f44 100644 --- a/src/file-manager/fm-directory-view.h +++ b/src/file-manager/fm-directory-view.h @@ -29,14 +29,16 @@ #define FM_DIRECTORY_VIEW_H #include <gtk/gtk.h> +#include <gio/gio.h> + #include <libnautilus-private/nautilus-directory.h> #include <libnautilus-private/nautilus-file.h> #include <libnautilus-private/nautilus-icon-container.h> #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> + +#include "nautilus-window.h" +#include "nautilus-window-slot.h" typedef struct FMDirectoryView FMDirectoryView; typedef struct FMDirectoryViewClass FMDirectoryViewClass; @@ -338,8 +340,8 @@ struct FMDirectoryViewClass { GType fm_directory_view_get_type (void); /* 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); +NautilusWindow *fm_directory_view_get_nautilus_window (FMDirectoryView *view); +NautilusWindowSlot *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, diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c index 755ed8c91..5780756f4 100644 --- a/src/file-manager/fm-icon-view.c +++ b/src/file-manager/fm-icon-view.c @@ -29,6 +29,8 @@ #include "fm-icon-container.h" #include "fm-desktop-icon-view.h" #include "fm-error-reporting.h" +#include "nautilus-view-factory.h" + #include <stdlib.h> #include <eel/eel-glib-extensions.h> #include <eel/eel-gtk-extensions.h> @@ -51,7 +53,6 @@ #include <libnautilus-private/nautilus-icon-dnd.h> #include <libnautilus-private/nautilus-link.h> #include <libnautilus-private/nautilus-metadata.h> -#include <libnautilus-private/nautilus-view-factory.h> #include <libnautilus-private/nautilus-clipboard.h> #include <libnautilus-private/nautilus-desktop-icon-file.h> #include <locale.h> @@ -1906,7 +1907,7 @@ icon_container_activate_alternate_callback (NautilusIconContainer *container, GdkEventButton *button_event; GdkEventKey *key_event; gboolean open_in_tab; - NautilusWindowInfo *window_info; + NautilusWindow *window; NautilusWindowOpenFlags flags; g_assert (FM_IS_ICON_VIEW (icon_view)); @@ -1914,9 +1915,9 @@ icon_container_activate_alternate_callback (NautilusIconContainer *container, open_in_tab = FALSE; - window_info = fm_directory_view_get_nautilus_window (FM_DIRECTORY_VIEW (icon_view)); + window = fm_directory_view_get_nautilus_window (FM_DIRECTORY_VIEW (icon_view)); - if (nautilus_window_info_get_window_type (window_info) == NAUTILUS_WINDOW_NAVIGATION) { + if (nautilus_window_get_window_type (window) == NAUTILUS_WINDOW_NAVIGATION) { event = gtk_get_current_event (); if (event->type == GDK_BUTTON_PRESS || event->type == GDK_BUTTON_RELEASE || @@ -2202,7 +2203,7 @@ icon_container_preview_callback (NautilusIconContainer *container, file_name = nautilus_file_get_display_name (file); message = g_strdup_printf (_("pointing at \"%s\""), file_name); g_free (file_name); - nautilus_window_slot_info_set_status + nautilus_window_slot_set_status (fm_directory_view_get_nautilus_window_slot (FM_DIRECTORY_VIEW (icon_view)), message); g_free (message); @@ -2749,12 +2750,12 @@ store_layout_timestamp (NautilusIconContainer *container, static gboolean focus_in_event_callback (GtkWidget *widget, GdkEventFocus *event, gpointer user_data) { - NautilusWindowSlotInfo *slot_info; + NautilusWindowSlot *slot; FMIconView *icon_view = FM_ICON_VIEW (user_data); /* make the corresponding slot (and the pane that contains it) active */ - slot_info = fm_directory_view_get_nautilus_window_slot (FM_DIRECTORY_VIEW (icon_view)); - nautilus_window_slot_info_make_hosting_pane_active (slot_info); + slot = fm_directory_view_get_nautilus_window_slot (FM_DIRECTORY_VIEW (icon_view)); + nautilus_window_slot_make_hosting_pane_active (slot); return FALSE; } @@ -3113,7 +3114,7 @@ fm_icon_view_init (FMIconView *icon_view) } static NautilusView * -fm_icon_view_create (NautilusWindowSlotInfo *slot) +fm_icon_view_create (NautilusWindowSlot *slot) { FMIconView *view; @@ -3125,7 +3126,7 @@ fm_icon_view_create (NautilusWindowSlotInfo *slot) } static NautilusView * -fm_compact_view_create (NautilusWindowSlotInfo *slot) +fm_compact_view_create (NautilusWindowSlot *slot) { FMIconView *view; diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c index 3a537707b..b6539d5b5 100644 --- a/src/file-manager/fm-list-view.c +++ b/src/file-manager/fm-list-view.c @@ -31,6 +31,8 @@ #include <string.h> #include "fm-error-reporting.h" #include "fm-list-model.h" +#include "nautilus-view-factory.h" + #include <string.h> #include <eel/eel-vfs-extensions.h> #include <eel/eel-gdk-extensions.h> @@ -55,7 +57,6 @@ #include <libnautilus-private/nautilus-metadata.h> #include <libnautilus-private/nautilus-module.h> #include <libnautilus-private/nautilus-tree-view-drag-dest.h> -#include <libnautilus-private/nautilus-view-factory.h> #include <libnautilus-private/nautilus-clipboard.h> #include <libnautilus-private/nautilus-cell-renderer-text-ellipsized.h> @@ -1508,12 +1509,12 @@ realize_event_callback (GtkWidget *tree_view, static gboolean focus_in_event_callback (GtkWidget *widget, GdkEventFocus *event, gpointer user_data) { - NautilusWindowSlotInfo *slot_info; + NautilusWindowSlot *slot; FMListView *list_view = FM_LIST_VIEW (user_data); /* make the corresponding slot (and the pane that contains it) active */ - slot_info = fm_directory_view_get_nautilus_window_slot (FM_DIRECTORY_VIEW (list_view)); - nautilus_window_slot_info_make_hosting_pane_active (slot_info); + slot = fm_directory_view_get_nautilus_window_slot (FM_DIRECTORY_VIEW (list_view)); + nautilus_window_slot_make_hosting_pane_active (slot); return FALSE; } @@ -3163,7 +3164,7 @@ fm_list_view_init (FMListView *list_view) } static NautilusView * -fm_list_view_create (NautilusWindowSlotInfo *slot) +fm_list_view_create (NautilusWindowSlot *slot) { FMListView *view; diff --git a/src/nautilus-application.h b/src/nautilus-application.h index ea6cd60a9..6ee8d89b0 100644 --- a/src/nautilus-application.h +++ b/src/nautilus-application.h @@ -30,6 +30,8 @@ #include <libnautilus-private/nautilus-undo-manager.h> +#include "nautilus-window.h" + #define NAUTILUS_DESKTOP_ICON_VIEW_IID "OAFIID:Nautilus_File_Manager_Desktop_Icon_View" #define NAUTILUS_TYPE_APPLICATION nautilus_application_get_type() @@ -44,11 +46,6 @@ #define NAUTILUS_APPLICATION_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), NAUTILUS_TYPE_APPLICATION, NautilusApplicationClass)) -#ifndef NAUTILUS_WINDOW_DEFINED -#define NAUTILUS_WINDOW_DEFINED -typedef struct NautilusWindow NautilusWindow; -#endif - #ifndef NAUTILUS_SPATIAL_WINDOW_DEFINED #define NAUTILUS_SPATIAL_WINDOW_DEFINED typedef struct _NautilusSpatialWindow NautilusSpatialWindow; diff --git a/src/nautilus-bookmarks-window.c b/src/nautilus-bookmarks-window.c index 246ea43b1..713fa5c5f 100644 --- a/src/nautilus-bookmarks-window.c +++ b/src/nautilus-bookmarks-window.c @@ -265,7 +265,7 @@ create_bookmarks_window (NautilusBookmarkList *list, GObject *undo_manager_sourc remove_button = (GtkWidget *)gtk_builder_get_object (builder, "bookmark_delete_button"); jump_button = (GtkWidget *)gtk_builder_get_object (builder, "bookmark_jump_button"); - application = NAUTILUS_WINDOW (undo_manager_source)->application; + application = nautilus_application_dup_singleton (); if (NAUTILUS_IS_NAVIGATION_WINDOW (undo_manager_source)) { parent_is_browser_window = TRUE; @@ -942,6 +942,7 @@ on_window_destroy_event (GtkWidget *widget, { g_object_unref (bookmark_list_store); g_object_unref (bookmark_empty_list_store); + g_object_unref (application); g_source_remove_by_user_data (widget); } diff --git a/src/nautilus-connect-server-dialog-main.c b/src/nautilus-connect-server-dialog-main.c index 8b518fe08..49646f4f1 100644 --- a/src/nautilus-connect-server-dialog-main.c +++ b/src/nautilus-connect-server-dialog-main.c @@ -68,7 +68,6 @@ nautilus_connect_server_dialog_display_location_finish (NautilusConnectServerDia void nautilus_connect_server_dialog_display_location_async (NautilusConnectServerDialog *self, - NautilusApplication *application, GFile *location, GAsyncReadyCallback callback, gpointer user_data) diff --git a/src/nautilus-connect-server-dialog-nonmain.c b/src/nautilus-connect-server-dialog-nonmain.c index b6b2adab2..0b7374a31 100644 --- a/src/nautilus-connect-server-dialog-nonmain.c +++ b/src/nautilus-connect-server-dialog-nonmain.c @@ -66,13 +66,13 @@ nautilus_connect_server_dialog_display_location_finish (NautilusConnectServerDia void nautilus_connect_server_dialog_display_location_async (NautilusConnectServerDialog *self, - NautilusApplication *application, GFile *location, GAsyncReadyCallback callback, gpointer user_data) { NautilusWindow *window; GtkWidget *widget; + NautilusApplication *application; widget = GTK_WIDGET (self); @@ -81,6 +81,8 @@ nautilus_connect_server_dialog_display_location_async (NautilusConnectServerDial callback, user_data, nautilus_connect_server_dialog_display_location_async); + application = nautilus_application_dup_singleton (); + if (g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_ALWAYS_USE_BROWSER)) { window = nautilus_application_create_navigation_window (application, NULL, @@ -96,4 +98,6 @@ nautilus_connect_server_dialog_display_location_async (NautilusConnectServerDial nautilus_window_go_to_full (window, location, window_go_to_cb, self); + + g_object_unref (application); } diff --git a/src/nautilus-connect-server-dialog.c b/src/nautilus-connect-server-dialog.c index 9e9674edd..95b1c6995 100644 --- a/src/nautilus-connect-server-dialog.c +++ b/src/nautilus-connect-server-dialog.c @@ -31,7 +31,6 @@ #include <gio/gio.h> #include <gtk/gtk.h> -#include "nautilus-application.h" #include "nautilus-bookmark-list.h" #include "nautilus-connect-server-operation.h" #include "nautilus-window.h" @@ -45,8 +44,6 @@ */ struct _NautilusConnectServerDialogDetails { - NautilusApplication *application; - GtkWidget *primary_table; GtkWidget *user_details; GtkWidget *port_spinbutton; @@ -480,8 +477,7 @@ mount_enclosing_ready_cb (GObject *source, if (!error || g_error_matches (error, G_IO_ERROR, G_IO_ERROR_ALREADY_MOUNTED)) { /* volume is mounted, show it */ - nautilus_connect_server_dialog_display_location_async (dialog, - dialog->details->application, location, + nautilus_connect_server_dialog_display_location_async (dialog, location, display_location_async_cb, NULL); } else { if (dialog->details->should_destroy) { @@ -498,7 +494,6 @@ mount_enclosing_ready_cb (GObject *source, static void connect_dialog_present_uri_async (NautilusConnectServerDialog *self, - NautilusApplication *application, GFile *location) { GMountOperation *op; @@ -615,7 +610,6 @@ connect_dialog_connect_to_server (NautilusConnectServerDialog *dialog) connect_dialog_set_connecting (dialog); connect_dialog_present_uri_async (dialog, - dialog->details->application, location); g_object_unref (location); @@ -1174,7 +1168,6 @@ nautilus_connect_server_dialog_new (NautilusWindow *window) if (window) { gtk_window_set_screen (GTK_WINDOW (dialog), gtk_window_get_screen (GTK_WINDOW (window))); - conndlg->details->application = window->application; } return dialog; diff --git a/src/nautilus-connect-server-dialog.h b/src/nautilus-connect-server-dialog.h index 254896de9..bc1deaceb 100644 --- a/src/nautilus-connect-server-dialog.h +++ b/src/nautilus-connect-server-dialog.h @@ -27,6 +27,7 @@ #include <gio/gio.h> #include <gtk/gtk.h> +#include "nautilus-application.h" #include "nautilus-window.h" #define NAUTILUS_TYPE_CONNECT_SERVER_DIALOG\ @@ -58,7 +59,6 @@ GType nautilus_connect_server_dialog_get_type (void); GtkWidget* nautilus_connect_server_dialog_new (NautilusWindow *window); void nautilus_connect_server_dialog_display_location_async (NautilusConnectServerDialog *self, - NautilusApplication *application, GFile *location, GAsyncReadyCallback callback, gpointer user_data); diff --git a/src/nautilus-location-bar.c b/src/nautilus-location-bar.c index a06e04b66..5a34a34dd 100644 --- a/src/nautilus-location-bar.c +++ b/src/nautilus-location-bar.c @@ -177,7 +177,7 @@ drag_data_received_callback (GtkWidget *widget, if (new_windows_for_extras) { int i; - application = NAUTILUS_WINDOW (window)->application; + application = nautilus_application_dup_singleton (); screen = gtk_window_get_screen (GTK_WINDOW (window)); for (i = 1; names[i] != NULL; ++i) { @@ -186,6 +186,8 @@ drag_data_received_callback (GtkWidget *widget, nautilus_window_go_to (new_window, location); g_object_unref (location); } + + g_object_unref (application); } g_strfreev (names); diff --git a/src/nautilus-mime-actions.c b/src/nautilus-mime-actions.c index bd785f5ab..102d8d6cc 100644 --- a/src/nautilus-mime-actions.c +++ b/src/nautilus-mime-actions.c @@ -23,8 +23,11 @@ */ #include <config.h> + #include "nautilus-mime-actions.h" +#include "nautilus-window-slot.h" + #include <eel/eel-glib-extensions.h> #include <eel/eel-stock-dialogs.h> #include <eel/eel-string.h> @@ -66,8 +69,8 @@ typedef struct { } ApplicationLaunchParameters; typedef struct { - NautilusWindowSlotInfo *slot_info; - gpointer window_info; + NautilusWindowSlot *slot; + gpointer window; GtkWindow *parent_window; GCancellable *cancellable; GList *locations; @@ -944,8 +947,8 @@ activation_parameters_free (ActivateParameters *parameters) eel_timed_wait_stop (cancel_activate_callback, parameters); } - if (parameters->slot_info) { - g_object_remove_weak_pointer (G_OBJECT (parameters->slot_info), (gpointer *)¶meters->slot_info); + if (parameters->slot) { + g_object_remove_weak_pointer (G_OBJECT (parameters->slot), (gpointer *)¶meters->slot); } if (parameters->parent_window) { g_object_remove_weak_pointer (G_OBJECT (parameters->parent_window), (gpointer *)¶meters->parent_window); @@ -1057,7 +1060,7 @@ confirm_multiple_windows (GtkWindow *parent_window, } typedef struct { - NautilusWindowSlotInfo *slot_info; + NautilusWindowSlot *slot; GtkWindow *parent_window; NautilusFile *file; GList *files; @@ -1073,8 +1076,8 @@ typedef struct { static void activate_parameters_install_free (ActivateParametersInstall *parameters_install) { - if (parameters_install->slot_info) { - g_object_remove_weak_pointer (G_OBJECT (parameters_install->slot_info), (gpointer *)¶meters_install->slot_info); + if (parameters_install->slot) { + g_object_remove_weak_pointer (G_OBJECT (parameters_install->slot), (gpointer *)¶meters_install->slot); } if (parameters_install->parent_window) { g_object_remove_weak_pointer (G_OBJECT (parameters_install->parent_window), (gpointer *)¶meters_install->parent_window); @@ -1279,7 +1282,7 @@ search_for_application_dbus_call_notify_cb (GDBusProxy *proxy, /* activate the file again */ nautilus_mime_activate_files (parameters_install->parent_window, - parameters_install->slot_info, + parameters_install->slot, parameters_install->files, parameters_install->activation_directory, parameters_install->mode, @@ -1416,8 +1419,8 @@ application_unhandled_uri (ActivateParameters *parameters, char *uri) /* copy the parts of parameters we are interested in as the orignal will be unref'd */ parameters_install = g_new0 (ActivateParametersInstall, 1); - parameters_install->slot_info = parameters->slot_info; - g_object_add_weak_pointer (G_OBJECT (parameters_install->slot_info), (gpointer *)¶meters_install->slot_info); + parameters_install->slot = parameters->slot; + g_object_add_weak_pointer (G_OBJECT (parameters_install->slot), (gpointer *)¶meters_install->slot); if (parameters->parent_window) { parameters_install->parent_window = parameters->parent_window; g_object_add_weak_pointer (G_OBJECT (parameters_install->parent_window), (gpointer *)¶meters_install->parent_window); @@ -1586,7 +1589,7 @@ activate_desktop_file (ActivateParameters *parameters, static void activate_files (ActivateParameters *parameters) { - NautilusWindowInfo *window_info; + NautilusWindow *window; NautilusWindowOpenFlags flags; NautilusFile *file; GList *launch_desktop_files; @@ -1726,7 +1729,7 @@ activate_files (ActivateParameters *parameters) } } - if (parameters->slot_info != NULL && + if (parameters->slot != NULL && (!parameters->user_confirmation || confirm_multiple_windows (parameters->parent_window, count, (flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB) != 0))) { @@ -1751,8 +1754,8 @@ activate_files (ActivateParameters *parameters) uri = nautilus_file_get_activation_uri (file); f = g_file_new_for_uri (uri); - nautilus_window_slot_info_open_location (parameters->slot_info, - f, parameters->mode, flags, NULL); + nautilus_window_slot_open_location_full (parameters->slot, + f, parameters->mode, flags, NULL, NULL, NULL); g_object_unref (f); g_free (uri); } @@ -1819,17 +1822,17 @@ activate_files (ActivateParameters *parameters) } } - window_info = NULL; - if (parameters->slot_info != NULL) { - window_info = nautilus_window_slot_info_get_window (parameters->slot_info); + window = NULL; + if (parameters->slot != NULL) { + window = nautilus_window_slot_get_window (parameters->slot); } if (open_in_app_parameters != NULL || unhandled_open_in_app_uris != NULL) { if ((parameters->flags & NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND) != 0 && - window_info != NULL && - nautilus_window_info_get_window_type (window_info) == NAUTILUS_WINDOW_SPATIAL) { - nautilus_window_info_close (window_info); + window != NULL && + nautilus_window_get_window_type (window) == NAUTILUS_WINDOW_SPATIAL) { + nautilus_window_close (window); } } @@ -2264,7 +2267,7 @@ activation_start_mountables (ActivateParameters *parameters) **/ void nautilus_mime_activate_files (GtkWindow *parent_window, - NautilusWindowSlotInfo *slot_info, + NautilusWindowSlot *slot, GList *files, const char *launch_directory, NautilusWindowOpenMode mode, @@ -2285,8 +2288,8 @@ nautilus_mime_activate_files (GtkWindow *parent_window, DEBUG_FILES (files, "Calling activate_files() with files:"); parameters = g_new0 (ActivateParameters, 1); - parameters->slot_info = slot_info; - g_object_add_weak_pointer (G_OBJECT (parameters->slot_info), (gpointer *)¶meters->slot_info); + parameters->slot = slot; + g_object_add_weak_pointer (G_OBJECT (parameters->slot), (gpointer *)¶meters->slot); if (parent_window) { parameters->parent_window = parent_window; g_object_add_weak_pointer (G_OBJECT (parameters->parent_window), (gpointer *)¶meters->parent_window); @@ -2349,7 +2352,7 @@ nautilus_mime_activate_files (GtkWindow *parent_window, void nautilus_mime_activate_file (GtkWindow *parent_window, - NautilusWindowSlotInfo *slot_info, + NautilusWindowSlot *slot, NautilusFile *file, const char *launch_directory, NautilusWindowOpenMode mode, @@ -2360,6 +2363,6 @@ nautilus_mime_activate_file (GtkWindow *parent_window, g_return_if_fail (NAUTILUS_IS_FILE (file)); files = g_list_prepend (NULL, file); - nautilus_mime_activate_files (parent_window, slot_info, files, launch_directory, mode, flags, FALSE); + nautilus_mime_activate_files (parent_window, slot, files, launch_directory, mode, flags, FALSE); g_list_free (files); } diff --git a/src/nautilus-mime-actions.h b/src/nautilus-mime-actions.h index 5fd7839c9..a3d9c0cd8 100644 --- a/src/nautilus-mime-actions.h +++ b/src/nautilus-mime-actions.h @@ -28,8 +28,8 @@ #include <gio/gio.h> #include <libnautilus-private/nautilus-file.h> -#include <libnautilus-private/nautilus-window-info.h> -#include <libnautilus-private/nautilus-window-slot-info.h> + +#include "nautilus-window.h" NautilusFileAttributes nautilus_mime_actions_get_required_file_attributes (void); @@ -42,14 +42,14 @@ GList * nautilus_mime_get_applications_for_files (GList 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, - NautilusWindowSlotInfo *slot_info, + NautilusWindowSlot *slot, GList *files, const char *launch_directory, NautilusWindowOpenMode mode, NautilusWindowOpenFlags flags, gboolean user_confirmation); void nautilus_mime_activate_file (GtkWindow *parent_window, - NautilusWindowSlotInfo *slot_info, + NautilusWindowSlot *slot_info, NautilusFile *file, const char *launch_directory, NautilusWindowOpenMode mode, diff --git a/src/nautilus-navigation-window-menus.c b/src/nautilus-navigation-window-menus.c index 149e9b7b6..1a6407c38 100644 --- a/src/nautilus-navigation-window-menus.c +++ b/src/nautilus-navigation-window-menus.c @@ -591,15 +591,19 @@ static void action_new_window_callback (GtkAction *action, gpointer user_data) { - NautilusWindow *current_window; - NautilusWindow *new_window; + NautilusApplication *application; + NautilusWindow *current_window, *new_window; current_window = NAUTILUS_WINDOW (user_data); + application = nautilus_application_dup_singleton (); + new_window = nautilus_application_create_navigation_window ( - current_window->application, + application, NULL, gtk_window_get_screen (GTK_WINDOW (current_window))); nautilus_window_go_home (new_window); + + g_object_unref (application); } static void @@ -616,15 +620,18 @@ static void action_folder_window_callback (GtkAction *action, gpointer user_data) { + NautilusApplication *application; NautilusWindow *current_window, *window; NautilusWindowSlot *slot; GFile *current_location; current_window = NAUTILUS_WINDOW (user_data); + application = nautilus_application_dup_singleton (); slot = current_window->details->active_pane->active_slot; current_location = nautilus_window_slot_get_location (slot); + window = nautilus_application_get_spatial_window - (current_window->application, + (application, current_window, NULL, current_location, @@ -633,9 +640,8 @@ action_folder_window_callback (GtkAction *action, nautilus_window_go_to (window, current_location); - if (current_location != NULL) { - g_object_unref (current_location); - } + g_clear_object (¤t_location); + g_object_unref (application); } static void diff --git a/src/nautilus-navigation-window-pane.c b/src/nautilus-navigation-window-pane.c index d4e714389..49ae70ce0 100644 --- a/src/nautilus-navigation-window-pane.c +++ b/src/nautilus-navigation-window-pane.c @@ -31,8 +31,6 @@ #include "nautilus-notebook.h" #include <libnautilus-private/nautilus-global-preferences.h> -#include <libnautilus-private/nautilus-window-slot-info.h> -#include <libnautilus-private/nautilus-view-factory.h> #include <libnautilus-private/nautilus-entry.h> static void nautilus_navigation_window_pane_init (NautilusNavigationWindowPane *pane); @@ -262,9 +260,9 @@ path_bar_button_released_callback (GtkWidget *widget, if (flags != 0) { slot = nautilus_window_get_active_slot (NAUTILUS_WINDOW_PANE (pane)->window); - nautilus_window_slot_info_open_location (slot, location, + nautilus_window_slot_open_location_full (slot, location, NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE, - flags, NULL); + flags, NULL, NULL, NULL); g_object_unref (location); return TRUE; } diff --git a/src/nautilus-navigation-window-slot.c b/src/nautilus-navigation-window-slot.c index d450ae73a..f7dbcb2cb 100644 --- a/src/nautilus-navigation-window-slot.c +++ b/src/nautilus-navigation-window-slot.c @@ -27,7 +27,6 @@ #include "nautilus-window-private.h" #include "nautilus-search-bar.h" #include "nautilus-navigation-window-pane.h" -#include <libnautilus-private/nautilus-window-slot-info.h> #include <libnautilus-private/nautilus-file.h> #include <eel/eel-gtk-macros.h> diff --git a/src/nautilus-navigation-window.c b/src/nautilus-navigation-window.c index 84441b53f..68ad1229e 100644 --- a/src/nautilus-navigation-window.c +++ b/src/nautilus-navigation-window.c @@ -60,7 +60,6 @@ #include <libnautilus-private/nautilus-icon-info.h> #include <libnautilus-private/nautilus-metadata.h> #include <libnautilus-private/nautilus-program-choosing.h> -#include <libnautilus-private/nautilus-view-factory.h> #include <libnautilus-private/nautilus-clipboard.h> #include <libnautilus-private/nautilus-undo.h> #include <libnautilus-private/nautilus-module.h> @@ -422,9 +421,6 @@ real_sync_title (NautilusWindow *window, navigation_window = NAUTILUS_NAVIGATION_WINDOW (window); - EEL_CALL_PARENT (NAUTILUS_WINDOW_CLASS, - sync_title, (window, slot)); - if (slot == window->details->active_pane->active_slot) { /* if spatial mode is default, we keep "File Browser" in the window title * to recognize browser windows. Otherwise, we default to the directory name. @@ -833,9 +829,9 @@ nautilus_navigation_window_set_up_sidebar (NautilusNavigationWindow *window) window); if (g_strcmp0 (window->details->sidebar_id, NAUTILUS_NAVIGATION_WINDOW_SIDEBAR_PLACES) == 0) { - sidebar = nautilus_places_sidebar_new (NAUTILUS_WINDOW_INFO (window)); + sidebar = nautilus_places_sidebar_new (NAUTILUS_WINDOW (window)); } else if (g_strcmp0 (window->details->sidebar_id, NAUTILUS_NAVIGATION_WINDOW_SIDEBAR_TREE) == 0) { - sidebar = nautilus_tree_sidebar_new (NAUTILUS_WINDOW_INFO (window)); + sidebar = nautilus_tree_sidebar_new (NAUTILUS_WINDOW (window)); } else { g_assert_not_reached (); } diff --git a/src/nautilus-places-sidebar.c b/src/nautilus-places-sidebar.c index 1e6b65ba2..335534836 100644 --- a/src/nautilus-places-sidebar.c +++ b/src/nautilus-places-sidebar.c @@ -38,8 +38,6 @@ #include <libnautilus-private/nautilus-file-operations.h> #include <libnautilus-private/nautilus-trash-monitor.h> #include <libnautilus-private/nautilus-icon-names.h> -#include <libnautilus-private/nautilus-window-info.h> -#include <libnautilus-private/nautilus-window-slot-info.h> #include <eel/eel-debug.h> #include <eel/eel-gtk-extensions.h> @@ -48,9 +46,11 @@ #include <eel/eel-stock-dialogs.h> #include <eel/eel-gdk-pixbuf-extensions.h> +#include "nautilus-application.h" #include "nautilus-bookmark-list.h" #include "nautilus-places-sidebar.h" #include "nautilus-window.h" +#include "nautilus-window-slot.h" #define DEBUG_FLAG NAUTILUS_DEBUG_PLACES #include <libnautilus-private/nautilus-debug.h> @@ -68,7 +68,7 @@ typedef struct { char *uri; GtkListStore *store; GtkTreeModel *filter_model; - NautilusWindowInfo *window; + NautilusWindow *window; NautilusBookmarkList *bookmarks; GVolumeMonitor *volume_monitor; @@ -97,7 +97,7 @@ typedef struct { /* volume mounting - delayed open process */ gboolean mounting; - NautilusWindowSlotInfo *go_to_after_mount_slot; + NautilusWindowSlot *go_to_after_mount_slot; NautilusWindowOpenFlags go_to_after_mount_flags; GtkTreePath *eject_highlight_path; @@ -435,7 +435,7 @@ update_places (NautilusPlacesSidebar *sidebar) const gchar *path; GIcon *icon; GFile *root; - NautilusWindowSlotInfo *slot; + NautilusWindowSlot *slot; char *tooltip; GList *network_mounts; NautilusFile *file; @@ -455,8 +455,8 @@ update_places (NautilusPlacesSidebar *sidebar) sidebar->devices_header_added = FALSE; sidebar->bookmarks_header_added = FALSE; - slot = nautilus_window_info_get_active_slot (sidebar->window); - location = nautilus_window_slot_info_get_current_location (slot); + slot = nautilus_window_get_active_slot (sidebar->window); + location = nautilus_window_slot_get_current_location (slot); volume_monitor = sidebar->volume_monitor; @@ -1001,7 +1001,7 @@ desktop_location_changed_callback (gpointer user_data) } static void -loading_uri_callback (NautilusWindowInfo *window, +loading_uri_callback (NautilusWindow *window, char *location, NautilusPlacesSidebar *sidebar) { @@ -1739,17 +1739,21 @@ volume_mounted_cb (GVolume *volume, if (sidebar->go_to_after_mount_slot != NULL) { if ((sidebar->go_to_after_mount_flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW) == 0) { - nautilus_window_slot_info_open_location (sidebar->go_to_after_mount_slot, location, + nautilus_window_slot_open_location_full (sidebar->go_to_after_mount_slot, location, NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE, - sidebar->go_to_after_mount_flags, NULL); + sidebar->go_to_after_mount_flags, NULL, NULL, NULL); } else { - NautilusWindow *cur, *new; - + NautilusApplication *app; + NautilusWindow *new, *cur; + cur = NAUTILUS_WINDOW (sidebar->window); - new = nautilus_application_create_navigation_window (cur->application, + app = nautilus_application_dup_singleton (); + new = nautilus_application_create_navigation_window (app, NULL, gtk_window_get_screen (GTK_WINDOW (cur))); nautilus_window_go_to (new, location); + + g_object_unref (app); } } @@ -1791,7 +1795,7 @@ open_selected_bookmark (NautilusPlacesSidebar *sidebar, GtkTreePath *path, NautilusWindowOpenFlags flags) { - NautilusWindowSlotInfo *slot; + NautilusWindowSlot *slot; GtkTreeIter iter; GFile *location; char *uri; @@ -1812,18 +1816,22 @@ open_selected_bookmark (NautilusPlacesSidebar *sidebar, location = g_file_new_for_uri (uri); /* Navigate to the clicked location */ if ((flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW) == 0) { - slot = nautilus_window_info_get_active_slot (sidebar->window); - nautilus_window_slot_info_open_location (slot, location, + slot = nautilus_window_get_active_slot (sidebar->window); + nautilus_window_slot_open_location_full (slot, location, NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE, - flags, NULL); + flags, NULL, NULL, NULL); } else { NautilusWindow *cur, *new; + NautilusApplication *app; cur = NAUTILUS_WINDOW (sidebar->window); - new = nautilus_application_create_navigation_window (cur->application, + app = nautilus_application_dup_singleton (); + new = nautilus_application_create_navigation_window (app, NULL, gtk_window_get_screen (GTK_WINDOW (cur))); nautilus_window_go_to (new, location); + + g_object_unref (app); } g_object_unref (location); g_free (uri); @@ -1843,7 +1851,7 @@ open_selected_bookmark (NautilusPlacesSidebar *sidebar, g_assert (sidebar->go_to_after_mount_slot == NULL); - slot = nautilus_window_info_get_active_slot (sidebar->window); + slot = nautilus_window_get_active_slot (sidebar->window); sidebar->go_to_after_mount_slot = slot; eel_add_weak_pointer (&(sidebar->go_to_after_mount_slot)); @@ -1995,7 +2003,7 @@ unmount_done (gpointer data) NautilusWindow *window; window = data; - nautilus_window_info_set_initiated_unmount (window, FALSE); + nautilus_window_set_initiated_unmount (window, FALSE); g_object_unref (window); } @@ -2004,7 +2012,7 @@ do_unmount (GMount *mount, NautilusPlacesSidebar *sidebar) { if (mount != NULL) { - nautilus_window_info_set_initiated_unmount (sidebar->window, TRUE); + nautilus_window_set_initiated_unmount (sidebar->window, TRUE); nautilus_file_operations_unmount_mount_full (NULL, mount, FALSE, TRUE, unmount_done, g_object_ref (sidebar->window)); @@ -2049,7 +2057,7 @@ drive_eject_cb (GObject *source_object, char *name; window = user_data; - nautilus_window_info_set_initiated_unmount (window, FALSE); + nautilus_window_set_initiated_unmount (window, FALSE); g_object_unref (window); error = NULL; @@ -2078,7 +2086,7 @@ volume_eject_cb (GObject *source_object, char *name; window = user_data; - nautilus_window_info_set_initiated_unmount (window, FALSE); + nautilus_window_set_initiated_unmount (window, FALSE); g_object_unref (window); error = NULL; @@ -2107,7 +2115,7 @@ mount_eject_cb (GObject *source_object, char *name; window = user_data; - nautilus_window_info_set_initiated_unmount (window, FALSE); + nautilus_window_set_initiated_unmount (window, FALSE); g_object_unref (window); error = NULL; @@ -2135,15 +2143,15 @@ do_eject (GMount *mount, mount_op = gtk_mount_operation_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (sidebar)))); if (mount != NULL) { - nautilus_window_info_set_initiated_unmount (sidebar->window, TRUE); + nautilus_window_set_initiated_unmount (sidebar->window, TRUE); g_mount_eject_with_operation (mount, 0, mount_op, NULL, mount_eject_cb, g_object_ref (sidebar->window)); } else if (volume != NULL) { - nautilus_window_info_set_initiated_unmount (sidebar->window, TRUE); + nautilus_window_set_initiated_unmount (sidebar->window, TRUE); g_volume_eject_with_operation (volume, 0, mount_op, NULL, volume_eject_cb, g_object_ref (sidebar->window)); } else if (drive != NULL) { - nautilus_window_info_set_initiated_unmount (sidebar->window, TRUE); + nautilus_window_set_initiated_unmount (sidebar->window, TRUE); g_drive_eject_with_operation (drive, 0, mount_op, NULL, drive_eject_cb, g_object_ref (sidebar->window)); } @@ -2358,7 +2366,7 @@ drive_stop_cb (GObject *source_object, char *name; window = user_data; - nautilus_window_info_set_initiated_unmount (window, FALSE); + nautilus_window_set_initiated_unmount (window, FALSE); g_object_unref (window); error = NULL; @@ -2395,7 +2403,7 @@ stop_shortcut_cb (GtkMenuItem *item, GMountOperation *mount_op; mount_op = gtk_mount_operation_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (sidebar)))); - nautilus_window_info_set_initiated_unmount (sidebar->window, TRUE); + nautilus_window_set_initiated_unmount (sidebar->window, TRUE); g_drive_stop (drive, G_MOUNT_UNMOUNT_NONE, mount_op, NULL, drive_stop_cb, g_object_ref (sidebar->window)); g_object_unref (mount_op); @@ -3178,16 +3186,16 @@ nautilus_places_sidebar_class_init (NautilusPlacesSidebarClass *class) static void nautilus_places_sidebar_set_parent_window (NautilusPlacesSidebar *sidebar, - NautilusWindowInfo *window) + NautilusWindow *window) { - NautilusWindowSlotInfo *slot; + NautilusWindowSlot *slot; sidebar->window = window; - slot = nautilus_window_info_get_active_slot (window); + slot = nautilus_window_get_active_slot (window); sidebar->bookmarks = nautilus_bookmark_list_new (); - sidebar->uri = nautilus_window_slot_info_get_current_location (slot); + sidebar->uri = nautilus_window_slot_get_current_location (slot); g_signal_connect_object (sidebar->bookmarks, "contents_changed", G_CALLBACK (update_places), @@ -3231,7 +3239,7 @@ nautilus_places_sidebar_style_set (GtkWidget *widget, } GtkWidget * -nautilus_places_sidebar_new (NautilusWindowInfo *window) +nautilus_places_sidebar_new (NautilusWindow *window) { NautilusPlacesSidebar *sidebar; diff --git a/src/nautilus-places-sidebar.h b/src/nautilus-places-sidebar.h index 8487860f3..470b82555 100644 --- a/src/nautilus-places-sidebar.h +++ b/src/nautilus-places-sidebar.h @@ -24,8 +24,8 @@ #ifndef _NAUTILUS_PLACES_SIDEBAR_H #define _NAUTILUS_PLACES_SIDEBAR_H -#include <libnautilus-private/nautilus-view.h> -#include <libnautilus-private/nautilus-window-info.h> +#include "nautilus-window.h" + #include <gtk/gtk.h> #define NAUTILUS_PLACES_SIDEBAR_ID "places" @@ -44,7 +44,7 @@ GType nautilus_places_sidebar_get_type (void); -GtkWidget * nautilus_places_sidebar_new (NautilusWindowInfo *window); +GtkWidget * nautilus_places_sidebar_new (NautilusWindow *window); #endif diff --git a/src/nautilus-query-editor.h b/src/nautilus-query-editor.h index de06b87ac..077e5059a 100644 --- a/src/nautilus-query-editor.h +++ b/src/nautilus-query-editor.h @@ -25,9 +25,10 @@ #define NAUTILUS_QUERY_EDITOR_H #include <gtk/gtk.h> + #include <libnautilus-private/nautilus-query.h> -#include <libnautilus-private/nautilus-window-info.h> -#include <nautilus-search-bar.h> + +#include "nautilus-search-bar.h" #define NAUTILUS_TYPE_QUERY_EDITOR nautilus_query_editor_get_type() #define NAUTILUS_QUERY_EDITOR(obj) \ @@ -57,6 +58,8 @@ typedef struct { void (* cancel) (NautilusQueryEditor *editor); } NautilusQueryEditorClass; +#include "nautilus-window-slot.h" + GType nautilus_query_editor_get_type (void); GtkWidget* nautilus_query_editor_new (gboolean start_hidden, gboolean is_indexed); diff --git a/src/nautilus-spatial-window.c b/src/nautilus-spatial-window.c index cccc5a400..766178c0b 100644 --- a/src/nautilus-spatial-window.c +++ b/src/nautilus-spatial-window.c @@ -345,12 +345,9 @@ real_get_icon (NautilusWindow *window, } static void -sync_window_title (NautilusWindow *window) +real_sync_title (NautilusWindow *window, + NautilusWindowSlot *slot) { - NautilusWindowSlot *slot; - - slot = nautilus_window_get_active_slot (window); - if (slot->title == NULL || slot->title[0] == '\0') { gtk_window_set_title (GTK_WINDOW (window), _("Nautilus")); } else { @@ -363,15 +360,6 @@ sync_window_title (NautilusWindow *window) } static void -real_sync_title (NautilusWindow *window, - NautilusWindowSlot *slot) -{ - g_assert (slot == nautilus_window_get_active_slot (window)); - - sync_window_title (window); -} - -static void real_get_min_size (NautilusWindow *window, guint *min_width, guint *min_height) { diff --git a/src/nautilus-trash-bar.c b/src/nautilus-trash-bar.c index f86e8af53..030e75529 100644 --- a/src/nautilus-trash-bar.c +++ b/src/nautilus-trash-bar.c @@ -58,7 +58,7 @@ restore_button_clicked_cb (GtkWidget *button, { GList *locations, *files, *l; - locations = nautilus_window_info_get_selection (NAUTILUS_WINDOW_INFO (bar->priv->window)); + locations = nautilus_window_get_selection (bar->priv->window); files = NULL; for (l = locations; l != NULL; l = l->next) { @@ -77,7 +77,7 @@ selection_changed_cb (NautilusWindow *window, { int count; - count = nautilus_window_info_get_selection_count (NAUTILUS_WINDOW_INFO (window)); + count = nautilus_window_get_selection_count (window); gtk_widget_set_sensitive (bar->priv->restore_button, (count > 0)); } diff --git a/src/nautilus-tree-sidebar.c b/src/nautilus-tree-sidebar.c index 6ae2c52cd..1b5942def 100644 --- a/src/nautilus-tree-sidebar.c +++ b/src/nautilus-tree-sidebar.c @@ -35,6 +35,7 @@ #include "nautilus-tree-sidebar-model.h" #include "file-manager/fm-properties-window.h" +#include "nautilus-window-slot.h" #include <libnautilus-private/nautilus-clipboard.h> #include <libnautilus-private/nautilus-clipboard-monitor.h> @@ -47,8 +48,6 @@ #include <libnautilus-private/nautilus-program-choosing.h> #include <libnautilus-private/nautilus-tree-view-drag-dest.h> #include <libnautilus-private/nautilus-module.h> -#include <libnautilus-private/nautilus-window-info.h> -#include <libnautilus-private/nautilus-window-slot-info.h> #include <string.h> #include <eel/eel-gtk-extensions.h> @@ -69,7 +68,7 @@ typedef struct { struct FMTreeViewDetails { - NautilusWindowInfo *window; + NautilusWindow *window; GtkTreeView *tree_widget; GtkTreeModelSort *sort_model; FMTreeModel *child_model; @@ -336,7 +335,7 @@ got_activation_uri_callback (NautilusFile *file, gpointer callback_data) FMTreeView *view; GdkScreen *screen; GFile *location; - NautilusWindowSlotInfo *slot; + NautilusWindowSlot *slot; gboolean open_in_same_slot; view = FM_TREE_VIEW (callback_data); @@ -350,7 +349,7 @@ got_activation_uri_callback (NautilusFile *file, gpointer callback_data) (NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW | NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB)) == 0; - slot = nautilus_window_info_get_active_slot (view->details->window); + slot = nautilus_window_get_active_slot (view->details->window); uri = nautilus_file_get_activation_uri (file); if (nautilus_file_is_launcher (file)) { @@ -370,12 +369,12 @@ got_activation_uri_callback (NautilusFile *file, gpointer callback_data) DEBUG ("Tree sidebar, opening location %s", uri); location = g_file_new_for_uri (uri); - nautilus_window_slot_info_open_location + nautilus_window_slot_open_location_full (slot, location, NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE, view->details->activation_flags, - NULL); + NULL, NULL, NULL); g_object_unref (location); } else { DEBUG ("Tree sidebar, launching application for %s", file_uri); @@ -397,12 +396,12 @@ got_activation_uri_callback (NautilusFile *file, gpointer callback_data) DEBUG ("Tree sidebar, opening location %s", uri); location = g_file_new_for_uri (uri); - nautilus_window_slot_info_open_location + nautilus_window_slot_open_location_full (slot, location, NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE, view->details->activation_flags, - NULL); + NULL, NULL, NULL); g_object_unref (location); } } @@ -911,7 +910,7 @@ copy_or_cut_files (FMTreeView *view, } g_free (name); - nautilus_window_info_push_status (view->details->window, + nautilus_window_push_status (view->details->window, status_string); g_free (status_string); } @@ -943,7 +942,7 @@ paste_clipboard_data (FMTreeView *view, copied_files_atom); if (item_uris == NULL|| destination_uri == NULL) { - nautilus_window_info_push_status (view->details->window, + nautilus_window_push_status (view->details->window, _("There is nothing on the clipboard to paste.")); } else { nautilus_file_operations_copy_move @@ -1292,7 +1291,7 @@ create_tree (FMTreeView *view) GList *mounts, *l; char *location; GIcon *icon; - NautilusWindowSlotInfo *slot; + NautilusWindowSlot *slot; view->details->child_model = fm_tree_model_new (); view->details->sort_model = GTK_TREE_MODEL_SORT @@ -1394,8 +1393,8 @@ create_tree (FMTreeView *view) "button_press_event", G_CALLBACK (button_pressed_callback), view); - slot = nautilus_window_info_get_active_slot (view->details->window); - location = nautilus_window_slot_info_get_current_location (slot); + slot = nautilus_window_get_active_slot (view->details->window); + location = nautilus_window_slot_get_current_location (slot); schedule_select_and_show_location (view, location); g_free (location); } @@ -1409,7 +1408,7 @@ update_filtering_from_preferences (FMTreeView *view) return; } - mode = nautilus_window_info_get_hidden_files_mode (view->details->window); + mode = nautilus_window_get_hidden_files_mode (view->details->window); if (mode == NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT) { fm_tree_model_set_show_hidden_files @@ -1448,7 +1447,7 @@ filtering_changed_callback (gpointer callback_data) } static void -loading_uri_callback (NautilusWindowInfo *window, +loading_uri_callback (NautilusWindow *window, char *location, gpointer callback_data) { @@ -1584,7 +1583,7 @@ fm_tree_view_class_init (FMTreeViewClass *class) copied_files_atom = gdk_atom_intern ("x-special/gnome-copied-files", FALSE); } static void -hidden_files_mode_changed_callback (NautilusWindowInfo *window, +hidden_files_mode_changed_callback (NautilusWindow *window, FMTreeView *view) { update_filtering_from_preferences (view); @@ -1592,18 +1591,18 @@ hidden_files_mode_changed_callback (NautilusWindowInfo *window, static void fm_tree_view_set_parent_window (FMTreeView *sidebar, - NautilusWindowInfo *window) + NautilusWindow *window) { char *location; - NautilusWindowSlotInfo *slot; + NautilusWindowSlot *slot; sidebar->details->window = window; - slot = nautilus_window_info_get_active_slot (window); + slot = nautilus_window_get_active_slot (window); g_signal_connect_object (window, "loading_uri", G_CALLBACK (loading_uri_callback), sidebar, 0); - location = nautilus_window_slot_info_get_current_location (slot); + location = nautilus_window_slot_get_current_location (slot); loading_uri_callback (window, location, sidebar); g_free (location); @@ -1613,7 +1612,7 @@ fm_tree_view_set_parent_window (FMTreeView *sidebar, } GtkWidget * -nautilus_tree_sidebar_new (NautilusWindowInfo *window) +nautilus_tree_sidebar_new (NautilusWindow *window) { FMTreeView *sidebar; diff --git a/src/nautilus-tree-sidebar.h b/src/nautilus-tree-sidebar.h index 69e67e10e..7d5735077 100644 --- a/src/nautilus-tree-sidebar.h +++ b/src/nautilus-tree-sidebar.h @@ -31,7 +31,7 @@ #include <gtk/gtk.h> -#include <libnautilus-private/nautilus-window-info.h> +#include "nautilus-window.h" #define FM_TYPE_TREE_VIEW fm_tree_view_get_type() #define FM_TREE_VIEW(obj) \ @@ -61,6 +61,6 @@ typedef struct { GType fm_tree_view_get_type (void); -GtkWidget *nautilus_tree_sidebar_new (NautilusWindowInfo *window); +GtkWidget *nautilus_tree_sidebar_new (NautilusWindow *window); #endif /* FM_TREE_VIEW_H */ diff --git a/src/nautilus-view-as-action.c b/src/nautilus-view-as-action.c index e61323cba..72ebde1fc 100644 --- a/src/nautilus-view-as-action.c +++ b/src/nautilus-view-as-action.c @@ -26,12 +26,14 @@ #include <config.h> #include "nautilus-view-as-action.h" + #include "nautilus-navigation-window.h" -#include "nautilus-window-private.h" #include "nautilus-navigation-window-slot.h" +#include "nautilus-view-factory.h" +#include "nautilus-window-private.h" + #include <gtk/gtk.h> #include <eel/eel-gtk-extensions.h> -#include <libnautilus-private/nautilus-view-factory.h> G_DEFINE_TYPE (NautilusViewAsAction, nautilus_view_as_action, GTK_TYPE_ACTION) diff --git a/libnautilus-private/nautilus-view-factory.c b/src/nautilus-view-factory.c index d5476c288..eddd63a46 100644 --- a/libnautilus-private/nautilus-view-factory.c +++ b/src/nautilus-view-factory.c @@ -57,7 +57,7 @@ nautilus_view_factory_lookup (const char *id) NautilusView * nautilus_view_factory_create (const char *id, - NautilusWindowSlotInfo *slot) + NautilusWindowSlot *slot) { const NautilusViewInfo *view_info; NautilusView *view; diff --git a/libnautilus-private/nautilus-view-factory.h b/src/nautilus-view-factory.h index 8aa527ecc..20f6b0178 100644 --- a/libnautilus-private/nautilus-view-factory.h +++ b/src/nautilus-view-factory.h @@ -28,9 +28,10 @@ #include <string.h> #include <libnautilus-private/nautilus-view.h> -#include <libnautilus-private/nautilus-window-slot-info.h> #include <gio/gio.h> +#include "nautilus-window-slot.h" + G_BEGIN_DECLS typedef struct _NautilusViewInfo NautilusViewInfo; @@ -42,7 +43,7 @@ struct _NautilusViewInfo { 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) (NautilusWindowSlotInfo *slot); + NautilusView * (*create) (NautilusWindowSlot *slot); /* BONOBOTODO: More args here */ gboolean (*supports_uri) (const char *uri, GFileType file_type, @@ -53,7 +54,7 @@ struct _NautilusViewInfo { 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, - NautilusWindowSlotInfo *slot); + NautilusWindowSlot *slot); gboolean nautilus_view_factory_view_supports_uri (const char *id, GFile *location, GFileType file_type, diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c index 8760353cb..d9feeb1df 100644 --- a/src/nautilus-window-manage-views.c +++ b/src/nautilus-window-manage-views.c @@ -37,6 +37,7 @@ #include "nautilus-window-slot.h" #include "nautilus-navigation-window-slot.h" #include "nautilus-trash-bar.h" +#include "nautilus-view-factory.h" #include "nautilus-x-content-bar.h" #include "nautilus-zoom-control.h" #include "nautilus-navigation-window-pane.h" @@ -60,9 +61,6 @@ #include <libnautilus-private/nautilus-module.h> #include <libnautilus-private/nautilus-monitor.h> #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> #define DEBUG_FLAG NAUTILUS_DEBUG_WINDOW #include <libnautilus-private/nautilus-debug.h> @@ -108,7 +106,7 @@ static void location_has_really_changed (NautilusWindowSlot static void update_for_new_location (NautilusWindowSlot *slot); void -nautilus_window_report_selection_changed (NautilusWindowInfo *window) +nautilus_window_report_selection_changed (NautilusWindow *window) { if (window->details->temporarily_ignore_view_signals) { return; @@ -494,6 +492,7 @@ nautilus_window_slot_open_location_full (NautilusWindowSlot *slot, GList *l; gboolean target_spatial, target_navigation, target_same; gboolean is_desktop; + NautilusApplication *app; window = slot->pane->window; @@ -554,17 +553,19 @@ nautilus_window_slot_open_location_full (NautilusWindowSlot *slot, return; } + app = nautilus_application_dup_singleton (); + /* now get/create the window according to the mode */ if (target_same) { target_window = window; } else if (target_navigation) { target_window = nautilus_application_create_navigation_window - (window->application, + (app, NULL, gtk_window_get_screen (GTK_WINDOW (window))); } else { target_window = nautilus_application_get_spatial_window - (window->application, + (app, window, NULL, location, @@ -572,6 +573,8 @@ nautilus_window_slot_open_location_full (NautilusWindowSlot *slot, &existing); } + g_object_unref (app); + /* if the spatial window is already showing, present it and set the * new selection, if present. */ @@ -1280,8 +1283,7 @@ create_content_view (NautilusWindowSlot *slot, g_object_ref (view); } else { /* create a new content view */ - view = nautilus_view_factory_create (view_id, - NAUTILUS_WINDOW_SLOT_INFO (slot)); + view = nautilus_view_factory_create (view_id, slot); eel_accessibility_set_name (view, _("Content View")); eel_accessibility_set_description (view, _("View of the current folder")); diff --git a/src/nautilus-window-manage-views.h b/src/nautilus-window-manage-views.h index dd85eda5d..df9bc9eb8 100644 --- a/src/nautilus-window-manage-views.h +++ b/src/nautilus-window-manage-views.h @@ -36,13 +36,8 @@ void nautilus_window_manage_views_close_slot (NautilusWindowPane *pane, /* NautilusWindowInfo implementation: */ -void nautilus_window_report_load_underway (NautilusWindow *window, - NautilusView *view); -void nautilus_window_report_selection_changed (NautilusWindowInfo *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); void nautilus_window_update_up_button (NautilusWindow *window); diff --git a/src/nautilus-window-menus.c b/src/nautilus-window-menus.c index f78f3f101..fc438e2db 100644 --- a/src/nautilus-window-menus.c +++ b/src/nautilus-window-menus.c @@ -262,8 +262,12 @@ static void action_undo_callback (GtkAction *action, gpointer user_data) { - nautilus_undo_manager_undo - (NAUTILUS_WINDOW (user_data)->application->undo_manager); + NautilusApplication *app; + + app = nautilus_application_dup_singleton (); + nautilus_undo_manager_undo (app->undo_manager); + + g_object_unref (app); } static void @@ -398,7 +402,7 @@ action_show_hidden_files_callback (GtkAction *action, mode = NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DISABLE; } - nautilus_window_info_set_hidden_files_mode (window, mode); + nautilus_window_set_hidden_files_mode (window, mode); } static void @@ -420,7 +424,7 @@ show_hidden_files_preference_callback (gpointer callback_data) g_signal_handlers_unblock_by_func (action, action_show_hidden_files_callback, window); /* inform views */ - nautilus_window_info_set_hidden_files_mode (window, NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT); + nautilus_window_set_hidden_files_mode (window, NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT); } } diff --git a/src/nautilus-window-private.h b/src/nautilus-window-private.h index 1e63c4f5e..778332227 100644 --- a/src/nautilus-window-private.h +++ b/src/nautilus-window-private.h @@ -87,6 +87,8 @@ struct NautilusWindowDetails * an unmount operation. */ gboolean initiated_unmount; + + NautilusApplication *application; }; struct _NautilusNavigationWindowDetails { diff --git a/src/nautilus-window-slot-dnd.c b/src/nautilus-window-slot-dnd.c index 660619b90..c735c969d 100644 --- a/src/nautilus-window-slot-dnd.c +++ b/src/nautilus-window-slot-dnd.c @@ -42,7 +42,7 @@ typedef struct { } data; GFile *target_location; - NautilusWindowSlotInfo *target_slot; + NautilusWindowSlot *target_slot; } NautilusDragSlotProxyInfo; static gboolean @@ -54,7 +54,7 @@ slot_proxy_drag_motion (GtkWidget *widget, gpointer user_data) { NautilusDragSlotProxyInfo *drag_info; - NautilusWindowSlotInfo *target_slot; + NautilusWindowSlot *target_slot; GtkWidget *window; GdkAtom target; int action; @@ -69,7 +69,7 @@ slot_proxy_drag_motion (GtkWidget *widget, } window = gtk_widget_get_toplevel (widget); - g_assert (NAUTILUS_IS_WINDOW_INFO (window)); + g_assert (NAUTILUS_IS_WINDOW (window)); if (!drag_info->have_data) { target = gtk_drag_dest_find_target (widget, context, NULL); @@ -88,11 +88,11 @@ slot_proxy_drag_motion (GtkWidget *widget, if (drag_info->target_slot != NULL) { target_slot = drag_info->target_slot; } else { - target_slot = nautilus_window_info_get_active_slot (NAUTILUS_WINDOW_INFO (window)); + target_slot = nautilus_window_get_active_slot (NAUTILUS_WINDOW (window)); } if (target_slot != NULL) { - target_uri = nautilus_window_slot_info_get_current_location (target_slot); + target_uri = nautilus_window_slot_get_current_location (target_slot); } } @@ -200,7 +200,7 @@ slot_proxy_handle_drop (GtkWidget *widget, NautilusDragSlotProxyInfo *drag_info) { GtkWidget *window; - NautilusWindowSlotInfo *target_slot; + NautilusWindowSlot *target_slot; NautilusView *target_view; char *target_uri; GList *uri_list; @@ -213,24 +213,24 @@ slot_proxy_handle_drop (GtkWidget *widget, } window = gtk_widget_get_toplevel (widget); - g_assert (NAUTILUS_IS_WINDOW_INFO (window)); + g_assert (NAUTILUS_IS_WINDOW (window)); if (drag_info->target_slot != NULL) { target_slot = drag_info->target_slot; } else { - target_slot = nautilus_window_info_get_active_slot (NAUTILUS_WINDOW_INFO (window)); + target_slot = nautilus_window_get_active_slot (NAUTILUS_WINDOW (window)); } target_uri = NULL; if (drag_info->target_location != NULL) { target_uri = g_file_get_uri (drag_info->target_location); } else if (target_slot != NULL) { - target_uri = nautilus_window_slot_info_get_current_location (target_slot); + target_uri = nautilus_window_slot_get_current_location (target_slot); } target_view = NULL; if (target_slot != NULL) { - target_view = nautilus_window_slot_info_get_current_view (target_slot); + target_view = nautilus_window_slot_get_current_view (target_slot); } if (target_slot != NULL && target_view != NULL) { diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c index 8be9a2da4..eae0be3ab 100644 --- a/src/nautilus-window-slot.c +++ b/src/nautilus-window-slot.c @@ -29,7 +29,6 @@ #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> @@ -37,15 +36,17 @@ static void nautilus_window_slot_init (NautilusWindowSlot *slot); static void nautilus_window_slot_class_init (NautilusWindowSlotClass *class); static void nautilus_window_slot_dispose (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)) +G_DEFINE_TYPE (NautilusWindowSlot, nautilus_window_slot, G_TYPE_OBJECT); #define parent_class nautilus_window_slot_parent_class +enum { + ACTIVE, + INACTIVE, + LAST_SIGNAL +}; + +static guint signals[LAST_SIGNAL] = { 0 }; + static void query_editor_changed_callback (NautilusSearchBar *bar, NautilusQuery *query, @@ -125,23 +126,6 @@ real_active (NautilusWindowSlot *slot) } static void -nautilus_window_slot_active (NautilusWindowSlot *slot) -{ - NautilusWindow *window; - NautilusWindowPane *pane; - - g_assert (NAUTILUS_IS_WINDOW_SLOT (slot)); - - pane = NAUTILUS_WINDOW_PANE (slot->pane); - window = NAUTILUS_WINDOW (slot->pane->window); - g_assert (g_list_find (pane->slots, slot) != NULL); - g_assert (slot == window->details->active_pane->active_slot); - - EEL_CALL_METHOD (NAUTILUS_WINDOW_SLOT_CLASS, slot, - active, (slot)); -} - -static void real_inactive (NautilusWindowSlot *slot) { NautilusWindow *window; @@ -151,25 +135,6 @@ real_inactive (NautilusWindowSlot *slot) } static void -nautilus_window_slot_inactive (NautilusWindowSlot *slot) -{ - NautilusWindow *window; - NautilusWindowPane *pane; - - g_assert (NAUTILUS_IS_WINDOW_SLOT (slot)); - - pane = NAUTILUS_WINDOW_PANE (slot->pane); - window = NAUTILUS_WINDOW (pane->window); - - g_assert (g_list_find (pane->slots, slot) != NULL); - g_assert (slot == window->details->active_pane->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, *frame; @@ -206,22 +171,29 @@ nautilus_window_slot_class_init (NautilusWindowSlotClass *class) { class->active = real_active; class->inactive = real_inactive; - class->update_query_editor = real_update_query_editor; + class->update_query_editor = real_update_query_editor; + + signals[ACTIVE] = + g_signal_new ("active", + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (NautilusWindowSlotClass, active), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + signals[INACTIVE] = + g_signal_new ("inactive", + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (NautilusWindowSlotClass, inactive), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); G_OBJECT_CLASS (class)->dispose = nautilus_window_slot_dispose; } -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) { @@ -235,7 +207,7 @@ nautilus_window_slot_get_location (NautilusWindowSlot *slot) } char * -nautilus_window_slot_get_location_uri (NautilusWindowSlotInfo *slot) +nautilus_window_slot_get_location_uri (NautilusWindowSlot *slot) { g_assert (NAUTILUS_IS_WINDOW_SLOT (slot)); @@ -245,7 +217,7 @@ nautilus_window_slot_get_location_uri (NautilusWindowSlotInfo *slot) return NULL; } -static void +void nautilus_window_slot_make_hosting_pane_active (NautilusWindowSlot *slot) { g_assert (NAUTILUS_IS_WINDOW_SLOT (slot)); @@ -275,7 +247,7 @@ nautilus_window_slot_get_title (NautilusWindowSlot *slot) return title; } -static NautilusWindow * +NautilusWindow * nautilus_window_slot_get_window (NautilusWindowSlot *slot) { g_assert (NAUTILUS_IS_WINDOW_SLOT (slot)); @@ -552,13 +524,9 @@ nautilus_window_slot_add_current_location_to_history_list (NautilusWindowSlot *s } /* returns either the pending or the actual current location - used by side panes. */ -static char * -real_slot_info_get_current_location (NautilusWindowSlotInfo *info) +char * +nautilus_window_slot_get_current_location (NautilusWindowSlot *slot) { - NautilusWindowSlot *slot; - - slot = NAUTILUS_WINDOW_SLOT (info); - if (slot->pending_location != NULL) { return g_file_get_uri (slot->pending_location); } @@ -571,13 +539,9 @@ real_slot_info_get_current_location (NautilusWindowSlotInfo *info) return NULL; } -static NautilusView * -real_slot_info_get_current_view (NautilusWindowSlotInfo *info) +NautilusView * +nautilus_window_slot_get_current_view (NautilusWindowSlot *slot) { - NautilusWindowSlot *slot; - - slot = NAUTILUS_WINDOW_SLOT (info); - if (slot->content_view != NULL) { return g_object_ref (slot->content_view); } else if (slot->new_content_view) { @@ -647,19 +611,3 @@ nautilus_window_slot_dispose (GObject *object) G_OBJECT_CLASS (parent_class)->dispose (object); } - -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 = real_slot_info_get_current_location; - iface->get_current_view = real_slot_info_get_current_view; - 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; - iface->make_hosting_pane_active = nautilus_window_slot_make_hosting_pane_active; -} - diff --git a/src/nautilus-window-slot.h b/src/nautilus-window-slot.h index 1bef56733..220c7724a 100644 --- a/src/nautilus-window-slot.h +++ b/src/nautilus-window-slot.h @@ -189,4 +189,9 @@ void nautilus_window_slot_add_current_location_to_history_list (NautilusWindo void nautilus_window_slot_is_in_active_pane (NautilusWindowSlot *slot, gboolean is_active); +NautilusView * nautilus_window_slot_get_current_view (NautilusWindowSlot *slot); +char * nautilus_window_slot_get_current_location (NautilusWindowSlot *slot); +NautilusWindow * nautilus_window_slot_get_window (NautilusWindowSlot *slot); +void nautilus_window_slot_make_hosting_pane_active (NautilusWindowSlot *slot); + #endif /* NAUTILUS_WINDOW_SLOT_H */ diff --git a/src/nautilus-window.c b/src/nautilus-window.c index 8f38204b2..ea91f16b7 100644 --- a/src/nautilus-window.c +++ b/src/nautilus-window.c @@ -39,6 +39,7 @@ #include "nautilus-navigation-window-slot.h" #include "nautilus-search-bar.h" #include "nautilus-src-marshal.h" +#include "nautilus-view-factory.h" #include "nautilus-window-manage-views.h" #include "nautilus-window-bookmarks.h" #include "nautilus-window-slot.h" @@ -60,7 +61,6 @@ #include <libnautilus-private/nautilus-global-preferences.h> #include <libnautilus-private/nautilus-metadata.h> #include <libnautilus-private/nautilus-program-choosing.h> -#include <libnautilus-private/nautilus-view-factory.h> #include <libnautilus-private/nautilus-clipboard.h> #include <libnautilus-private/nautilus-undo.h> #include <libnautilus-private/nautilus-search-directory.h> @@ -90,6 +90,9 @@ enum { PROMPT_FOR_LOCATION, ZOOM_CHANGED, VIEW_AS_CHANGED, + LOADING_URI, + SELECTION_CHANGED, + HIDDEN_FILES_MODE_CHANGED, LAST_SIGNAL }; @@ -101,15 +104,12 @@ typedef struct { } ActivateViewData; 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); static GList *history_list; -G_DEFINE_TYPE_WITH_CODE (NautilusWindow, nautilus_window, GTK_TYPE_WINDOW, - G_IMPLEMENT_INTERFACE (NAUTILUS_TYPE_WINDOW_INFO, - nautilus_window_info_iface_init)); +G_DEFINE_TYPE (NautilusWindow, nautilus_window, GTK_TYPE_WINDOW); static const struct { unsigned int keyval; @@ -187,7 +187,7 @@ nautilus_window_ui_update (NautilusWindow *window) gtk_ui_manager_ensure_update (window->details->ui_manager); } -static void +void nautilus_window_push_status (NautilusWindow *window, const char *text) { @@ -422,21 +422,6 @@ nautilus_window_prompt_for_location (NautilusWindow *window, prompt_for_location, (window, initial)); } -static char * -nautilus_window_get_location_uri (NautilusWindow *window) -{ - NautilusWindowSlot *slot; - - g_assert (NAUTILUS_IS_WINDOW (window)); - - slot = window->details->active_pane->active_slot; - - if (slot->location) { - return g_file_get_uri (slot->location); - } - return NULL; -} - void nautilus_window_zoom_in (NautilusWindow *window) { @@ -523,7 +508,7 @@ nautilus_window_constructed (GObject *self) nautilus_window_initialize_bookmarks_menu (window); nautilus_window_set_initial_window_geometry (window); - nautilus_undo_manager_attach (window->application->undo_manager, G_OBJECT (window)); + nautilus_undo_manager_attach (window->details->application->undo_manager, G_OBJECT (window)); } static void @@ -538,7 +523,7 @@ nautilus_window_set_property (GObject *object, switch (arg_id) { case ARG_APP: - window->application = NAUTILUS_APPLICATION (g_value_get_object (value)); + window->details->application = NAUTILUS_APPLICATION (g_value_get_object (value)); break; } } @@ -551,7 +536,7 @@ nautilus_window_get_property (GObject *object, { switch (arg_id) { case ARG_APP: - g_value_set_object (value, NAUTILUS_WINDOW (object)->application); + g_value_set_object (value, NAUTILUS_WINDOW (object)->details->application); break; } } @@ -656,7 +641,7 @@ nautilus_window_show_window (NautilusWindow *window) } } -static void +void nautilus_window_view_visible (NautilusWindow *window, NautilusView *view) { @@ -1360,20 +1345,6 @@ real_get_title (NautilusWindow *window) return nautilus_window_slot_get_title (window->details->active_pane->active_slot); } -static void -real_sync_title (NautilusWindow *window, - NautilusWindowSlot *slot) -{ - char *copy; - - if (slot == window->details->active_pane->active_slot) { - copy = g_strdup (slot->title); - g_signal_emit_by_name (window, "title_changed", - slot->title); - g_free (copy); - } -} - void nautilus_window_sync_title (NautilusWindow *window, NautilusWindowSlot *slot) @@ -1758,14 +1729,7 @@ nautilus_get_history_list (void) return history_list; } -static GList * -nautilus_window_get_history (NautilusWindow *window) -{ - return eel_g_object_list_copy (history_list); -} - - -static NautilusWindowType +NautilusWindowType nautilus_window_get_window_type (NautilusWindow *window) { g_assert (NAUTILUS_IS_WINDOW (window)); @@ -1773,7 +1737,7 @@ nautilus_window_get_window_type (NautilusWindow *window) return NAUTILUS_WINDOW_GET_CLASS (window)->window_type; } -static int +int nautilus_window_get_selection_count (NautilusWindow *window) { NautilusWindowSlot *slot; @@ -1789,7 +1753,7 @@ nautilus_window_get_selection_count (NautilusWindow *window) return 0; } -static GList * +GList * nautilus_window_get_selection (NautilusWindow *window) { NautilusWindowSlot *slot; @@ -1804,14 +1768,14 @@ nautilus_window_get_selection (NautilusWindow *window) return NULL; } -static NautilusWindowShowHiddenFilesMode -nautilus_window_get_hidden_files_mode (NautilusWindowInfo *window) +NautilusWindowShowHiddenFilesMode +nautilus_window_get_hidden_files_mode (NautilusWindow *window) { return window->details->show_hidden_files_mode; } -static void -nautilus_window_set_hidden_files_mode (NautilusWindowInfo *window, +void +nautilus_window_set_hidden_files_mode (NautilusWindow *window, NautilusWindowShowHiddenFilesMode mode) { window->details->show_hidden_files_mode = mode; @@ -1819,31 +1783,13 @@ nautilus_window_set_hidden_files_mode (NautilusWindowInfo *window, g_signal_emit_by_name (window, "hidden_files_mode_changed"); } -static gboolean -nautilus_window_get_initiated_unmount (NautilusWindowInfo *window) -{ - return window->details->initiated_unmount; -} - -static void -nautilus_window_set_initiated_unmount (NautilusWindowInfo *window, +void +nautilus_window_set_initiated_unmount (NautilusWindow *window, gboolean initiated_unmount) { window->details->initiated_unmount = initiated_unmount; } -static char * -nautilus_window_get_cached_title (NautilusWindow *window) -{ - NautilusWindowSlot *slot; - - g_assert (NAUTILUS_IS_WINDOW (window)); - - slot = window->details->active_pane->active_slot; - - return g_strdup (slot->title); -} - NautilusWindowSlot * nautilus_window_get_active_slot (NautilusWindow *window) { @@ -1898,31 +1844,6 @@ nautilus_window_get_slots (NautilusWindow *window) } static void -nautilus_window_info_iface_init (NautilusWindowInfoIface *iface) -{ - iface->report_load_underway = nautilus_window_report_load_underway; - 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->view_visible = nautilus_window_view_visible; - iface->close_window = nautilus_window_close; - 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; - iface->get_current_location = nautilus_window_get_location_uri; - iface->get_ui_manager = nautilus_window_get_ui_manager; - iface->get_selection_count = nautilus_window_get_selection_count; - 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; - iface->get_extra_slot = nautilus_window_get_extra_slot; - iface->get_initiated_unmount = nautilus_window_get_initiated_unmount; - iface->set_initiated_unmount = nautilus_window_set_initiated_unmount; -} - -static void nautilus_window_class_init (NautilusWindowClass *class) { GtkBindingSet *binding_set; @@ -1939,7 +1860,6 @@ nautilus_window_class_init (NautilusWindowClass *class) GTK_WIDGET_CLASS (class)->realize = nautilus_window_realize; GTK_WIDGET_CLASS (class)->key_press_event = nautilus_window_key_press_event; class->get_title = real_get_title; - class->sync_title = real_sync_title; class->set_allow_up = real_set_allow_up; class->close_slot = real_close_slot; @@ -1994,6 +1914,34 @@ nautilus_window_class_init (NautilusWindowClass *class) g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + signals[HIDDEN_FILES_MODE_CHANGED] = + g_signal_new ("hidden_files_mode_changed", + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + signals[LOADING_URI] = + g_signal_new ("loading_uri", + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, + G_TYPE_STRING); + + signals[SELECTION_CHANGED] = + g_signal_new ("selection_changed", + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + binding_set = gtk_binding_set_by_class (class); gtk_binding_entry_add_signal (binding_set, GDK_KEY_BackSpace, 0, "go_up", 1, diff --git a/src/nautilus-window.h b/src/nautilus-window.h index 278aa64d7..33bca793d 100644 --- a/src/nautilus-window.h +++ b/src/nautilus-window.h @@ -32,9 +32,8 @@ #include <gtk/gtk.h> #include <eel/eel-glib-extensions.h> #include <libnautilus-private/nautilus-bookmark.h> -#include <libnautilus-private/nautilus-window-info.h> #include <libnautilus-private/nautilus-search-directory.h> -#include "nautilus-application.h" +#include <libnautilus-private/nautilus-view.h> #define NAUTILUS_TYPE_WINDOW nautilus_window_get_type() #define NAUTILUS_WINDOW(obj) \ @@ -48,33 +47,57 @@ #define NAUTILUS_WINDOW_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), NAUTILUS_TYPE_WINDOW, NautilusWindowClass)) -#ifndef NAUTILUS_WINDOW_DEFINED -#define NAUTILUS_WINDOW_DEFINED -typedef struct NautilusWindow NautilusWindow; -#endif +typedef enum { + NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT, + NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_ENABLE, + NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DISABLE +} NautilusWindowShowHiddenFilesMode; -#ifndef NAUTILUS_WINDOW_SLOT_DEFINED -#define NAUTILUS_WINDOW_SLOT_DEFINED -typedef struct NautilusWindowSlot NautilusWindowSlot; -#endif +typedef enum { + NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE, + NAUTILUS_WINDOW_OPEN_IN_SPATIAL, + NAUTILUS_WINDOW_OPEN_IN_NAVIGATION +} NautilusWindowOpenMode; + +typedef enum { + /* used in spatial mode */ + NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND = 1<<0, + /* used in navigation mode */ + NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW = 1<<1, + NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB = 1<<2 +} NautilusWindowOpenFlags; + +typedef enum { + NAUTILUS_WINDOW_SPATIAL, + NAUTILUS_WINDOW_NAVIGATION, + NAUTILUS_WINDOW_DESKTOP +} NautilusWindowType; + +typedef struct NautilusWindow NautilusWindow; +typedef struct NautilusWindowSlot NautilusWindowSlot; typedef struct _NautilusWindowPane NautilusWindowPane; typedef struct NautilusWindowSlotClass NautilusWindowSlotClass; -typedef enum NautilusWindowOpenSlotFlags NautilusWindowOpenSlotFlags; GType nautilus_window_slot_get_type (void); +#include "nautilus-application.h" + typedef enum { NAUTILUS_WINDOW_NOT_SHOWN, NAUTILUS_WINDOW_POSITION_SET, NAUTILUS_WINDOW_SHOULD_SHOW } NautilusWindowShowState; -enum NautilusWindowOpenSlotFlags { +typedef enum { NAUTILUS_WINDOW_OPEN_SLOT_NONE = 0, NAUTILUS_WINDOW_OPEN_SLOT_APPEND = 1 -}; +} NautilusWindowOpenSlotFlags; + +typedef void (* NautilusWindowGoToCallback) (NautilusWindow *window, + GError *error, + gpointer user_data); typedef struct NautilusWindowDetails NautilusWindowDetails; @@ -116,8 +139,6 @@ struct NautilusWindow { GtkWindow parent_object; NautilusWindowDetails *details; - - NautilusApplication *application; }; GType nautilus_window_get_type (void); @@ -157,4 +178,27 @@ void nautilus_window_allow_stop (NautilusWindow *window gboolean allow); GtkUIManager * nautilus_window_get_ui_manager (NautilusWindow *window); + +void nautilus_window_report_selection_changed (NautilusWindow *window); +void nautilus_window_report_load_complete (NautilusWindow *window, + NautilusView *view); + +NautilusWindowSlot * nautilus_window_get_extra_slot (NautilusWindow *window); +NautilusWindowShowHiddenFilesMode + nautilus_window_get_hidden_files_mode (NautilusWindow *window); +void nautilus_window_set_hidden_files_mode (NautilusWindow *window, + NautilusWindowShowHiddenFilesMode mode); +NautilusWindowType nautilus_window_get_window_type (NautilusWindow *window); +void nautilus_window_report_load_underway (NautilusWindow *window, + NautilusView *view); +void nautilus_window_view_visible (NautilusWindow *window, + NautilusView *view); +void nautilus_window_set_initiated_unmount (NautilusWindow *window, + gboolean initiated_unmount); +NautilusWindowSlot * nautilus_window_get_active_slot (NautilusWindow *window); +void nautilus_window_push_status (NautilusWindow *window, + const char *text); +int nautilus_window_get_selection_count (NautilusWindow *window); +GList * nautilus_window_get_selection (NautilusWindow *window); + #endif |