[nautilus/refactor: 19/26] Rework architecture of NautilusView/FMDirectoryView
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/refactor: 19/26] Rework architecture of NautilusView/FMDirectoryView
- Date: Wed, 29 Dec 2010 17:59:03 +0000 (UTC)
commit 82f60b3d70eb33114d1daf3a6c5a8aae917cfc3a
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Wed Dec 29 14:12:11 2010 +0100
Rework architecture of NautilusView/FMDirectoryView
As a second step after ff5c759b3784db2d0cd71e1cde613dda007c3985, this
removes the NautilusView/FMDirectoryView interface split, changing
FMDirectoryView to be NautilusView directly.
Left to do: complete renaming the public fm_directory_view methods to
nautilus_view, and get rid of src/file-manager entirely.
libnautilus-private/Makefile.am | 2 -
libnautilus-private/nautilus-dnd.c | 1 -
libnautilus-private/nautilus-view.c | 318 --------------------
libnautilus-private/nautilus-view.h | 189 ------------
src/Makefile.am | 3 +
src/file-manager/Makefile.am | 38 +---
src/file-manager/fm-desktop-icon-view.c | 5 +-
src/file-manager/fm-icon-view.c | 66 ++---
src/file-manager/fm-icon-view.h | 2 +-
src/file-manager/fm-list-view.c | 37 +--
src/file-manager/fm-list-view.h | 2 +-
src/nautilus-trash-bar.c | 2 +-
src/nautilus-view-factory.h | 2 +-
.../fm-directory-view.c => nautilus-view.c} | 240 +++++++--------
.../fm-directory-view.h => nautilus-view.h} | 85 ++++--
src/nautilus-window-manage-views.c | 9 +-
src/nautilus-window-pane.h | 7 +-
src/nautilus-window-slot.c | 12 +-
src/nautilus-window-slot.h | 3 +-
src/nautilus-window-types.h | 57 ++++
src/nautilus-window.h | 29 +--
src/nautilus-x-content-bar.c | 2 +-
22 files changed, 291 insertions(+), 820 deletions(-)
---
diff --git a/libnautilus-private/Makefile.am b/libnautilus-private/Makefile.am
index fbc4338..d46891a 100644
--- a/libnautilus-private/Makefile.am
+++ b/libnautilus-private/Makefile.am
@@ -171,8 +171,6 @@ libnautilus_private_la_SOURCES = \
nautilus-vfs-directory.h \
nautilus-vfs-file.c \
nautilus-vfs-file.h \
- nautilus-view.c \
- nautilus-view.h \
$(NULL)
nodist_libnautilus_private_la_SOURCES =\
diff --git a/libnautilus-private/nautilus-dnd.c b/libnautilus-private/nautilus-dnd.c
index 91e0e47..630306e 100644
--- a/libnautilus-private/nautilus-dnd.c
+++ b/libnautilus-private/nautilus-dnd.c
@@ -29,7 +29,6 @@
#include "nautilus-program-choosing.h"
#include "nautilus-link.h"
-#include "nautilus-view.h"
#include <eel/eel-glib-extensions.h>
#include <eel/eel-gtk-extensions.h>
#include <eel/eel-string.h>
diff --git a/src/Makefile.am b/src/Makefile.am
index d522f60..6bd7071 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.c \
+ nautilus-view.h \
nautilus-view-factory.c \
nautilus-view-factory.h \
nautilus-window-bookmarks.c \
@@ -138,6 +140,7 @@ nautilus_SOURCES = \
nautilus-window-toolbars.c \
nautilus-window.c \
nautilus-window.h \
+ nautilus-window-types.h \
nautilus-x-content-bar.c \
nautilus-x-content-bar.h \
nautilus-zoom-action.c \
diff --git a/src/file-manager/Makefile.am b/src/file-manager/Makefile.am
index abd72fd..6f5f43e 100644
--- a/src/file-manager/Makefile.am
+++ b/src/file-manager/Makefile.am
@@ -15,17 +15,10 @@ INCLUDES = \
$(DISABLE_DEPRECATED_CFLAGS) \
$(NULL)
-BUILT_SOURCES = \
- fm-marshal.c \
- fm-marshal.h \
- $(NULL)
-
libnautilus_file_manager_la_SOURCES= \
fm-actions.h \
fm-desktop-icon-view.c \
fm-desktop-icon-view.h \
- fm-directory-view.c \
- fm-directory-view.h \
fm-ditem-page.c \
fm-ditem-page.h \
fm-error-reporting.c \
@@ -44,28 +37,6 @@ libnautilus_file_manager_la_SOURCES= \
nautilus-audio-mime-types.h \
$(NULL)
-nodist_libnautilus_file_manager_la_SOURCES=\
- $(BUILT_SOURCES) \
- $(NULL)
-
-fm-marshal.list: $(libnautilus_file_manager_la_SOURCES) Makefile.am
- $(AM_V_GEN)( cd $(srcdir) && \
- sed -n -e 's/.*fm_marshal_\([[:upper:][:digit:]]*__[[:upper:][:digit:]_]*\).*/\1/p' \
- $(libnautilus_file_manager_la_SOURCES) ) \
- | sed -e 's/__/:/' -e 'y/_/,/' | sort -u > $ tmp
- @if cmp -s $ tmp $@; then \
- rm $ tmp; \
- else \
- mv $ tmp $@; \
- fi
-
-%-marshal.c: %-marshal.list Makefile
- $(AM_V_GEN)echo "#include \"fm-marshal.h\"" > $@ && \
- $(GLIB_GENMARSHAL) --body --prefix=$(subst -,_,$*)_marshal $< >> $*-marshal.c
-
-%-marshal.h: %-marshal.list Makefile
- $(AM_V_GEN)$(GLIB_GENMARSHAL) --header --prefix=$(subst -,_,$*)_marshal $< > $*-marshal.h
-
EMPTY_VIEW_SOURCES = \
fm-empty-view.c \
fm-empty-view.h
@@ -83,11 +54,4 @@ ui_DATA = \
$(NULL)
EXTRA_DIST = \
- $(ui_DATA) \
- fm-marshal.list
-
-CLEANFILES = \
- $(BUILT_SOURCES) \
- fm-marshal.list \
- $(NULL)
-
+ $(ui_DATA)
diff --git a/src/file-manager/fm-desktop-icon-view.c b/src/file-manager/fm-desktop-icon-view.c
index 6a4fb4e..c0d1770 100644
--- a/src/file-manager/fm-desktop-icon-view.c
+++ b/src/file-manager/fm-desktop-icon-view.c
@@ -30,6 +30,7 @@
#include "fm-desktop-icon-view.h"
#include "fm-actions.h"
#include "nautilus-view-factory.h"
+#include "nautilus-view.h"
#include <X11/Xatom.h>
#include <gtk/gtk.h>
@@ -298,7 +299,7 @@ fm_desktop_icon_view_dispose (GObject *object)
NULL);
g_signal_handlers_disconnect_by_func (gnome_lockdown_preferences,
- fm_directory_view_update_menus,
+ nautilus_view_update_menus,
icon_view);
if (icon_view->details->background != NULL) {
@@ -651,7 +652,7 @@ fm_desktop_icon_view_init (FMDesktopIconView *desktop_icon_view)
g_signal_connect_swapped (gnome_lockdown_preferences,
"changed::" NAUTILUS_PREFERENCES_LOCKDOWN_COMMAND_LINE,
- G_CALLBACK (fm_directory_view_update_menus),
+ G_CALLBACK (nautilus_view_update_menus),
desktop_icon_view);
}
diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c
index 5780756..164e1dc 100644
--- a/src/file-manager/fm-icon-view.c
+++ b/src/file-manager/fm-icon-view.c
@@ -190,11 +190,7 @@ static void default_zoom_level_changed_callback (gpointer callback_da
static void labels_beside_icons_changed_callback (gpointer callback_data);
static void all_columns_same_width_changed_callback (gpointer callback_data);
-static void fm_icon_view_iface_init (NautilusViewIface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (FMIconView, fm_icon_view, FM_TYPE_DIRECTORY_VIEW,
- G_IMPLEMENT_INTERFACE (NAUTILUS_TYPE_VIEW,
- fm_icon_view_iface_init));
+G_DEFINE_TYPE (FMIconView, fm_icon_view, FM_TYPE_DIRECTORY_VIEW);
static void
fm_icon_view_destroy (GtkWidget *object)
@@ -1219,7 +1215,7 @@ fm_icon_view_begin_loading (FMDirectoryView *view)
preview_audio (icon_view, NULL, FALSE);
/* Set up the zoom level from the metadata. */
- if (fm_directory_view_supports_zooming (FM_DIRECTORY_VIEW (icon_view))) {
+ if (nautilus_view_supports_zooming (NAUTILUS_VIEW (icon_view))) {
if (icon_view->details->compact) {
level = nautilus_file_get_integer_metadata
(file,
@@ -1350,7 +1346,7 @@ fm_icon_view_set_zoom_level (FMIconView *view,
g_signal_emit_by_name (view, "zoom_level_changed");
if (fm_directory_view_get_active (FM_DIRECTORY_VIEW (view))) {
- fm_directory_view_update_menus (FM_DIRECTORY_VIEW (view));
+ nautilus_view_update_menus (NAUTILUS_VIEW (view));
}
}
@@ -1367,7 +1363,7 @@ fm_icon_view_bump_zoom_level (FMDirectoryView *view, int zoom_increment)
if (new_level >= NAUTILUS_ZOOM_LEVEL_SMALLEST &&
new_level <= NAUTILUS_ZOOM_LEVEL_LARGEST) {
- fm_directory_view_zoom_to_level (view, new_level);
+ nautilus_view_zoom_to_level (view, new_level);
}
}
@@ -1391,7 +1387,7 @@ fm_icon_view_restore_default_zoom_level (FMDirectoryView *view)
g_return_if_fail (FM_IS_ICON_VIEW (view));
icon_view = FM_ICON_VIEW (view);
- fm_directory_view_zoom_to_level
+ nautilus_view_zoom_to_level
(view, get_default_zoom_level (icon_view));
}
@@ -2381,7 +2377,7 @@ fm_icon_view_react_to_icon_change_idle_callback (gpointer data)
/* Rebuild the menus since some of them (e.g. Restore Stretched Icons)
* may be different now.
*/
- fm_directory_view_update_menus (FM_DIRECTORY_VIEW (icon_view));
+ nautilus_view_update_menus (FM_DIRECTORY_VIEW (icon_view));
/* Don't call this again (unless rescheduled) */
return FALSE;
@@ -2590,7 +2586,7 @@ default_zoom_level_changed_callback (gpointer callback_data)
icon_view = FM_ICON_VIEW (callback_data);
- if (fm_directory_view_supports_zooming (FM_DIRECTORY_VIEW (icon_view))) {
+ if (nautilus_view_supports_zooming (FM_DIRECTORY_VIEW (icon_view))) {
file = fm_directory_view_get_directory_as_file (FM_DIRECTORY_VIEW (icon_view));
if (fm_icon_view_is_compact (icon_view)) {
@@ -2602,7 +2598,7 @@ default_zoom_level_changed_callback (gpointer callback_data)
NAUTILUS_METADATA_KEY_ICON_VIEW_ZOOM_LEVEL,
get_default_zoom_level (icon_view));
}
- fm_directory_view_zoom_to_level (FM_DIRECTORY_VIEW (icon_view), level);
+ nautilus_view_zoom_to_level (FM_DIRECTORY_VIEW (icon_view), level);
}
}
@@ -2809,10 +2805,10 @@ create_icon_container (FMIconView *icon_view)
g_signal_connect_object (icon_container, "renaming_icon",
G_CALLBACK (renaming_icon_callback), icon_view, 0);
g_signal_connect_object (icon_container, "icon_stretch_started",
- G_CALLBACK (fm_directory_view_update_menus), icon_view,
+ G_CALLBACK (nautilus_view_update_menus), icon_view,
G_CONNECT_SWAPPED);
g_signal_connect_object (icon_container, "icon_stretch_ended",
- G_CALLBACK (fm_directory_view_update_menus), icon_view,
+ G_CALLBACK (nautilus_view_update_menus), icon_view,
G_CONNECT_SWAPPED);
g_signal_connect_object (icon_container, "get_stored_layout_timestamp",
@@ -2905,6 +2901,20 @@ icon_view_scroll_to_file (NautilusView *view,
}
}
+static const char *
+fm_icon_view_get_id (NautilusView *view)
+{
+ if (FM_IS_DESKTOP_ICON_VIEW (view)) {
+ return FM_DESKTOP_ICON_VIEW_ID;
+ }
+
+ if (fm_icon_view_is_compact (FM_ICON_VIEW (view))) {
+ return FM_COMPACT_VIEW_ID;
+ }
+
+ return FM_ICON_VIEW_ID;
+}
+
static void
fm_icon_view_set_property (GObject *object,
guint prop_id,
@@ -2988,6 +2998,9 @@ fm_icon_view_class_init (FMIconViewClass *klass)
fm_directory_view_class->update_menus = fm_icon_view_update_menus;
fm_directory_view_class->using_manual_layout = fm_icon_view_using_manual_layout;
fm_directory_view_class->widget_to_file_operation_position = fm_icon_view_widget_to_file_operation_position;
+ fm_directory_view_class->get_view_id = fm_icon_view_get_id;
+ fm_directory_view_class->get_first_visible_file = icon_view_get_first_visible_file;
+ fm_directory_view_class->scroll_to_file = icon_view_scroll_to_file;
klass->clean_up = fm_icon_view_real_clean_up;
klass->supports_auto_layout = real_supports_auto_layout;
@@ -3015,31 +3028,6 @@ fm_icon_view_class_init (FMIconViewClass *klass)
}
-static const char *
-fm_icon_view_get_id (NautilusView *view)
-{
- if (FM_IS_DESKTOP_ICON_VIEW (view)) {
- return FM_DESKTOP_ICON_VIEW_ID;
- }
-
- if (fm_icon_view_is_compact (FM_ICON_VIEW (view))) {
- return FM_COMPACT_VIEW_ID;
- }
-
- return FM_ICON_VIEW_ID;
-}
-
-static void
-fm_icon_view_iface_init (NautilusViewIface *iface)
-{
- fm_directory_view_init_view_iface (iface);
-
- iface->get_view_id = fm_icon_view_get_id;
- iface->get_first_visible_file = icon_view_get_first_visible_file;
- iface->scroll_to_file = icon_view_scroll_to_file;
- iface->get_title = NULL;
-}
-
static void
fm_icon_view_init (FMIconView *icon_view)
{
diff --git a/src/file-manager/fm-icon-view.h b/src/file-manager/fm-icon-view.h
index ec418e8..54fa45f 100644
--- a/src/file-manager/fm-icon-view.h
+++ b/src/file-manager/fm-icon-view.h
@@ -25,7 +25,7 @@
#ifndef FM_ICON_VIEW_H
#define FM_ICON_VIEW_H
-#include "fm-directory-view.h"
+#include "nautilus-view.h"
typedef struct FMIconView FMIconView;
typedef struct FMIconViewClass FMIconViewClass;
diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c
index b6539d5..7528c71 100644
--- a/src/file-manager/fm-list-view.c
+++ b/src/file-manager/fm-list-view.c
@@ -148,16 +148,13 @@ static void fm_list_view_scale_font_size (FMListView *v
NautilusZoomLevel new_level);
static void fm_list_view_scroll_to_file (FMListView *view,
NautilusFile *file);
-static void fm_list_view_iface_init (NautilusViewIface *iface);
static void fm_list_view_rename_callback (NautilusFile *file,
GFile *result_location,
GError *error,
gpointer callback_data);
-G_DEFINE_TYPE_WITH_CODE (FMListView, fm_list_view, FM_TYPE_DIRECTORY_VIEW,
- G_IMPLEMENT_INTERFACE (NAUTILUS_TYPE_VIEW,
- fm_list_view_iface_init));
+G_DEFINE_TYPE (FMListView, fm_list_view, FM_TYPE_DIRECTORY_VIEW);
static const char * default_trash_visible_columns[] = {
"name", "size", "type", "trashed_on", "trash_orig_path", NULL
@@ -1871,7 +1868,7 @@ set_zoom_level_from_metadata_and_preferences (FMListView *list_view)
NautilusFile *file;
int level;
- if (fm_directory_view_supports_zooming (FM_DIRECTORY_VIEW (list_view))) {
+ if (nautilus_view_supports_zooming (FM_DIRECTORY_VIEW (list_view))) {
file = fm_directory_view_get_directory_as_file (FM_DIRECTORY_VIEW (list_view));
level = nautilus_file_get_integer_metadata (file,
NAUTILUS_METADATA_KEY_LIST_VIEW_ZOOM_LEVEL,
@@ -2604,7 +2601,7 @@ fm_list_view_set_zoom_level (FMListView *view,
gtk_cell_renderer_set_fixed_size (GTK_CELL_RENDERER (view->details->pixbuf_cell),
-1, icon_size);
- fm_directory_view_update_menus (FM_DIRECTORY_VIEW (view));
+ nautilus_view_update_menus (FM_DIRECTORY_VIEW (view));
}
static void
@@ -3039,6 +3036,12 @@ real_set_is_active (FMDirectoryView *view,
setup_background (FM_LIST_VIEW (view));
}
+static const char *
+fm_list_view_get_id (NautilusView *view)
+{
+ return FM_LIST_VIEW_ID;
+}
+
static void
fm_list_view_class_init (FMListViewClass *class)
{
@@ -3081,6 +3084,9 @@ fm_list_view_class_init (FMListViewClass *class)
fm_directory_view_class->end_file_changes = fm_list_view_end_file_changes;
fm_directory_view_class->using_manual_layout = fm_list_view_using_manual_layout;
fm_directory_view_class->set_is_active = real_set_is_active;
+ fm_directory_view_class->get_view_id = fm_list_view_get_id;
+ fm_directory_view_class->get_first_visible_file = fm_list_view_get_first_visible_file;
+ fm_directory_view_class->scroll_to_file = list_view_scroll_to_file;
eel_g_settings_add_auto_enum (nautilus_preferences,
NAUTILUS_PREFERENCES_CLICK_POLICY,
@@ -3102,25 +3108,6 @@ fm_list_view_class_init (FMListViewClass *class)
&default_column_order_auto_value);
}
-static const char *
-fm_list_view_get_id (NautilusView *view)
-{
- return FM_LIST_VIEW_ID;
-}
-
-
-static void
-fm_list_view_iface_init (NautilusViewIface *iface)
-{
- fm_directory_view_init_view_iface (iface);
-
- iface->get_view_id = fm_list_view_get_id;
- iface->get_first_visible_file = fm_list_view_get_first_visible_file;
- iface->scroll_to_file = list_view_scroll_to_file;
- iface->get_title = NULL;
-}
-
-
static void
fm_list_view_init (FMListView *list_view)
{
diff --git a/src/file-manager/fm-list-view.h b/src/file-manager/fm-list-view.h
index 20421df..b78dac6 100644
--- a/src/file-manager/fm-list-view.h
+++ b/src/file-manager/fm-list-view.h
@@ -27,7 +27,7 @@
#ifndef FM_LIST_VIEW_H
#define FM_LIST_VIEW_H
-#include "fm-directory-view.h"
+#include "nautilus-view.h"
#define FM_TYPE_LIST_VIEW fm_list_view_get_type()
#define FM_LIST_VIEW(obj) \
diff --git a/src/nautilus-trash-bar.c b/src/nautilus-trash-bar.c
index 030e755..81d9a31 100644
--- a/src/nautilus-trash-bar.c
+++ b/src/nautilus-trash-bar.c
@@ -22,7 +22,7 @@
#include "config.h"
-#include <glib/gi18n-lib.h>
+#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "nautilus-trash-bar.h"
diff --git a/src/nautilus-view-factory.h b/src/nautilus-view-factory.h
index 20f6b01..652da3b 100644
--- a/src/nautilus-view-factory.h
+++ b/src/nautilus-view-factory.h
@@ -27,9 +27,9 @@
#include <string.h>
-#include <libnautilus-private/nautilus-view.h>
#include <gio/gio.h>
+#include "nautilus-view.h"
#include "nautilus-window-slot.h"
G_BEGIN_DECLS
diff --git a/src/file-manager/fm-directory-view.c b/src/nautilus-view.c
similarity index 98%
rename from src/file-manager/fm-directory-view.c
rename to src/nautilus-view.c
index 56ca69b..1bac03e 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/nautilus-view.c
@@ -29,15 +29,16 @@
#include <config.h>
-#include "fm-directory-view.h"
-
-#include "fm-list-view.h"
-#include "fm-desktop-icon-view.h"
-#include "fm-actions.h"
-#include "fm-error-reporting.h"
-#include "fm-marshal.h"
-#include "fm-properties-window.h"
+#include "nautilus-view.h"
+
+#include "file-manager/fm-list-view.h"
+#include "file-manager/fm-desktop-icon-view.h"
+#include "file-manager/fm-actions.h"
+#include "file-manager/fm-error-reporting.h"
+#include "file-manager/fm-properties-window.h"
+
#include "nautilus-mime-actions.h"
+#include "nautilus-src-marshal.h"
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
@@ -135,6 +136,7 @@ enum {
LOAD_ERROR,
MOVE_COPY_ITEMS,
REMOVE_FILE,
+ ZOOM_LEVEL_CHANGED,
TRASH,
DELETE,
LAST_SIGNAL
@@ -279,17 +281,6 @@ static void load_directory (FMDirectoryView
static void fm_directory_view_merge_menus (FMDirectoryView *view);
static void fm_directory_view_unmerge_menus (FMDirectoryView *view);
static void fm_directory_view_init_show_hidden_files (FMDirectoryView *view);
-static void fm_directory_view_load_location (NautilusView *nautilus_view,
- const char *location);
-static void fm_directory_view_stop_loading (NautilusView *nautilus_view);
-static void fm_directory_view_drop_proxy_received_uris (FMDirectoryView *view,
- const GList *source_uri_list,
- const char *target_uri,
- GdkDragAction action);
-static void fm_directory_view_drop_proxy_received_netscape_url (FMDirectoryView *view,
- const char *netscape_url,
- const char *target_uri,
- GdkDragAction action);
static void clipboard_changed_callback (NautilusClipboardMonitor *monitor,
FMDirectoryView *view);
static void open_one_in_new_window (gpointer data,
@@ -319,8 +310,6 @@ static void fm_directory_view_select_file (FMDirectoryView
static GdkDragAction ask_link_action (FMDirectoryView *view);
static void update_templates_directory (FMDirectoryView *view);
static void user_dirs_changed (FMDirectoryView *view);
-static void fm_directory_view_set_is_active (FMDirectoryView *view,
- gboolean is_active);
static gboolean file_list_all_are_folders (GList *file_list);
@@ -1760,8 +1749,8 @@ slot_inactive (NautilusWindowSlot *slot,
remove_update_menus_timeout_callback (view);
}
-static void
-fm_directory_view_grab_focus (NautilusView *view)
+void
+nautilus_view_grab_focus (NautilusView *view)
{
/* focus the child of the scrolled window if it exists */
GtkWidget *child;
@@ -1771,20 +1760,14 @@ fm_directory_view_grab_focus (NautilusView *view)
}
}
-static void
-view_iface_update_menus (NautilusView *view)
-{
- fm_directory_view_update_menus (FM_DIRECTORY_VIEW (view));
-}
-
-static GtkWidget *
-fm_directory_view_get_widget (NautilusView *view)
+GtkWidget *
+nautilus_view_get_widget (NautilusView *view)
{
return GTK_WIDGET (view);
}
-static int
-fm_directory_view_get_selection_count (NautilusView *view)
+int
+nautilus_view_get_selection_count (NautilusView *view)
{
/* FIXME: This could be faster if we special cased it in subclasses */
GList *files;
@@ -1797,8 +1780,8 @@ fm_directory_view_get_selection_count (NautilusView *view)
return len;
}
-static GList *
-fm_directory_view_get_selection_locations (NautilusView *view)
+GList *
+nautilus_view_get_selection (NautilusView *view)
{
GList *files;
GList *locations;
@@ -1831,9 +1814,9 @@ file_list_from_location_list (const GList *uri_list)
return g_list_reverse (file_list);
}
-static void
-fm_directory_view_set_selection_locations (NautilusView *nautilus_view,
- GList *selection_locations)
+void
+nautilus_view_set_selection (NautilusView *nautilus_view,
+ GList *selection_locations)
{
GList *selection;
FMDirectoryView *view;
@@ -1880,34 +1863,6 @@ have_bulk_rename_tool ()
return have_tool;
}
-void
-fm_directory_view_init_view_iface (NautilusViewIface *iface)
-{
- iface->grab_focus = fm_directory_view_grab_focus;
- iface->update_menus = view_iface_update_menus;
-
- iface->get_widget = fm_directory_view_get_widget;
- iface->load_location = fm_directory_view_load_location;
- iface->stop_loading = fm_directory_view_stop_loading;
-
- iface->get_selection_count = fm_directory_view_get_selection_count;
- iface->get_selection = fm_directory_view_get_selection_locations;
- iface->set_selection = fm_directory_view_set_selection_locations;
- iface->set_is_active = (gpointer)fm_directory_view_set_is_active;
-
- iface->supports_zooming = (gpointer)fm_directory_view_supports_zooming;
- iface->bump_zoom_level = (gpointer)fm_directory_view_bump_zoom_level;
- iface->zoom_to_level = (gpointer)fm_directory_view_zoom_to_level;
- iface->restore_default_zoom_level = (gpointer)fm_directory_view_restore_default_zoom_level;
- iface->can_zoom_in = (gpointer)fm_directory_view_can_zoom_in;
- iface->can_zoom_out = (gpointer)fm_directory_view_can_zoom_out;
- iface->get_zoom_level = (gpointer)fm_directory_view_get_zoom_level;
-
- iface->pop_up_location_context_menu = (gpointer)fm_directory_view_pop_up_location_context_menu;
- iface->drop_proxy_received_uris = (gpointer)fm_directory_view_drop_proxy_received_uris;
- iface->drop_proxy_received_netscape_url = (gpointer)fm_directory_view_drop_proxy_received_netscape_url;
-}
-
static void
fm_directory_view_init (FMDirectoryView *view)
{
@@ -1963,7 +1918,7 @@ fm_directory_view_init (FMDirectoryView *view)
/* Register to menu provider extension signal managing menu updates */
g_signal_connect_object (nautilus_signaller_get_current (), "popup_menu_changed",
- G_CALLBACK (fm_directory_view_update_menus), view, G_CONNECT_SWAPPED);
+ G_CALLBACK (nautilus_view_update_menus), view, G_CONNECT_SWAPPED);
gtk_widget_show (GTK_WIDGET (view));
@@ -2032,7 +1987,7 @@ fm_directory_view_destroy (GtkWidget *object)
view->details->slot = NULL;
view->details->window = NULL;
- fm_directory_view_stop (view);
+ nautilus_view_stop_loading (view);
fm_directory_view_clear (view);
for (node = view->details->scripts_directory_list; node != NULL; node = next) {
@@ -2369,9 +2324,9 @@ fm_directory_view_get_allow_moves (FMDirectoryView *view)
return view->details->allow_moves;
}
-static void
-fm_directory_view_load_location (NautilusView *nautilus_view,
- const char *location)
+void
+nautilus_view_load_location (NautilusView *nautilus_view,
+ const char *location)
{
NautilusDirectory *directory;
FMDirectoryView *directory_view;
@@ -2389,12 +2344,6 @@ fm_directory_view_load_location (NautilusView *nautilus_view,
nautilus_directory_unref (directory);
}
-static void
-fm_directory_view_stop_loading (NautilusView *nautilus_view)
-{
- fm_directory_view_stop (FM_DIRECTORY_VIEW (nautilus_view));
-}
-
static gboolean
reveal_selection_idle_callback (gpointer data)
{
@@ -2940,7 +2889,7 @@ update_menus_if_pending (FMDirectoryView *view)
}
remove_update_menus_timeout_callback (view);
- fm_directory_view_update_menus (view);
+ nautilus_view_update_menus (view);
}
static gboolean
@@ -2953,7 +2902,7 @@ update_menus_timeout_callback (gpointer data)
g_object_ref (G_OBJECT (view));
view->details->update_menus_timeout_id = 0;
- fm_directory_view_update_menus (view);
+ nautilus_view_update_menus (view);
g_object_unref (G_OBJECT (view));
@@ -3205,7 +3154,7 @@ load_error_callback (NautilusDirectory *directory,
/* FIXME: By doing a stop, we discard some pending files. Is
* that OK?
*/
- fm_directory_view_stop (view);
+ nautilus_view_stop_loading (view);
/* Emit a signal to tell subclasses that a load error has
* occurred, so they can handle it in the UI.
@@ -3356,17 +3305,18 @@ fm_directory_view_get_loading (FMDirectoryView *view)
}
/**
- * fm_directory_view_bump_zoom_level:
+ * nautilus_view_bump_zoom_level:
*
* bump the current zoom level by invoking the relevant subclass through the slot
*
**/
void
-fm_directory_view_bump_zoom_level (FMDirectoryView *view, int zoom_increment)
+nautilus_view_bump_zoom_level (NautilusView *view,
+ int zoom_increment)
{
g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
- if (!fm_directory_view_supports_zooming (view)) {
+ if (!nautilus_view_supports_zooming (view)) {
return;
}
@@ -3376,18 +3326,18 @@ fm_directory_view_bump_zoom_level (FMDirectoryView *view, int zoom_increment)
}
/**
- * fm_directory_view_zoom_to_level:
+ * nautilus_view_zoom_to_level:
*
* Set the current zoom level by invoking the relevant subclass through the slot
*
**/
void
-fm_directory_view_zoom_to_level (FMDirectoryView *view,
- NautilusZoomLevel zoom_level)
+nautilus_view_zoom_to_level (NautilusView *view,
+ NautilusZoomLevel zoom_level)
{
g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
- if (!fm_directory_view_supports_zooming (view)) {
+ if (!nautilus_view_supports_zooming (view)) {
return;
}
@@ -3396,13 +3346,12 @@ fm_directory_view_zoom_to_level (FMDirectoryView *view,
zoom_to_level, (view, zoom_level));
}
-
NautilusZoomLevel
-fm_directory_view_get_zoom_level (FMDirectoryView *view)
+nautilus_view_get_zoom_level (FMDirectoryView *view)
{
g_return_val_if_fail (FM_IS_DIRECTORY_VIEW (view), NAUTILUS_ZOOM_LEVEL_STANDARD);
- if (!fm_directory_view_supports_zooming (view)) {
+ if (!nautilus_view_supports_zooming (view)) {
return NAUTILUS_ZOOM_LEVEL_STANDARD;
}
@@ -3412,17 +3361,17 @@ fm_directory_view_get_zoom_level (FMDirectoryView *view)
}
/**
- * fm_directory_view_restore_default_zoom_level:
+ * nautilus_view_restore_default_zoom_level:
*
* restore to the default zoom level by invoking the relevant subclass through the slot
*
**/
void
-fm_directory_view_restore_default_zoom_level (FMDirectoryView *view)
+nautilus_view_restore_default_zoom_level (NautilusView *view)
{
g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
- if (!fm_directory_view_supports_zooming (view)) {
+ if (!nautilus_view_supports_zooming (view)) {
return;
}
@@ -3431,8 +3380,33 @@ fm_directory_view_restore_default_zoom_level (FMDirectoryView *view)
restore_default_zoom_level, (view));
}
+const char *
+nautilus_view_get_view_id (NautilusView *view)
+{
+ return EEL_CALL_METHOD_WITH_RETURN_VALUE
+ (FM_DIRECTORY_VIEW_CLASS, view,
+ get_view_id, (view));
+}
+
+char *
+nautilus_view_get_first_visible_file (NautilusView *view)
+{
+ return EEL_CALL_METHOD_WITH_RETURN_VALUE
+ (FM_DIRECTORY_VIEW_CLASS, view,
+ get_first_visible_file, (view));
+}
+
+void
+nautilus_view_scroll_to_file (NautilusView *view,
+ const char *uri)
+{
+ EEL_CALL_METHOD
+ (FM_DIRECTORY_VIEW_CLASS, view,
+ scroll_to_file, (view, uri));
+}
+
/**
- * fm_directory_view_can_zoom_in:
+ * nautilus_view_can_zoom_in:
*
* Determine whether the view can be zoomed any closer.
* @view: The zoomable FMDirectoryView.
@@ -3441,11 +3415,11 @@ fm_directory_view_restore_default_zoom_level (FMDirectoryView *view)
*
**/
gboolean
-fm_directory_view_can_zoom_in (FMDirectoryView *view)
+nautilus_view_can_zoom_in (NautilusView *view)
{
g_return_val_if_fail (FM_IS_DIRECTORY_VIEW (view), FALSE);
- if (!fm_directory_view_supports_zooming (view)) {
+ if (!nautilus_view_supports_zooming (view)) {
return FALSE;
}
@@ -3472,7 +3446,7 @@ fm_directory_view_can_rename_file (FMDirectoryView *view, NautilusFile *file)
}
/**
- * fm_directory_view_can_zoom_out:
+ * nautilus_view_can_zoom_out:
*
* Determine whether the view can be zoomed any further away.
* @view: The zoomable FMDirectoryView.
@@ -3481,11 +3455,11 @@ fm_directory_view_can_rename_file (FMDirectoryView *view, NautilusFile *file)
*
**/
gboolean
-fm_directory_view_can_zoom_out (FMDirectoryView *view)
+nautilus_view_can_zoom_out (NautilusView *view)
{
g_return_val_if_fail (FM_IS_DIRECTORY_VIEW (view), FALSE);
- if (!fm_directory_view_supports_zooming (view)) {
+ if (!nautilus_view_supports_zooming (view)) {
return FALSE;
}
@@ -3494,9 +3468,9 @@ fm_directory_view_can_zoom_out (FMDirectoryView *view)
can_zoom_out, (view));
}
-static void
-fm_directory_view_set_is_active (FMDirectoryView *view,
- gboolean is_active)
+void
+nautilus_view_set_is_active (FMDirectoryView *view,
+ gboolean is_active)
{
g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
@@ -8986,7 +8960,7 @@ schedule_pop_up_location_context_menu (FMDirectoryView *view,
}
/**
- * fm_directory_view_pop_up_location_context_menu
+ * nautilus_view_pop_up_location_context_menu
*
* Pop up a context menu appropriate to the view globally.
* @view: FMDirectoryView of interest.
@@ -8996,9 +8970,9 @@ schedule_pop_up_location_context_menu (FMDirectoryView *view,
*
**/
void
-fm_directory_view_pop_up_location_context_menu (FMDirectoryView *view,
- GdkEventButton *event,
- const char *location)
+nautilus_view_pop_up_location_context_menu (NautilusView *view,
+ GdkEventButton *event,
+ const char *location)
{
NautilusFile *file;
@@ -9016,11 +8990,11 @@ fm_directory_view_pop_up_location_context_menu (FMDirectoryView *view,
}
}
-static void
-fm_directory_view_drop_proxy_received_uris (FMDirectoryView *view,
- const GList *source_uri_list,
- const char *target_uri,
- GdkDragAction action)
+void
+nautilus_view_drop_proxy_received_uris (NautilusView *view,
+ const GList *source_uri_list,
+ const char *target_uri,
+ GdkDragAction action)
{
char *container_uri;
@@ -9050,11 +9024,11 @@ fm_directory_view_drop_proxy_received_uris (FMDirectoryView *view,
g_free (container_uri);
}
-static void
-fm_directory_view_drop_proxy_received_netscape_url (FMDirectoryView *view,
- const char *netscape_url,
- const char *target_uri,
- GdkDragAction action)
+void
+nautilus_view_drop_proxy_received_netscape_url (FMDirectoryView *view,
+ const char *netscape_url,
+ const char *target_uri,
+ GdkDragAction action)
{
fm_directory_view_handle_netscape_url_drop (view,
netscape_url,
@@ -9215,7 +9189,7 @@ load_directory (FMDirectoryView *view,
g_assert (FM_IS_DIRECTORY_VIEW (view));
g_assert (NAUTILUS_IS_DIRECTORY (directory));
- fm_directory_view_stop (view);
+ nautilus_view_stop_loading (view);
fm_directory_view_clear (view);
view->details->loading = TRUE;
@@ -9594,14 +9568,14 @@ remove_all (gpointer key, gpointer value, gpointer callback_data)
}
/**
- * fm_directory_view_stop:
+ * nautilus_view_stop_loading:
*
* Stop the current ongoing process, such as switching to a new uri.
* @view: FMDirectoryView in question.
*
**/
void
-fm_directory_view_stop (FMDirectoryView *view)
+nautilus_view_stop_loading (FMDirectoryView *view)
{
g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
@@ -9756,7 +9730,7 @@ real_supports_properties (FMDirectoryView *view)
}
gboolean
-fm_directory_view_supports_zooming (FMDirectoryView *view)
+nautilus_view_supports_zooming (FMDirectoryView *view)
{
g_return_val_if_fail (FM_IS_DIRECTORY_VIEW (view), FALSE);
@@ -9792,13 +9766,13 @@ real_using_manual_layout (FMDirectoryView *view)
}
/**
- * fm_directory_view_update_menus:
+ * nautilus_view_update_menus:
*
* Update the sensitivity and wording of dynamic menu items.
* @view: FMDirectoryView in question.
*/
void
-fm_directory_view_update_menus (FMDirectoryView *view)
+nautilus_view_update_menus (NautilusView *view)
{
g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
@@ -10556,12 +10530,12 @@ fm_directory_view_handle_scroll_event (FMDirectoryView *directory_view,
switch (event->direction) {
case GDK_SCROLL_UP:
/* Zoom In */
- fm_directory_view_bump_zoom_level (directory_view, 1);
+ nautilus_view_bump_zoom_level (directory_view, 1);
return TRUE;
case GDK_SCROLL_DOWN:
/* Zoom Out */
- fm_directory_view_bump_zoom_level (directory_view, -1);
+ nautilus_view_bump_zoom_level (directory_view, -1);
return TRUE;
case GDK_SCROLL_LEFT:
@@ -10652,7 +10626,7 @@ fm_directory_view_class_init (FMDirectoryViewClass *klass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (FMDirectoryViewClass, add_file),
NULL, NULL,
- fm_marshal_VOID__OBJECT_OBJECT,
+ nautilus_src_marshal_VOID__OBJECT_OBJECT,
G_TYPE_NONE, 2, NAUTILUS_TYPE_FILE, NAUTILUS_TYPE_DIRECTORY);
signals[BEGIN_FILE_CHANGES] =
g_signal_new ("begin_file_changes",
@@ -10708,7 +10682,7 @@ fm_directory_view_class_init (FMDirectoryViewClass *klass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (FMDirectoryViewClass, file_changed),
NULL, NULL,
- fm_marshal_VOID__OBJECT_OBJECT,
+ nautilus_src_marshal_VOID__OBJECT_OBJECT,
G_TYPE_NONE, 2, NAUTILUS_TYPE_FILE, NAUTILUS_TYPE_DIRECTORY);
signals[LOAD_ERROR] =
g_signal_new ("load_error",
@@ -10724,8 +10698,15 @@ fm_directory_view_class_init (FMDirectoryViewClass *klass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (FMDirectoryViewClass, remove_file),
NULL, NULL,
- fm_marshal_VOID__OBJECT_OBJECT,
+ nautilus_src_marshal_VOID__OBJECT_OBJECT,
G_TYPE_NONE, 2, NAUTILUS_TYPE_FILE, NAUTILUS_TYPE_DIRECTORY);
+ signals[ZOOM_LEVEL_CHANGED] =
+ g_signal_new ("zoom-level-changed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
klass->accepts_dragged_files = real_accepts_dragged_files;
klass->file_still_belongs = real_file_still_belongs;
@@ -10779,7 +10760,7 @@ fm_directory_view_class_init (FMDirectoryViewClass *klass)
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (FMDirectoryViewClass, trash),
g_signal_accumulator_true_handled, NULL,
- fm_marshal_BOOLEAN__VOID,
+ nautilus_src_marshal_BOOLEAN__VOID,
G_TYPE_BOOLEAN, 0);
signals[DELETE] =
g_signal_new ("delete",
@@ -10787,7 +10768,7 @@ fm_directory_view_class_init (FMDirectoryViewClass *klass)
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (FMDirectoryViewClass, delete),
g_signal_accumulator_true_handled, NULL,
- fm_marshal_BOOLEAN__VOID,
+ nautilus_src_marshal_BOOLEAN__VOID,
G_TYPE_BOOLEAN, 0);
binding_set = gtk_binding_set_by_class (klass);
@@ -10801,3 +10782,4 @@ fm_directory_view_class_init (FMDirectoryViewClass *klass)
klass->trash = real_trash;
klass->delete = real_delete;
}
+
diff --git a/src/file-manager/fm-directory-view.h b/src/nautilus-view.h
similarity index 87%
rename from src/file-manager/fm-directory-view.h
rename to src/nautilus-view.h
index 32d332f..224b8a8 100644
--- a/src/file-manager/fm-directory-view.h
+++ b/src/nautilus-view.h
@@ -35,14 +35,15 @@
#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 "nautilus-window.h"
-#include "nautilus-window-slot.h"
typedef struct FMDirectoryView FMDirectoryView;
typedef struct FMDirectoryViewClass FMDirectoryViewClass;
+typedef FMDirectoryView NautilusView;
+
+#include "nautilus-window.h"
+#include "nautilus-window-slot.h"
+
#define FM_TYPE_DIRECTORY_VIEW fm_directory_view_get_type()
#define FM_DIRECTORY_VIEW(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), FM_TYPE_DIRECTORY_VIEW, FMDirectoryView))
@@ -55,6 +56,9 @@ typedef struct FMDirectoryViewClass FMDirectoryViewClass;
#define FM_DIRECTORY_VIEW_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), FM_TYPE_DIRECTORY_VIEW, FMDirectoryViewClass))
+#define NAUTILUS_VIEW(obj) FM_DIRECTORY_VIEW(obj)
+#define NAUTILUS_IS_VIEW(obj) FM_IS_DIRECTORY_VIEW(obj)
+
typedef struct FMDirectoryViewDetails FMDirectoryViewDetails;
struct FMDirectoryView {
@@ -212,11 +216,6 @@ struct FMDirectoryViewClass {
*/
void (* reveal_selection) (FMDirectoryView *view);
- /* get_background is a function pointer that subclasses must
- * override to return the EelBackground for this view.
- */
- GtkWidget * (* get_background_widget) (FMDirectoryView *view);
-
/* merge_menus is a function pointer that subclasses can override to
* add their own menu items to the window's menu bar.
* If overridden, subclasses must call parent class's function.
@@ -331,6 +330,16 @@ struct FMDirectoryViewClass {
void (* set_is_active) (FMDirectoryView *view,
gboolean is_active);
+ /* Get the id string for this view. Its a constant string, not memory managed */
+ const char * (* get_view_id) (NautilusView *view);
+
+ /* Return the uri of the first visible file */
+ char * (* get_first_visible_file) (NautilusView *view);
+ /* Scroll the view so that the file specified by the uri is at the top
+ of the view */
+ void (* scroll_to_file) (NautilusView *view,
+ const char *uri);
+
/* Signals used only for keybindings */
gboolean (* trash) (FMDirectoryView *view);
gboolean (* delete) (FMDirectoryView *view);
@@ -351,17 +360,7 @@ void fm_directory_view_display_selection_info (FMDirect
GList * fm_directory_view_get_selection (FMDirectoryView *view);
GList * fm_directory_view_get_selection_for_file_transfer (FMDirectoryView *view);
void fm_directory_view_invert_selection (FMDirectoryView *view);
-void fm_directory_view_stop (FMDirectoryView *view);
guint fm_directory_view_get_item_count (FMDirectoryView *view);
-gboolean fm_directory_view_can_zoom_in (FMDirectoryView *view);
-gboolean fm_directory_view_can_zoom_out (FMDirectoryView *view);
-GtkWidget * fm_directory_view_get_background_widget (FMDirectoryView *view);
-void fm_directory_view_bump_zoom_level (FMDirectoryView *view,
- int zoom_increment);
-void fm_directory_view_zoom_to_level (FMDirectoryView *view,
- NautilusZoomLevel zoom_level);
-NautilusZoomLevel fm_directory_view_get_zoom_level (FMDirectoryView *view);
-void fm_directory_view_restore_default_zoom_level (FMDirectoryView *view);
void fm_directory_view_reset_to_defaults (FMDirectoryView *view);
void fm_directory_view_select_all (FMDirectoryView *view);
void fm_directory_view_set_selection (FMDirectoryView *view,
@@ -373,7 +372,6 @@ gboolean fm_directory_view_is_read_only (FMDirect
gboolean fm_directory_view_supports_creating_files (FMDirectoryView *view);
gboolean fm_directory_view_accepts_dragged_files (FMDirectoryView *view);
gboolean fm_directory_view_supports_properties (FMDirectoryView *view);
-gboolean fm_directory_view_supports_zooming (FMDirectoryView *view);
gboolean fm_directory_view_using_manual_layout (FMDirectoryView *view);
void fm_directory_view_move_copy_items (const GList *item_uris,
GArray *relative_item_points,
@@ -423,14 +421,10 @@ void fm_directory_view_pop_up_background_context_menu (FMDirect
GdkEventButton *event);
void fm_directory_view_pop_up_selection_context_menu (FMDirectoryView *view,
GdkEventButton *event);
-void fm_directory_view_pop_up_location_context_menu (FMDirectoryView *view,
- GdkEventButton *event,
- const char *location);
void fm_directory_view_send_selection_change (FMDirectoryView *view);
gboolean fm_directory_view_should_show_file (FMDirectoryView *view,
NautilusFile *file);
gboolean fm_directory_view_should_sort_directories_first (FMDirectoryView *view);
-void fm_directory_view_update_menus (FMDirectoryView *view);
void fm_directory_view_new_folder (FMDirectoryView *view);
void fm_directory_view_new_file (FMDirectoryView *view,
const char *parent_uri,
@@ -438,7 +432,6 @@ void fm_directory_view_new_file (FMDirect
void fm_directory_view_ignore_hidden_file_preferences (FMDirectoryView *view);
void fm_directory_view_set_show_foreign (FMDirectoryView *view,
gboolean show_foreign);
-void fm_directory_view_init_view_iface (NautilusViewIface *iface);
gboolean fm_directory_view_handle_scroll_event (FMDirectoryView *view,
GdkEventScroll *event);
void fm_directory_view_handle_netscape_url_drop (FMDirectoryView *view,
@@ -481,4 +474,46 @@ void fm_directory_view_set_initiated_unmount (FMDirectoryView *view,
/* operations affecting two directory views */
void fm_directory_view_move_copy_items_between_views (FMDirectoryView *source, FMDirectoryView *target, gboolean copy);
+
+/* NautilusView methods */
+const char * nautilus_view_get_view_id (NautilusView *view);
+GtkWidget * nautilus_view_get_widget (NautilusView *view);
+void nautilus_view_load_location (NautilusView *view,
+ const char *location_uri);
+void nautilus_view_stop_loading (NautilusView *view);
+int nautilus_view_get_selection_count (NautilusView *view);
+GList * nautilus_view_get_selection (NautilusView *view);
+void nautilus_view_set_selection (NautilusView *view,
+ GList *list);
+void nautilus_view_invert_selection (NautilusView *view);
+char * nautilus_view_get_first_visible_file (NautilusView *view);
+void nautilus_view_scroll_to_file (NautilusView *view,
+ const char *uri);
+char * nautilus_view_get_title (NautilusView *view);
+gboolean nautilus_view_supports_zooming (NautilusView *view);
+void nautilus_view_bump_zoom_level (NautilusView *view,
+ int zoom_increment);
+void nautilus_view_zoom_to_level (NautilusView *view,
+ NautilusZoomLevel level);
+void nautilus_view_restore_default_zoom_level (NautilusView *view);
+gboolean nautilus_view_can_zoom_in (NautilusView *view);
+gboolean nautilus_view_can_zoom_out (NautilusView *view);
+NautilusZoomLevel nautilus_view_get_zoom_level (NautilusView *view);
+void nautilus_view_pop_up_location_context_menu (NautilusView *view,
+ GdkEventButton *event,
+ const char *location);
+void nautilus_view_grab_focus (NautilusView *view);
+void nautilus_view_update_menus (NautilusView *view);
+void nautilus_view_drop_proxy_received_uris (NautilusView *view,
+ const GList *uris,
+ const char *target_location,
+ GdkDragAction action);
+void nautilus_view_drop_proxy_received_netscape_url (NautilusView *view,
+ const char *source_url,
+ const char *target_location,
+ GdkDragAction action);
+void nautilus_view_set_is_active (NautilusView *view,
+ gboolean is_active);
+
+
#endif /* FM_DIRECTORY_VIEW_H */
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index 5670809..92c85f0 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -724,7 +724,7 @@ report_callback (NautilusWindowSlot *slot,
/*
* begin_location_change
*
- * Change a window's location.
+ * Change a window slot's location.
* @window: The NautilusWindow whose location should be changed.
* @location: A url specifying the location to load
* @new_selection: The initial selection to present after loading the location
@@ -748,7 +748,6 @@ begin_location_change (NautilusWindowSlot *slot,
NautilusWindowGoToCallback callback,
gpointer user_data)
{
- NautilusWindow *window;
NautilusDirectory *directory;
NautilusFile *file;
gboolean force_reload;
@@ -760,10 +759,6 @@ begin_location_change (NautilusWindowSlot *slot,
|| type == NAUTILUS_LOCATION_CHANGE_FORWARD
|| distance == 0);
- window = slot->pane->window;
- g_assert (NAUTILUS_IS_WINDOW (window));
- g_object_ref (window);
-
end_location_change (slot);
nautilus_window_slot_set_allow_stop (slot, TRUE);
@@ -828,8 +823,6 @@ begin_location_change (NautilusWindowSlot *slot,
NAUTILUS_FILE_ATTRIBUTE_MOUNT,
got_file_info_for_view_selection_callback,
slot);
-
- g_object_unref (window);
}
static void
diff --git a/src/nautilus-window-pane.h b/src/nautilus-window-pane.h
index 68c5d6c..0f616f4 100644
--- a/src/nautilus-window-pane.h
+++ b/src/nautilus-window-pane.h
@@ -25,7 +25,10 @@
#ifndef NAUTILUS_WINDOW_PANE_H
#define NAUTILUS_WINDOW_PANE_H
-#include "nautilus-window.h"
+#include <glib-object.h>
+
+#include <libnautilus-private/nautilus-icon-info.h>
+#include "nautilus-window-types.h"
#define NAUTILUS_TYPE_WINDOW_PANE (nautilus_window_pane_get_type())
#define NAUTILUS_WINDOW_PANE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NAUTILUS_TYPE_WINDOW_PANE, NautilusWindowPaneClass))
@@ -34,8 +37,6 @@
#define NAUTILUS_IS_WINDOW_PANE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NAUTILUS_TYPE_WINDOW_PANE))
#define NAUTILUS_WINDOW_PANE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NAUTILUS_TYPE_WINDOW_PANE, NautilusWindowPaneClass))
-typedef struct _NautilusWindowPaneClass NautilusWindowPaneClass;
-
struct _NautilusWindowPaneClass {
GObjectClass parent_class;
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 7fccc3b..f02736c 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -284,16 +284,7 @@ nautilus_window_slot_get_title (NautilusWindowSlot *slot)
g_assert (NAUTILUS_IS_WINDOW_SLOT (slot));
- title = NULL;
- if (slot->new_content_view != NULL) {
- title = nautilus_view_get_title (slot->new_content_view);
- } else if (slot->content_view != NULL) {
- title = nautilus_view_get_title (slot->content_view);
- }
-
- if (title == NULL) {
- title = nautilus_compute_title_for_location (slot->location);
- }
+ title = nautilus_compute_title_for_location (slot->location);
return title;
}
@@ -557,6 +548,7 @@ char *
nautilus_window_slot_get_current_uri (NautilusWindowSlot *slot)
{
if (slot->pending_location != NULL) {
+ g_print ("returning pending\n");
return g_file_get_uri (slot->pending_location);
}
diff --git a/src/nautilus-window-slot.h b/src/nautilus-window-slot.h
index 4e2ed3c..2c7a4ba 100644
--- a/src/nautilus-window-slot.h
+++ b/src/nautilus-window-slot.h
@@ -25,7 +25,8 @@
#ifndef NAUTILUS_WINDOW_SLOT_H
#define NAUTILUS_WINDOW_SLOT_H
-#include "nautilus-window-pane.h"
+#include "nautilus-view.h"
+#include "nautilus-window-types.h"
#include "nautilus-query-editor.h"
#include <glib/gi18n.h>
diff --git a/src/nautilus-window-types.h b/src/nautilus-window-types.h
new file mode 100644
index 0000000..c0d6d1d
--- /dev/null
+++ b/src/nautilus-window-types.h
@@ -0,0 +1,57 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
+/*
+ * nautilus-window-types: typedefs for window-related types.
+ *
+ * Copyright (C) 1999, 2000, 2010 Red Hat, Inc.
+ * Copyright (C) 1999, 2000, 2001 Eazel, Inc.
+ *
+ * Nautilus 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.
+ *
+ * Nautilus 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Authors: Elliot Lee <sopwith redhat com>
+ * Darin Adler <darin bentspoon com>
+ *
+ */
+
+#ifndef __NAUTILUS_WINDOW_TYPES_H__
+#define __NAUTILUS_WINDOW_TYPES_H__
+
+typedef struct _NautilusWindowPane NautilusWindowPane;
+typedef struct _NautilusWindowPaneClass NautilusWindowPaneClass;
+
+typedef struct NautilusWindow NautilusWindow;
+
+typedef struct NautilusWindowSlot NautilusWindowSlot;
+typedef struct NautilusWindowSlotClass NautilusWindowSlotClass;
+
+typedef void (* NautilusWindowGoToCallback) (NautilusWindow *window,
+ GError *error,
+ gpointer user_data);
+
+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;
+
+#endif /* __NAUTILUS_WINDOW_TYPES_H__ */
diff --git a/src/nautilus-window.h b/src/nautilus-window.h
index c045181..8028d79 100644
--- a/src/nautilus-window.h
+++ b/src/nautilus-window.h
@@ -33,7 +33,9 @@
#include <eel/eel-glib-extensions.h>
#include <libnautilus-private/nautilus-bookmark.h>
#include <libnautilus-private/nautilus-search-directory.h>
-#include <libnautilus-private/nautilus-view.h>
+
+#include "nautilus-view.h"
+#include "nautilus-window-types.h"
#define NAUTILUS_TYPE_WINDOW nautilus_window_get_type()
#define NAUTILUS_WINDOW(obj) \
@@ -53,33 +55,12 @@ typedef enum {
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;
-typedef struct NautilusWindow NautilusWindow;
-typedef struct NautilusWindowSlot NautilusWindowSlot;
-typedef struct _NautilusWindowPane NautilusWindowPane;
-
-typedef struct NautilusWindowSlotClass NautilusWindowSlotClass;
-
GType nautilus_window_slot_get_type (void);
#include "nautilus-application.h"
@@ -95,10 +76,6 @@ typedef enum {
NAUTILUS_WINDOW_OPEN_SLOT_APPEND = 1
} NautilusWindowOpenSlotFlags;
-typedef void (* NautilusWindowGoToCallback) (NautilusWindow *window,
- GError *error,
- gpointer user_data);
-
typedef struct NautilusWindowDetails NautilusWindowDetails;
typedef struct {
diff --git a/src/nautilus-x-content-bar.c b/src/nautilus-x-content-bar.c
index d51d6e1..efd60f9 100644
--- a/src/nautilus-x-content-bar.c
+++ b/src/nautilus-x-content-bar.c
@@ -24,7 +24,7 @@
#include "config.h"
-#include <glib/gi18n-lib.h>
+#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <string.h>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]