[nautilus] slot: finish moving all other private data to private struct
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] slot: finish moving all other private data to private struct
- Date: Tue, 23 Oct 2012 21:02:54 +0000 (UTC)
commit cbbf9c88548f2295921bfe9fbf30ea0ca59d1b6f
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Tue Oct 23 10:55:26 2012 -0400
slot: finish moving all other private data to private struct
Now that we got rid of nautilus-window-manage-views, move all the
private data in NautilusWindowSlot outside of the public struct.
src/nautilus-desktop-window.c | 16 -
src/nautilus-notebook.c | 8 +-
src/nautilus-toolbar.c | 3 +-
src/nautilus-window-menus.c | 12 +-
src/nautilus-window-private.h | 5 -
src/nautilus-window-slot.c | 697 +++++++++++++++++++++++++----------------
src/nautilus-window-slot.h | 101 ++----
src/nautilus-window.c | 242 +++-----------
src/nautilus-window.h | 2 -
9 files changed, 520 insertions(+), 566 deletions(-)
---
diff --git a/src/nautilus-desktop-window.c b/src/nautilus-desktop-window.c
index 6b78ca3..6fabf81 100644
--- a/src/nautilus-desktop-window.c
+++ b/src/nautilus-desktop-window.c
@@ -255,13 +255,6 @@ realize (GtkWidget *widget)
G_CALLBACK (nautilus_desktop_window_screen_size_changed), window);
}
-static NautilusIconInfo *
-real_get_icon (NautilusWindow *window,
- NautilusWindowSlot *slot)
-{
- return nautilus_icon_info_lookup_from_name (NAUTILUS_DESKTOP_ICON_DESKTOP, 48);
-}
-
static void
real_sync_title (NautilusWindow *window,
NautilusWindowSlot *slot)
@@ -278,13 +271,6 @@ real_window_close (NautilusWindow *window)
}
static void
-real_sync_view_as_menus (NautilusWindow *window)
-{
- /* stub, does nothing */
- return;
-}
-
-static void
nautilus_desktop_window_class_init (NautilusDesktopWindowClass *klass)
{
GtkWidgetClass *wclass = GTK_WIDGET_CLASS (klass);
@@ -299,8 +285,6 @@ nautilus_desktop_window_class_init (NautilusDesktopWindowClass *klass)
wclass->delete_event = nautilus_desktop_window_delete_event;
nclass->sync_title = real_sync_title;
- nclass->sync_view_as_menus = real_sync_view_as_menus;
- nclass->get_icon = real_get_icon;
nclass->close = real_window_close;
g_type_class_add_private (klass, sizeof (NautilusDesktopWindowDetails));
diff --git a/src/nautilus-notebook.c b/src/nautilus-notebook.c
index aaabf8b..3ffe024 100644
--- a/src/nautilus-notebook.c
+++ b/src/nautilus-notebook.c
@@ -254,7 +254,7 @@ nautilus_notebook_sync_loading (NautilusNotebook *notebook,
NautilusWindowSlot *slot)
{
GtkWidget *tab_label, *spinner, *icon;
- gboolean active;
+ gboolean active, allow_stop;
g_return_if_fail (NAUTILUS_IS_NOTEBOOK (notebook));
g_return_if_fail (NAUTILUS_IS_WINDOW_SLOT (slot));
@@ -269,11 +269,13 @@ nautilus_notebook_sync_loading (NautilusNotebook *notebook,
active = FALSE;
g_object_get (spinner, "active", &active, NULL);
- if (active == slot->allow_stop) {
+ allow_stop = nautilus_window_slot_get_allow_stop (slot);
+
+ if (active == allow_stop) {
return;
}
- if (slot->allow_stop) {
+ if (allow_stop) {
gtk_widget_hide (icon);
gtk_widget_show (spinner);
gtk_spinner_start (GTK_SPINNER (spinner));
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index d1f63cf..5116ccc 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -171,8 +171,9 @@ fill_menu (NautilusWindow *window,
GList *list;
slot = nautilus_window_get_active_slot (window);
+ list = back ? nautilus_window_slot_get_back_history (slot) :
+ nautilus_window_slot_get_forward_history (slot);
- list = back ? slot->back_list : slot->forward_list;
index = 0;
while (list != NULL) {
menu_item = nautilus_bookmark_menu_item_new (NAUTILUS_BOOKMARK (list->data));
diff --git a/src/nautilus-window-menus.c b/src/nautilus-window-menus.c
index 5d1a703..c3a1a90 100644
--- a/src/nautilus-window-menus.c
+++ b/src/nautilus-window-menus.c
@@ -309,15 +309,11 @@ action_add_bookmark_callback (GtkAction *action,
{
NautilusWindow *window = user_data;
NautilusApplication *app = NAUTILUS_APPLICATION (g_application_get_default ());
- NautilusBookmark *bookmark;
NautilusWindowSlot *slot;
- NautilusBookmarkList *list;
slot = nautilus_window_get_active_slot (window);
- bookmark = slot->current_location_bookmark;
- list = nautilus_application_get_bookmarks (app);
-
- nautilus_bookmark_list_append (list, bookmark);
+ nautilus_bookmark_list_append (nautilus_application_get_bookmarks (app),
+ nautilus_window_slot_get_bookmark (slot));
}
static void
@@ -755,6 +751,7 @@ nautilus_window_finalize_menus (NautilusWindow *window)
static GList *
get_extension_menus (NautilusWindow *window)
{
+ NautilusFile *file;
NautilusWindowSlot *slot;
GList *providers;
GList *items;
@@ -764,6 +761,7 @@ get_extension_menus (NautilusWindow *window)
items = NULL;
slot = nautilus_window_get_active_slot (window);
+ file = nautilus_window_slot_get_file (slot);
for (l = providers; l != NULL; l = l->next) {
NautilusMenuProvider *provider;
@@ -772,7 +770,7 @@ get_extension_menus (NautilusWindow *window)
provider = NAUTILUS_MENU_PROVIDER (l->data);
file_items = nautilus_menu_provider_get_background_items (provider,
GTK_WIDGET (window),
- slot->viewed_file);
+ file);
items = g_list_concat (items, file_items);
}
diff --git a/src/nautilus-window-private.h b/src/nautilus-window-private.h
index 44fdbde..d49a507 100644
--- a/src/nautilus-window-private.h
+++ b/src/nautilus-window-private.h
@@ -91,9 +91,6 @@ typedef void (*NautilusBookmarkFailedCallback) (NautilusWindow *window,
void nautilus_window_load_extension_menus (NautilusWindow *window);
-NautilusWindowSlot *nautilus_window_get_slot_for_view (NautilusWindow *window,
- NautilusView *view);
-
void nautilus_window_set_active_slot (NautilusWindow *window,
NautilusWindowSlot *slot);
@@ -109,8 +106,6 @@ void nautilus_window_sync_title (NautilusWindow *window,
NautilusWindowSlot *slot);
void nautilus_window_sync_zoom_widgets (NautilusWindow *window);
void nautilus_window_sync_up_button (NautilusWindow *window);
-void nautilus_window_sync_view_as_menus (NautilusWindow *window);
-
void nautilus_window_set_search_visible (NautilusWindow *window,
gboolean visible);
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 68e18f3..6534acd 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -28,8 +28,10 @@
#include "nautilus-actions.h"
#include "nautilus-application.h"
+#include "nautilus-canvas-view.h"
#include "nautilus-desktop-window.h"
#include "nautilus-floating-bar.h"
+#include "nautilus-list-view.h"
#include "nautilus-special-location-bar.h"
#include "nautilus-toolbar.h"
#include "nautilus-trash-bar.h"
@@ -81,15 +83,49 @@ struct NautilusWindowSlotDetails {
GFile *location;
gchar *title;
+ /* Viewed file */
+ NautilusView *content_view;
+ NautilusView *new_content_view;
+ NautilusFile *viewed_file;
+ gboolean viewed_file_seen;
+ gboolean viewed_file_in_trash;
+
+ /* Information about bookmarks and history list */
+ NautilusBookmark *current_location_bookmark;
+ NautilusBookmark *last_location_bookmark;
+ GList *back_list;
+ GList *forward_list;
+
+ /* Query editor */
+ NautilusQueryEditor *query_editor;
+ gulong qe_changed_id;
+ gulong qe_cancel_id;
+ gulong qe_activated_id;
+
/* Load state */
GCancellable *find_mount_cancellable;
+ gboolean allow_stop;
gboolean needs_reload;
+ gboolean load_with_search;
/* Ensures that we do not react on signals of a
* view that is re-used as new view when its loading
* is cancelled
*/
gboolean temporarily_ignore_view_signals;
+
+ /* New location. */
+ GFile *pending_location;
+ NautilusLocationChangeType location_change_type;
+ guint location_change_distance;
+ char *pending_scroll_to;
+ GList *pending_selection;
+ NautilusFile *determine_view_file;
+ GCancellable *mount_cancellable;
+ GError *mount_error;
+ gboolean tried_mount;
+ NautilusWindowGoToCallback open_callback;
+ gpointer open_callback_user_data;
};
static guint signals[LAST_SIGNAL] = { 0 };
@@ -99,16 +135,81 @@ static void nautilus_window_slot_force_reload (NautilusWindowSlot *slot);
static void location_has_really_changed (NautilusWindowSlot *slot);
static void nautilus_window_slot_connect_new_content_view (NautilusWindowSlot *slot);
-gboolean
-nautilus_window_slot_handle_event (NautilusWindowSlot *slot,
- GdkEventKey *event)
+static void
+toggle_toolbar_search_button (NautilusWindowSlot *slot,
+ gboolean active)
{
- NautilusWindow *window;
+ GtkActionGroup *action_group;
+ GtkAction *action;
- window = nautilus_window_slot_get_window (slot);
- if (NAUTILUS_IS_DESKTOP_WINDOW (window))
+ action_group = nautilus_window_get_main_action_group (slot->details->window);
+ action = gtk_action_group_get_action (action_group, NAUTILUS_ACTION_SEARCH);
+
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), active);
+}
+
+static void
+nautilus_window_slot_sync_search_widgets (NautilusWindowSlot *slot)
+{
+ NautilusDirectory *directory;
+ gboolean toggle;
+
+ if (slot != nautilus_window_get_active_slot (slot->details->window)) {
+ return;
+ }
+
+ toggle = FALSE;
+
+ if (slot->details->load_with_search) {
+ toggle = TRUE;
+ } else if (slot->details->content_view != NULL) {
+ directory = nautilus_view_get_model (slot->details->content_view);
+ if (NAUTILUS_IS_SEARCH_DIRECTORY (directory) ||
+ gtk_widget_get_visible (GTK_WIDGET (slot->details->query_editor))) {
+ toggle = TRUE;
+ }
+ }
+
+ toggle_toolbar_search_button (slot, toggle);
+}
+
+static gboolean
+nautilus_window_slot_content_view_matches_iid (NautilusWindowSlot *slot,
+ const char *iid)
+{
+ if (slot->details->content_view == NULL) {
return FALSE;
- return nautilus_query_editor_handle_event (slot->query_editor, event);
+ }
+ return g_strcmp0 (nautilus_view_get_view_id (slot->details->content_view), iid) == 0;
+}
+
+static void
+nautilus_window_slot_sync_view_as_menus (NautilusWindowSlot *slot)
+{
+ GtkActionGroup *action_group;
+ GtkAction *action;
+
+ if (slot != nautilus_window_get_active_slot (slot->details->window)) {
+ return;
+ }
+
+ if (slot->details->content_view == NULL || slot->details->new_content_view != NULL) {
+ return;
+ }
+
+ action_group = nautilus_window_get_main_action_group (slot->details->window);
+
+ if (nautilus_window_slot_content_view_matches_iid (slot, NAUTILUS_LIST_VIEW_ID)) {
+ action = gtk_action_group_get_action (action_group, NAUTILUS_ACTION_VIEW_LIST);
+ } else if (nautilus_window_slot_content_view_matches_iid (slot, NAUTILUS_CANVAS_VIEW_ID)) {
+ action = gtk_action_group_get_action (action_group, NAUTILUS_ACTION_VIEW_GRID);
+ } else {
+ action = NULL;
+ }
+
+ if (action != NULL) {
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
+ }
}
static void
@@ -119,17 +220,17 @@ sync_search_directory (NautilusWindowSlot *slot)
gchar *text;
GFile *location;
- g_assert (NAUTILUS_IS_FILE (slot->viewed_file));
+ g_assert (NAUTILUS_IS_FILE (slot->details->viewed_file));
- directory = nautilus_directory_get_for_file (slot->viewed_file);
+ directory = nautilus_directory_get_for_file (slot->details->viewed_file);
g_assert (NAUTILUS_IS_SEARCH_DIRECTORY (directory));
- query = nautilus_query_editor_get_query (slot->query_editor);
+ query = nautilus_query_editor_get_query (slot->details->query_editor);
text = nautilus_query_get_text (query);
if (!strlen (text)) {
- location = nautilus_query_editor_get_location (slot->query_editor);
- slot->load_with_search = TRUE;
+ location = nautilus_query_editor_get_location (slot->details->query_editor);
+ slot->details->load_with_search = TRUE;
nautilus_window_slot_open_location (slot, location, 0);
g_object_unref (location);
} else {
@@ -157,7 +258,7 @@ create_new_search (NautilusWindowSlot *slot)
directory = nautilus_directory_get (location);
g_assert (NAUTILUS_IS_SEARCH_DIRECTORY (directory));
- query = nautilus_query_editor_get_query (slot->query_editor);
+ query = nautilus_query_editor_get_query (slot->details->query_editor);
nautilus_search_directory_set_query (NAUTILUS_SEARCH_DIRECTORY (directory), query);
nautilus_window_slot_open_location (slot, location, 0);
@@ -172,23 +273,15 @@ static void
query_editor_cancel_callback (NautilusQueryEditor *editor,
NautilusWindowSlot *slot)
{
- GtkAction *search;
- NautilusWindow *window;
- GtkActionGroup *action_group;
-
- window = slot->details->window;
- action_group = nautilus_window_get_main_action_group (window);
- search = gtk_action_group_get_action (action_group, NAUTILUS_ACTION_SEARCH);
-
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (search), FALSE);
+ toggle_toolbar_search_button (slot, FALSE);
}
static void
query_editor_activated_callback (NautilusQueryEditor *editor,
NautilusWindowSlot *slot)
{
- if (slot->content_view != NULL) {
- nautilus_view_activate_selection (slot->content_view);
+ if (slot->details->content_view != NULL) {
+ nautilus_view_activate_selection (slot->details->content_view);
}
}
@@ -200,9 +293,9 @@ query_editor_changed_callback (NautilusQueryEditor *editor,
{
NautilusDirectory *directory;
- g_assert (NAUTILUS_IS_FILE (slot->viewed_file));
+ g_assert (NAUTILUS_IS_FILE (slot->details->viewed_file));
- directory = nautilus_directory_get_for_file (slot->viewed_file);
+ directory = nautilus_directory_get_for_file (slot->details->viewed_file);
if (!NAUTILUS_IS_SEARCH_DIRECTORY (directory)) {
/* this is the first change from the query editor. we
ask for a location change to the search directory,
@@ -219,22 +312,22 @@ query_editor_changed_callback (NautilusQueryEditor *editor,
static void
hide_query_editor (NautilusWindowSlot *slot)
{
- gtk_widget_hide (GTK_WIDGET (slot->query_editor));
+ gtk_widget_hide (GTK_WIDGET (slot->details->query_editor));
- if (slot->qe_changed_id > 0) {
- g_signal_handler_disconnect (slot->query_editor, slot->qe_changed_id);
- slot->qe_changed_id = 0;
+ if (slot->details->qe_changed_id > 0) {
+ g_signal_handler_disconnect (slot->details->query_editor, slot->details->qe_changed_id);
+ slot->details->qe_changed_id = 0;
}
- if (slot->qe_cancel_id > 0) {
- g_signal_handler_disconnect (slot->query_editor, slot->qe_cancel_id);
- slot->qe_cancel_id = 0;
+ if (slot->details->qe_cancel_id > 0) {
+ g_signal_handler_disconnect (slot->details->query_editor, slot->details->qe_cancel_id);
+ slot->details->qe_cancel_id = 0;
}
- if (slot->qe_activated_id > 0) {
- g_signal_handler_disconnect (slot->query_editor, slot->qe_activated_id);
- slot->qe_activated_id = 0;
+ if (slot->details->qe_activated_id > 0) {
+ g_signal_handler_disconnect (slot->details->query_editor, slot->details->qe_activated_id);
+ slot->details->qe_activated_id = 0;
}
- nautilus_query_editor_set_query (slot->query_editor, NULL);
+ nautilus_query_editor_set_query (slot->details->query_editor, NULL);
}
static void
@@ -245,15 +338,15 @@ show_query_editor (NautilusWindowSlot *slot)
GFile *location;
/* This might be called while we're still loading the location.
- * In such a case, just set slot->load_with_search to TRUE, to stop
- * nautilus_window_sync_search_widgets() from hiding it again when
- * loading has completed.
+ * In such a case, just set slot->details->load_with_search to TRUE, to stop
+ * sync_search_widgets() from hiding it again when loading has
+ * completed.
*/
if (slot->details->location) {
location = slot->details->location;
} else {
- location = slot->pending_location;
- slot->load_with_search = TRUE;
+ location = slot->details->pending_location;
+ slot->details->load_with_search = TRUE;
}
directory = nautilus_directory_get (location);
@@ -263,30 +356,33 @@ show_query_editor (NautilusWindowSlot *slot)
search_directory = NAUTILUS_SEARCH_DIRECTORY (directory);
query = nautilus_search_directory_get_query (search_directory);
if (query != NULL) {
- nautilus_query_editor_set_query (slot->query_editor,
+ nautilus_query_editor_set_query (slot->details->query_editor,
query);
g_object_unref (query);
}
} else {
- nautilus_query_editor_set_location (slot->query_editor, location);
+ nautilus_query_editor_set_location (slot->details->query_editor, location);
}
nautilus_directory_unref (directory);
- gtk_widget_show (GTK_WIDGET (slot->query_editor));
- gtk_widget_grab_focus (GTK_WIDGET (slot->query_editor));
+ gtk_widget_show (GTK_WIDGET (slot->details->query_editor));
+ gtk_widget_grab_focus (GTK_WIDGET (slot->details->query_editor));
- if (slot->qe_changed_id == 0) {
- slot->qe_changed_id = g_signal_connect (slot->query_editor, "changed",
- G_CALLBACK (query_editor_changed_callback), slot);
+ if (slot->details->qe_changed_id == 0) {
+ slot->details->qe_changed_id =
+ g_signal_connect (slot->details->query_editor, "changed",
+ G_CALLBACK (query_editor_changed_callback), slot);
}
- if (slot->qe_cancel_id == 0) {
- slot->qe_cancel_id = g_signal_connect (slot->query_editor, "cancel",
- G_CALLBACK (query_editor_cancel_callback), slot);
+ if (slot->details->qe_cancel_id == 0) {
+ slot->details->qe_cancel_id =
+ g_signal_connect (slot->details->query_editor, "cancel",
+ G_CALLBACK (query_editor_cancel_callback), slot);
}
- if (slot->qe_activated_id == 0) {
- slot->qe_activated_id = g_signal_connect (slot->query_editor, "activated",
- G_CALLBACK (query_editor_activated_callback), slot);
+ if (slot->details->qe_activated_id == 0) {
+ slot->details->qe_activated_id =
+ g_signal_connect (slot->details->query_editor, "activated",
+ G_CALLBACK (query_editor_activated_callback), slot);
}
}
@@ -301,6 +397,32 @@ nautilus_window_slot_set_query_editor_visible (NautilusWindowSlot *slot,
}
}
+GFile *
+nautilus_window_slot_get_query_editor_location (NautilusWindowSlot *slot)
+{
+ return nautilus_query_editor_get_location (slot->details->query_editor);
+}
+
+gboolean
+nautilus_window_slot_handle_event (NautilusWindowSlot *slot,
+ GdkEventKey *event)
+{
+ NautilusWindow *window;
+ gboolean retval;
+
+ retval = FALSE;
+ window = nautilus_window_slot_get_window (slot);
+ if (!NAUTILUS_IS_DESKTOP_WINDOW (window)) {
+ retval = nautilus_query_editor_handle_event (slot->details->query_editor, event);
+ }
+
+ if (retval) {
+ toggle_toolbar_search_button (slot, TRUE);
+ }
+
+ return retval;
+}
+
static void
real_active (NautilusWindowSlot *slot)
{
@@ -319,10 +441,10 @@ real_active (NautilusWindowSlot *slot)
nautilus_window_sync_title (window, slot);
nautilus_window_sync_zoom_widgets (window);
nautilus_window_sync_location_widgets (window);
- nautilus_window_sync_search_widgets (window);
+ nautilus_window_slot_sync_search_widgets (slot);
- if (slot->viewed_file != NULL) {
- nautilus_window_sync_view_as_menus (window);
+ if (slot->details->viewed_file != NULL) {
+ nautilus_window_slot_sync_view_as_menus (slot);
nautilus_window_load_extension_menus (window);
}
}
@@ -354,7 +476,7 @@ remove_all_extra_location_widgets (GtkWidget *widget,
NautilusDirectory *directory;
directory = nautilus_directory_get (slot->details->location);
- if (widget != GTK_WIDGET (slot->query_editor)) {
+ if (widget != GTK_WIDGET (slot->details->query_editor)) {
gtk_container_remove (GTK_CONTAINER (slot->details->extra_location_widgets), widget);
}
@@ -431,10 +553,10 @@ nautilus_window_slot_constructed (GObject *object)
gtk_box_pack_start (GTK_BOX (slot), extras_vbox, FALSE, FALSE, 0);
gtk_widget_show (extras_vbox);
- slot->query_editor = NAUTILUS_QUERY_EDITOR (nautilus_query_editor_new ());
- nautilus_window_slot_add_extra_location_widget (slot, GTK_WIDGET (slot->query_editor));
- g_object_add_weak_pointer (G_OBJECT (slot->query_editor),
- (gpointer *) &slot->query_editor);
+ slot->details->query_editor = NAUTILUS_QUERY_EDITOR (nautilus_query_editor_new ());
+ nautilus_window_slot_add_extra_location_widget (slot, GTK_WIDGET (slot->details->query_editor));
+ g_object_add_weak_pointer (G_OBJECT (slot->details->query_editor),
+ (gpointer *) &slot->details->query_editor);
slot->details->view_overlay = gtk_overlay_new ();
gtk_widget_add_events (slot->details->view_overlay,
@@ -663,12 +785,12 @@ static gboolean
report_callback (NautilusWindowSlot *slot,
GError *error)
{
- if (slot->open_callback != NULL) {
+ if (slot->details->open_callback != NULL) {
gboolean res;
- res = slot->open_callback (nautilus_window_slot_get_window (slot),
- error, slot->open_callback_user_data);
- slot->open_callback = NULL;
- slot->open_callback_user_data = NULL;
+ res = slot->details->open_callback (nautilus_window_slot_get_window (slot),
+ error, slot->details->open_callback_user_data);
+ slot->details->open_callback = NULL;
+ slot->details->open_callback_user_data = NULL;
return res;
}
@@ -756,10 +878,10 @@ begin_location_change (NautilusWindowSlot *slot,
slot->details->tried_mount = FALSE;
slot->details->pending_selection = eel_g_object_list_copy (new_selection);
- slot->pending_scroll_to = g_strdup (scroll_pos);
+ slot->details->pending_scroll_to = g_strdup (scroll_pos);
- slot->open_callback = callback;
- slot->open_callback_user_data = user_data;
+ slot->details->open_callback = callback;
+ slot->details->open_callback_user_data = user_data;
directory = nautilus_directory_get (location);
@@ -789,19 +911,18 @@ begin_location_change (NautilusWindowSlot *slot,
}
/* Set current_bookmark scroll pos */
- if (slot->current_location_bookmark != NULL &&
- slot->content_view != NULL) {
- current_pos = nautilus_view_get_first_visible_file (slot->content_view);
- nautilus_bookmark_set_scroll_pos (slot->current_location_bookmark, current_pos);
+ if (slot->details->current_location_bookmark != NULL &&
+ slot->details->content_view != NULL) {
+ current_pos = nautilus_view_get_first_visible_file (slot->details->content_view);
+ nautilus_bookmark_set_scroll_pos (slot->details->current_location_bookmark, current_pos);
g_free (current_pos);
}
/* Get the info needed for view selection */
-
- slot->determine_view_file = nautilus_file_get (location);
- g_assert (slot->determine_view_file != NULL);
+ slot->details->determine_view_file = nautilus_file_get (location);
+ g_assert (slot->details->determine_view_file != NULL);
- nautilus_file_call_when_ready (slot->determine_view_file,
+ nautilus_file_call_when_ready (slot->details->determine_view_file,
NAUTILUS_FILE_ATTRIBUTE_INFO |
NAUTILUS_FILE_ATTRIBUTE_MOUNT,
got_file_info_for_view_selection_callback,
@@ -839,18 +960,18 @@ viewed_file_changed_callback (NautilusFile *file,
g_assert (NAUTILUS_IS_FILE (file));
g_assert (NAUTILUS_IS_WINDOW_SLOT (slot));
- g_assert (file == slot->viewed_file);
+ g_assert (file == slot->details->viewed_file);
if (!nautilus_file_is_not_yet_confirmed (file)) {
- slot->viewed_file_seen = TRUE;
+ slot->details->viewed_file_seen = TRUE;
}
- was_in_trash = slot->viewed_file_in_trash;
+ was_in_trash = slot->details->viewed_file_in_trash;
- slot->viewed_file_in_trash = is_in_trash = nautilus_file_is_in_trash (file);
+ slot->details->viewed_file_in_trash = is_in_trash = nautilus_file_is_in_trash (file);
if (nautilus_file_is_gone (file) || (is_in_trash && !was_in_trash)) {
- if (slot->viewed_file_seen) {
+ if (slot->details->viewed_file_seen) {
/* auto-show existing parent. */
GFile *go_to_file;
GFile *parent;
@@ -898,17 +1019,17 @@ nautilus_window_slot_set_viewed_file (NautilusWindowSlot *slot,
{
NautilusFileAttributes attributes;
- if (slot->viewed_file == file) {
+ if (slot->details->viewed_file == file) {
return;
}
nautilus_file_ref (file);
- if (slot->viewed_file != NULL) {
- g_signal_handlers_disconnect_by_func (slot->viewed_file,
- G_CALLBACK (viewed_file_changed_callback),
+ if (slot->details->viewed_file != NULL) {
+ g_signal_handlers_disconnect_by_func (slot->details->viewed_file,
+ G_CALLBACK (viewed_file_changed_callback),
slot);
- nautilus_file_monitor_remove (slot->viewed_file,
+ nautilus_file_monitor_remove (slot->details->viewed_file,
slot);
}
@@ -922,8 +1043,8 @@ nautilus_window_slot_set_viewed_file (NautilusWindowSlot *slot,
G_CALLBACK (viewed_file_changed_callback), slot, 0);
}
- nautilus_file_unref (slot->viewed_file);
- slot->viewed_file = file;
+ nautilus_file_unref (slot->details->viewed_file);
+ slot->details->viewed_file = file;
}
typedef struct {
@@ -952,19 +1073,19 @@ mount_not_mounted_callback (GObject *source_object,
return;
}
- slot->mount_cancellable = NULL;
+ slot->details->mount_cancellable = NULL;
slot->details->determine_view_file = nautilus_file_get (slot->details->pending_location);
error = NULL;
if (!g_file_mount_enclosing_volume_finish (G_FILE (source_object), res, &error)) {
- slot->mount_error = error;
- got_file_info_for_view_selection_callback (slot->determine_view_file, slot);
- slot->mount_error = NULL;
+ slot->details->mount_error = error;
+ got_file_info_for_view_selection_callback (slot->details->determine_view_file, slot);
+ slot->details->mount_error = NULL;
g_error_free (error);
} else {
- nautilus_file_invalidate_all_attributes (slot->determine_view_file);
- nautilus_file_call_when_ready (slot->determine_view_file,
+ nautilus_file_invalidate_all_attributes (slot->details->determine_view_file);
+ nautilus_file_call_when_ready (slot->details->determine_view_file,
NAUTILUS_FILE_ATTRIBUTE_INFO,
got_file_info_for_view_selection_callback,
slot);
@@ -991,20 +1112,20 @@ got_file_info_for_view_selection_callback (NautilusFile *file,
slot = callback_data;
window = nautilus_window_slot_get_window (slot);
- g_assert (slot->determine_view_file == file);
- slot->determine_view_file = NULL;
+ g_assert (slot->details->determine_view_file == file);
+ slot->details->determine_view_file = NULL;
nautilus_profile_start (NULL);
- if (slot->mount_error) {
- error = g_error_copy (slot->mount_error);
+ if (slot->details->mount_error) {
+ error = g_error_copy (slot->details->mount_error);
} else if (nautilus_file_get_file_info_error (file) != NULL) {
error = g_error_copy (nautilus_file_get_file_info_error (file));
}
if (error && error->domain == G_IO_ERROR && error->code == G_IO_ERROR_NOT_MOUNTED &&
- !slot->tried_mount) {
- slot->tried_mount = TRUE;
+ !slot->details->tried_mount) {
+ slot->details->tried_mount = TRUE;
mount_op = gtk_mount_operation_new (GTK_WINDOW (window));
g_mount_operation_set_password_save (mount_op, G_PASSWORD_SAVE_FOR_SESSION);
@@ -1012,8 +1133,8 @@ got_file_info_for_view_selection_callback (NautilusFile *file,
data = g_new0 (MountNotMountedData, 1);
data->cancellable = g_cancellable_new ();
data->slot = slot;
- slot->mount_cancellable = data->cancellable;
- g_file_mount_enclosing_volume (location, 0, mount_op, slot->mount_cancellable,
+ slot->details->mount_cancellable = data->cancellable;
+ g_file_mount_enclosing_volume (location, 0, mount_op, slot->details->mount_cancellable,
mount_not_mounted_callback, data);
g_object_unref (location);
g_object_unref (mount_op);
@@ -1024,8 +1145,8 @@ got_file_info_for_view_selection_callback (NautilusFile *file,
parent_file = nautilus_file_get_parent (file);
if ((parent_file != NULL) &&
nautilus_file_get_file_type (file) == G_FILE_TYPE_REGULAR) {
- if (slot->pending_selection != NULL) {
- g_list_free_full (slot->pending_selection, (GDestroyNotify) nautilus_file_unref);
+ if (slot->details->pending_selection != NULL) {
+ g_list_free_full (slot->details->pending_selection, (GDestroyNotify) nautilus_file_unref);
}
g_clear_object (&slot->details->pending_location);
@@ -1036,8 +1157,8 @@ got_file_info_for_view_selection_callback (NautilusFile *file,
slot->details->determine_view_file = parent_file;
slot->details->pending_scroll_to = nautilus_file_get_uri (file);
- nautilus_file_invalidate_all_attributes (slot->determine_view_file);
- nautilus_file_call_when_ready (slot->determine_view_file,
+ nautilus_file_invalidate_all_attributes (slot->details->determine_view_file);
+ nautilus_file_call_when_ready (slot->details->determine_view_file,
NAUTILUS_FILE_ATTRIBUTE_INFO,
got_file_info_for_view_selection_callback,
slot);
@@ -1207,14 +1328,14 @@ create_content_view (NautilusWindowSlot *slot,
/* create a new content view */
view = nautilus_view_factory_create (view_id, slot);
- slot->new_content_view = view;
+ slot->details->new_content_view = view;
nautilus_window_slot_connect_new_content_view (slot);
}
/* Forward search selection and state before loading the new model */
old_location = nautilus_window_slot_get_location (slot);
old_directory = nautilus_directory_get (old_location);
- new_directory = nautilus_directory_get (slot->pending_location);
+ new_directory = nautilus_directory_get (slot->details->pending_location);
if (NAUTILUS_IS_SEARCH_DIRECTORY (new_directory) &&
!NAUTILUS_IS_SEARCH_DIRECTORY (old_directory)) {
@@ -1223,23 +1344,23 @@ create_content_view (NautilusWindowSlot *slot,
if (NAUTILUS_IS_SEARCH_DIRECTORY (old_directory) &&
!NAUTILUS_IS_SEARCH_DIRECTORY (new_directory) &&
- slot->pending_selection == NULL) {
- slot->pending_selection = nautilus_view_get_selection (slot->content_view);
+ slot->details->pending_selection == NULL) {
+ slot->details->pending_selection = nautilus_view_get_selection (slot->details->content_view);
}
/* Actually load the pending location and selection: */
- if (slot->pending_location != NULL) {
+ if (slot->details->pending_location != NULL) {
load_new_location (slot,
- slot->pending_location,
- slot->pending_selection,
+ slot->details->pending_location,
+ slot->details->pending_selection,
FALSE,
TRUE);
- g_list_free_full (slot->pending_selection, g_object_unref);
- slot->pending_selection = NULL;
+ g_list_free_full (slot->details->pending_selection, g_object_unref);
+ slot->details->pending_selection = NULL;
} else if (old_location != NULL) {
- selection = nautilus_view_get_selection (slot->content_view);
+ selection = nautilus_view_get_selection (slot->details->content_view);
load_new_location (slot,
old_location,
selection,
@@ -1281,19 +1402,19 @@ load_new_location (NautilusWindowSlot *slot,
nautilus_profile_start (NULL);
/* Note, these may recurse into report_load_underway */
- if (slot->content_view != NULL && tell_current_content_view) {
- view = slot->content_view;
- nautilus_view_load_location (slot->content_view, location);
+ if (slot->details->content_view != NULL && tell_current_content_view) {
+ view = slot->details->content_view;
+ nautilus_view_load_location (slot->details->content_view, location);
}
- if (slot->new_content_view != NULL && tell_new_content_view &&
+ if (slot->details->new_content_view != NULL && tell_new_content_view &&
(!tell_current_content_view ||
- slot->new_content_view != slot->content_view) ) {
- view = slot->new_content_view;
- nautilus_view_load_location (slot->new_content_view, location);
+ slot->details->new_content_view != slot->details->content_view) ) {
+ view = slot->details->new_content_view;
+ nautilus_view_load_location (slot->details->new_content_view, location);
}
if (view != NULL) {
- /* slot->new_content_view might have changed here if
+ /* new_content_view might have changed here if
report_load_underway was called from load_location */
nautilus_view_set_selection (view, selection_copy);
}
@@ -1316,11 +1437,11 @@ end_location_change (NautilusWindowSlot *slot)
nautilus_window_slot_set_allow_stop (slot, FALSE);
- /* Now we can free pending_scroll_to, since the load_complete
+ /* Now we can free details->pending_scroll_to, since the load_complete
* callback already has been emitted.
*/
- g_free (slot->pending_scroll_to);
- slot->pending_scroll_to = NULL;
+ g_free (slot->details->pending_scroll_to);
+ slot->details->pending_scroll_to = NULL;
free_location_change (slot);
}
@@ -1332,34 +1453,34 @@ free_location_change (NautilusWindowSlot *slot)
window = nautilus_window_slot_get_window (slot);
- g_clear_object (&slot->pending_location);
- g_list_free_full (slot->pending_selection, g_object_unref);
- slot->pending_selection = NULL;
+ g_clear_object (&slot->details->pending_location);
+ g_list_free_full (slot->details->pending_selection, g_object_unref);
+ slot->details->pending_selection = NULL;
- /* Don't free pending_scroll_to, since thats needed until
+ /* Don't free details->pending_scroll_to, since thats needed until
* the load_complete callback.
*/
- if (slot->mount_cancellable != NULL) {
- g_cancellable_cancel (slot->mount_cancellable);
- slot->mount_cancellable = NULL;
+ if (slot->details->mount_cancellable != NULL) {
+ g_cancellable_cancel (slot->details->mount_cancellable);
+ slot->details->mount_cancellable = NULL;
}
- if (slot->determine_view_file != NULL) {
+ if (slot->details->determine_view_file != NULL) {
nautilus_file_cancel_call_when_ready
- (slot->determine_view_file,
+ (slot->details->determine_view_file,
got_file_info_for_view_selection_callback, slot);
- slot->determine_view_file = NULL;
+ slot->details->determine_view_file = NULL;
}
- if (slot->new_content_view != NULL) {
+ if (slot->details->new_content_view != NULL) {
slot->details->temporarily_ignore_view_signals = TRUE;
- nautilus_view_stop_loading (slot->new_content_view);
+ nautilus_view_stop_loading (slot->details->new_content_view);
slot->details->temporarily_ignore_view_signals = FALSE;
- nautilus_window_disconnect_content_view (window, slot->new_content_view);
- g_object_unref (slot->new_content_view);
- slot->new_content_view = NULL;
+ nautilus_window_disconnect_content_view (window, slot->details->new_content_view);
+ g_object_unref (slot->details->new_content_view);
+ slot->details->new_content_view = NULL;
}
}
@@ -1370,16 +1491,17 @@ cancel_location_change (NautilusWindowSlot *slot)
GFile *location;
location = nautilus_window_slot_get_location (slot);
+
if (slot->details->pending_location != NULL
&& location != NULL
- && slot->content_view != NULL) {
+ && slot->details->content_view != NULL) {
/* No need to tell the new view - either it is the
* same as the old view, in which case it will already
* be told, or it is the very pending change we wish
* to cancel.
*/
- selection = nautilus_view_get_selection (slot->content_view);
+ selection = nautilus_view_get_selection (slot->details->content_view);
load_new_location (slot,
location,
selection,
@@ -1456,21 +1578,6 @@ display_view_selection_failure (NautilusWindow *window, NautilusFile *file,
g_free (detail_message);
}
-
-void
-nautilus_window_slot_stop_loading (NautilusWindowSlot *slot)
-{
- nautilus_view_stop_loading (slot->content_view);
-
- if (slot->new_content_view != NULL) {
- slot->details->temporarily_ignore_view_signals = TRUE;
- nautilus_view_stop_loading (slot->new_content_view);
- slot->details->temporarily_ignore_view_signals = FALSE;
- }
-
- cancel_location_change (slot);
-}
-
void
nautilus_window_slot_set_content_view (NautilusWindowSlot *slot,
const char *id)
@@ -1492,14 +1599,14 @@ nautilus_window_slot_set_content_view (NautilusWindowSlot *slot,
nautilus_window_slot_set_allow_stop (slot, TRUE);
- if (nautilus_view_get_selection_count (slot->content_view) == 0) {
+ if (nautilus_view_get_selection_count (slot->details->content_view) == 0) {
/* If there is no selection, queue a scroll to the same icon that
* is currently visible */
- slot->pending_scroll_to = nautilus_view_get_first_visible_file (slot->content_view);
+ slot->details->pending_scroll_to = nautilus_view_get_first_visible_file (slot->details->content_view);
}
slot->details->location_change_type = NAUTILUS_LOCATION_CHANGE_RELOAD;
- if (!create_content_view (slot, id, NULL)) {
+ if (!create_content_view (slot, id, NULL)) {
/* Just load the homedir. */
nautilus_window_slot_go_home (slot, FALSE);
}
@@ -1519,7 +1626,7 @@ nautilus_window_back_or_forward (NautilusWindow *window,
GFile *old_location;
slot = nautilus_window_get_active_slot (window);
- list = back ? slot->back_list : slot->forward_list;
+ list = back ? slot->details->back_list : slot->details->forward_list;
len = (guint) g_list_length (list);
@@ -1577,9 +1684,9 @@ nautilus_window_slot_force_reload (NautilusWindowSlot *slot)
g_object_ref (location);
current_pos = NULL;
selection = NULL;
- if (slot->content_view != NULL) {
- current_pos = nautilus_view_get_first_visible_file (slot->content_view);
- selection = nautilus_view_get_selection (slot->content_view);
+ if (slot->details->content_view != NULL) {
+ current_pos = nautilus_view_get_first_visible_file (slot->details->content_view);
+ selection = nautilus_view_get_selection (slot->details->content_view);
}
begin_location_change
(slot, location, location, selection,
@@ -1599,9 +1706,9 @@ nautilus_window_slot_queue_reload (NautilusWindowSlot *slot)
return;
}
- if (slot->pending_location != NULL
- || slot->content_view == NULL
- || nautilus_view_get_loading (slot->content_view)) {
+ if (slot->details->pending_location != NULL
+ || slot->details->content_view == NULL
+ || nautilus_view_get_loading (slot->details->content_view)) {
/* there is a reload in flight */
slot->details->needs_reload = TRUE;
return;
@@ -1615,8 +1722,8 @@ nautilus_window_slot_clear_forward_list (NautilusWindowSlot *slot)
{
g_assert (NAUTILUS_IS_WINDOW_SLOT (slot));
- g_list_free_full (slot->forward_list, g_object_unref);
- slot->forward_list = NULL;
+ g_list_free_full (slot->details->forward_list, g_object_unref);
+ slot->details->forward_list = NULL;
}
static void
@@ -1624,8 +1731,8 @@ nautilus_window_slot_clear_back_list (NautilusWindowSlot *slot)
{
g_assert (NAUTILUS_IS_WINDOW_SLOT (slot));
- g_list_free_full (slot->back_list, g_object_unref);
- slot->back_list = NULL;
+ g_list_free_full (slot->details->back_list, g_object_unref);
+ slot->details->back_list = NULL;
}
static void
@@ -1638,11 +1745,11 @@ set_displayed_file (NautilusWindowSlot *slot, NautilusFile *file)
new_location = nautilus_file_get_location (file);
}
- if (slot->current_location_bookmark == NULL || file == NULL) {
+ if (slot->details->current_location_bookmark == NULL || file == NULL) {
recreate = TRUE;
} else {
GFile *bookmark_location;
- bookmark_location = nautilus_bookmark_get_location (slot->current_location_bookmark);
+ bookmark_location = nautilus_bookmark_get_location (slot->details->current_location_bookmark);
recreate = !g_file_equal (bookmark_location, new_location);
g_object_unref (bookmark_location);
}
@@ -1651,16 +1758,16 @@ set_displayed_file (NautilusWindowSlot *slot, NautilusFile *file)
char *display_name = NULL;
/* We've changed locations, must recreate bookmark for current location. */
- g_clear_object (&slot->last_location_bookmark);
+ g_clear_object (&slot->details->last_location_bookmark);
if (file != NULL) {
display_name = nautilus_file_get_display_name (file);
}
- slot->last_location_bookmark = slot->current_location_bookmark;
+ slot->details->last_location_bookmark = slot->details->current_location_bookmark;
if (new_location == NULL) {
- slot->current_location_bookmark = NULL;
+ slot->details->current_location_bookmark = NULL;
} else {
- slot->current_location_bookmark = nautilus_bookmark_new (new_location, display_name);
+ slot->details->current_location_bookmark = nautilus_bookmark_new (new_location, display_name);
}
g_free (display_name);
}
@@ -1692,7 +1799,7 @@ check_bookmark_location_matches (NautilusBookmark *bookmark, GFile *location)
static void
check_last_bookmark_location_matches_slot (NautilusWindowSlot *slot)
{
- check_bookmark_location_matches (slot->last_location_bookmark,
+ check_bookmark_location_matches (slot->details->last_location_bookmark,
nautilus_window_slot_get_location (slot));
}
@@ -1705,9 +1812,9 @@ handle_go_back (NautilusWindowSlot *slot,
NautilusBookmark *bookmark;
/* Going back. Move items from the back list to the forward list. */
- g_assert (g_list_length (slot->back_list) > slot->location_change_distance);
- check_bookmark_location_matches (NAUTILUS_BOOKMARK (g_list_nth_data (slot->back_list,
- slot->location_change_distance)),
+ g_assert (g_list_length (slot->details->back_list) > slot->details->location_change_distance);
+ check_bookmark_location_matches (NAUTILUS_BOOKMARK (g_list_nth_data (slot->details->back_list,
+ slot->details->location_change_distance)),
location);
g_assert (nautilus_window_slot_get_location (slot) != NULL);
@@ -1721,17 +1828,17 @@ handle_go_back (NautilusWindowSlot *slot,
g_object_ref (slot->details->forward_list->data);
/* Move extra links from Back to Forward list */
- for (i = 0; i < slot->location_change_distance; ++i) {
- bookmark = NAUTILUS_BOOKMARK (slot->back_list->data);
- slot->back_list =
- g_list_remove (slot->back_list, bookmark);
- slot->forward_list =
- g_list_prepend (slot->forward_list, bookmark);
+ for (i = 0; i < slot->details->location_change_distance; ++i) {
+ bookmark = NAUTILUS_BOOKMARK (slot->details->back_list->data);
+ slot->details->back_list =
+ g_list_remove (slot->details->back_list, bookmark);
+ slot->details->forward_list =
+ g_list_prepend (slot->details->forward_list, bookmark);
}
/* One bookmark falls out of back/forward lists and becomes viewed location */
- link = slot->back_list;
- slot->back_list = g_list_remove_link (slot->back_list, link);
+ link = slot->details->back_list;
+ slot->details->back_list = g_list_remove_link (slot->details->back_list, link);
g_object_unref (link->data);
g_list_free_1 (link);
}
@@ -1745,9 +1852,9 @@ handle_go_forward (NautilusWindowSlot *slot,
NautilusBookmark *bookmark;
/* Going forward. Move items from the forward list to the back list. */
- g_assert (g_list_length (slot->forward_list) > slot->location_change_distance);
- check_bookmark_location_matches (NAUTILUS_BOOKMARK (g_list_nth_data (slot->forward_list,
- slot->location_change_distance)),
+ g_assert (g_list_length (slot->details->forward_list) > slot->details->location_change_distance);
+ check_bookmark_location_matches (NAUTILUS_BOOKMARK (g_list_nth_data (slot->details->forward_list,
+ slot->details->location_change_distance)),
location);
g_assert (nautilus_window_slot_get_location (slot) != NULL);
@@ -1760,17 +1867,17 @@ handle_go_forward (NautilusWindowSlot *slot,
g_object_ref (slot->details->back_list->data);
/* Move extra links from Forward to Back list */
- for (i = 0; i < slot->location_change_distance; ++i) {
- bookmark = NAUTILUS_BOOKMARK (slot->forward_list->data);
- slot->forward_list =
- g_list_remove (slot->back_list, bookmark);
- slot->back_list =
- g_list_prepend (slot->forward_list, bookmark);
+ for (i = 0; i < slot->details->location_change_distance; ++i) {
+ bookmark = NAUTILUS_BOOKMARK (slot->details->forward_list->data);
+ slot->details->forward_list =
+ g_list_remove (slot->details->back_list, bookmark);
+ slot->details->back_list =
+ g_list_prepend (slot->details->forward_list, bookmark);
}
/* One bookmark falls out of back/forward lists and becomes viewed location */
- link = slot->forward_list;
- slot->forward_list = g_list_remove_link (slot->forward_list, link);
+ link = slot->details->forward_list;
+ slot->details->forward_list = g_list_remove_link (slot->details->forward_list, link);
g_object_unref (link->data);
g_list_free_1 (link);
}
@@ -1794,9 +1901,9 @@ handle_go_elsewhere (NautilusWindowSlot *slot,
/* Store bookmark for current location in back list, unless there is no current location */
check_last_bookmark_location_matches_slot (slot);
/* Use the first bookmark in the history list rather than creating a new one. */
- slot->back_list = g_list_prepend (slot->back_list,
- slot->last_location_bookmark);
- g_object_ref (slot->back_list->data);
+ slot->details->back_list = g_list_prepend (slot->details->back_list,
+ slot->details->last_location_bookmark);
+ g_object_ref (slot->details->back_list->data);
}
}
}
@@ -1976,13 +2083,13 @@ nautilus_window_slot_update_for_new_location (NautilusWindowSlot *slot)
FindMountData *data;
window = nautilus_window_slot_get_window (slot);
- new_location = slot->pending_location;
- slot->pending_location = NULL;
+ new_location = slot->details->pending_location;
+ slot->details->pending_location = NULL;
file = nautilus_file_get (new_location);
set_displayed_file (slot, file);
- update_history (slot, slot->location_change_type, new_location);
+ update_history (slot, slot->details->location_change_type, new_location);
old_location = nautilus_window_slot_get_location (slot);
location_really_changed =
@@ -1993,8 +2100,8 @@ nautilus_window_slot_update_for_new_location (NautilusWindowSlot *slot)
* if it goes away.
*/
nautilus_window_slot_set_viewed_file (slot, file);
- slot->viewed_file_seen = !nautilus_file_is_not_yet_confirmed (file);
- slot->viewed_file_in_trash = nautilus_file_is_in_trash (file);
+ slot->details->viewed_file_seen = !nautilus_file_is_not_yet_confirmed (file);
+ slot->details->viewed_file_in_trash = nautilus_file_is_in_trash (file);
nautilus_file_unref (file);
nautilus_window_slot_emit_location_change (slot, old_location, new_location);
@@ -2006,7 +2113,7 @@ nautilus_window_slot_update_for_new_location (NautilusWindowSlot *slot)
nautilus_window_sync_zoom_widgets (window);
/* Sync the content view menu for this new location. */
- nautilus_window_sync_view_as_menus (window);
+ nautilus_window_slot_sync_view_as_menus (slot);
/* Load menus from nautilus extensions for this location */
nautilus_window_load_extension_menus (window);
@@ -2056,10 +2163,9 @@ nautilus_window_slot_update_for_new_location (NautilusWindowSlot *slot)
slot_add_extension_extra_widgets (slot);
}
- if (slot == nautilus_window_get_active_slot (window)) {
- if (location_really_changed) {
- nautilus_window_sync_search_widgets (window);
- }
+ if (slot == nautilus_window_get_active_slot (window) &&
+ location_really_changed) {
+ nautilus_window_slot_sync_search_widgets (slot);
}
}
@@ -2074,10 +2180,10 @@ view_end_loading_cb (NautilusView *view,
/* Only handle this if we're expecting it.
* Don't handle it if its from an old view we've switched from */
- if (view == slot->content_view && all_files_seen) {
- if (slot->pending_scroll_to != NULL) {
- nautilus_view_scroll_to_file (slot->content_view,
- slot->pending_scroll_to);
+ if (view == slot->details->content_view && all_files_seen) {
+ if (slot->details->pending_scroll_to != NULL) {
+ nautilus_view_scroll_to_file (slot->details->content_view,
+ slot->details->pending_scroll_to);
}
end_location_change (slot);
}
@@ -2105,7 +2211,7 @@ real_setup_loading_floating_bar (NautilusWindowSlot *slot)
}
nautilus_floating_bar_set_primary_label (NAUTILUS_FLOATING_BAR (slot->details->floating_bar),
- NAUTILUS_IS_SEARCH_DIRECTORY (nautilus_view_get_model (slot->content_view)) ?
+ NAUTILUS_IS_SEARCH_DIRECTORY (nautilus_view_get_model (slot->details->content_view)) ?
_("Searching...") : _("Loading..."));
nautilus_floating_bar_set_details_label (NAUTILUS_FLOATING_BAR (slot->details->floating_bar), NULL);
nautilus_floating_bar_set_show_spinner (NAUTILUS_FLOATING_BAR (slot->details->floating_bar),
@@ -2157,7 +2263,7 @@ view_begin_loading_cb (NautilusView *view,
nautilus_profile_start (NULL);
- if (view == slot->new_content_view) {
+ if (view == slot->details->new_content_view) {
location_has_really_changed (slot);
} else {
nautilus_window_slot_set_allow_stop (slot, TRUE);
@@ -2171,15 +2277,15 @@ view_begin_loading_cb (NautilusView *view,
static void
nautilus_window_slot_connect_new_content_view (NautilusWindowSlot *slot)
{
- if (slot->content_view != NULL) {
+ if (slot->details->content_view != NULL) {
/* disconnect old view */
- g_signal_handlers_disconnect_by_func (slot->content_view, G_CALLBACK (view_end_loading_cb), slot);
- g_signal_handlers_disconnect_by_func (slot->content_view, G_CALLBACK (view_begin_loading_cb), slot);
+ g_signal_handlers_disconnect_by_func (slot->details->content_view, G_CALLBACK (view_end_loading_cb), slot);
+ g_signal_handlers_disconnect_by_func (slot->details->content_view, G_CALLBACK (view_begin_loading_cb), slot);
}
- if (slot->new_content_view != NULL) {
- g_signal_connect (slot->new_content_view, "begin-loading", G_CALLBACK (view_begin_loading_cb), slot);
- g_signal_connect (slot->new_content_view, "end-loading", G_CALLBACK (view_end_loading_cb), slot);
+ if (slot->details->new_content_view != NULL) {
+ g_signal_connect (slot->details->new_content_view, "begin-loading", G_CALLBACK (view_begin_loading_cb), slot);
+ g_signal_connect (slot->details->new_content_view, "end-loading", G_CALLBACK (view_end_loading_cb), slot);
}
}
@@ -2189,32 +2295,37 @@ nautilus_window_slot_switch_new_content_view (NautilusWindowSlot *slot)
NautilusWindow *window;
GtkWidget *widget;
- if ((slot->new_content_view == NULL) ||
- gtk_widget_get_parent (GTK_WIDGET (slot->new_content_view)) != NULL) {
+ if ((slot->details->new_content_view == NULL) ||
+ gtk_widget_get_parent (GTK_WIDGET (slot->details->new_content_view)) != NULL) {
return;
}
window = nautilus_window_slot_get_window (slot);
- if (slot->content_view != NULL) {
- nautilus_window_disconnect_content_view (window, slot->content_view);
+ if (slot->details->content_view != NULL) {
+ nautilus_window_disconnect_content_view (window, slot->details->content_view);
- widget = GTK_WIDGET (slot->content_view);
+ widget = GTK_WIDGET (slot->details->content_view);
gtk_widget_destroy (widget);
- g_object_unref (slot->content_view);
- slot->content_view = NULL;
+ g_object_unref (slot->details->content_view);
+ slot->details->content_view = NULL;
}
- if (slot->new_content_view != NULL) {
- slot->content_view = slot->new_content_view;
- slot->new_content_view = NULL;
+ if (slot->details->new_content_view != NULL) {
+ slot->details->content_view = slot->details->new_content_view;
+ slot->details->new_content_view = NULL;
- widget = GTK_WIDGET (slot->content_view);
+ widget = GTK_WIDGET (slot->details->content_view);
gtk_container_add (GTK_CONTAINER (slot->details->view_overlay), widget);
gtk_widget_show (widget);
/* connect new view */
- nautilus_window_connect_content_view (slot->details->window, slot->content_view);
+ nautilus_window_connect_content_view (slot->details->window, slot->details->content_view);
+
+ if (!NAUTILUS_IS_SEARCH_DIRECTORY (nautilus_view_get_model (slot->details->content_view)) &&
+ slot == nautilus_window_get_active_slot (window)) {
+ nautilus_view_grab_focus (slot->details->content_view);
+ }
}
}
@@ -2230,7 +2341,7 @@ location_has_really_changed (NautilusWindowSlot *slot)
/* Switch to the new content view. */
nautilus_window_slot_switch_new_content_view (slot);
- if (slot->pending_location != NULL) {
+ if (slot->details->pending_location != NULL) {
/* Tell the window we are finished. */
nautilus_window_slot_update_for_new_location (slot);
}
@@ -2268,17 +2379,17 @@ nautilus_window_slot_dispose (GObject *object)
nautilus_window_disconnect_content_view (nautilus_window_slot_get_window (slot),
slot->details->content_view);
- widget = GTK_WIDGET (slot->content_view);
+ widget = GTK_WIDGET (slot->details->content_view);
gtk_widget_destroy (widget);
- g_object_unref (slot->content_view);
- slot->content_view = NULL;
+ g_object_unref (slot->details->content_view);
+ slot->details->content_view = NULL;
}
- if (slot->new_content_view) {
- widget = GTK_WIDGET (slot->new_content_view);
+ if (slot->details->new_content_view) {
+ widget = GTK_WIDGET (slot->details->new_content_view);
gtk_widget_destroy (widget);
- g_object_unref (slot->new_content_view);
- slot->new_content_view = NULL;
+ g_object_unref (slot->details->new_content_view);
+ slot->details->new_content_view = NULL;
}
if (slot->details->set_status_timeout_id != 0) {
@@ -2294,7 +2405,7 @@ nautilus_window_slot_dispose (GObject *object)
nautilus_window_slot_set_viewed_file (slot, NULL);
/* TODO? why do we unref here? the file is NULL.
* It was already here before the slot move, though */
- nautilus_file_unref (slot->viewed_file);
+ nautilus_file_unref (slot->details->viewed_file);
if (slot->details->location) {
/* TODO? why do we ref here, instead of unreffing?
@@ -2302,11 +2413,11 @@ nautilus_window_slot_dispose (GObject *object)
g_object_ref (slot->details->location);
}
- g_list_free_full (slot->pending_selection, g_object_unref);
- slot->pending_selection = NULL;
+ g_list_free_full (slot->details->pending_selection, g_object_unref);
+ slot->details->pending_selection = NULL;
- g_clear_object (&slot->current_location_bookmark);
- g_clear_object (&slot->last_location_bookmark);
+ g_clear_object (&slot->details->current_location_bookmark);
+ g_clear_object (&slot->details->last_location_bookmark);
if (slot->details->find_mount_cancellable != NULL) {
g_cancellable_cancel (slot->details->find_mount_cancellable);
@@ -2420,6 +2531,12 @@ nautilus_window_slot_set_window (NautilusWindowSlot *slot,
}
}
+NautilusView *
+nautilus_window_slot_get_view (NautilusWindowSlot *slot)
+{
+ return slot->details->content_view;
+}
+
/* nautilus_window_slot_update_title:
*
* Re-calculate the slot title.
@@ -2445,8 +2562,7 @@ nautilus_window_slot_update_title (NautilusWindowSlot *slot)
title = NULL;
}
- if (strlen (slot->details->title) > 0 &&
- slot->current_location_bookmark != NULL) {
+ if (strlen (slot->details->title) > 0) {
do_sync = TRUE;
}
@@ -2459,6 +2575,12 @@ nautilus_window_slot_update_title (NautilusWindowSlot *slot)
}
}
+gboolean
+nautilus_window_slot_get_allow_stop (NautilusWindowSlot *slot)
+{
+ return slot->details->allow_stop;
+}
+
void
nautilus_window_slot_set_allow_stop (NautilusWindowSlot *slot,
gboolean allow)
@@ -2467,12 +2589,26 @@ nautilus_window_slot_set_allow_stop (NautilusWindowSlot *slot,
g_assert (NAUTILUS_IS_WINDOW_SLOT (slot));
- slot->allow_stop = allow;
+ slot->details->allow_stop = allow;
window = nautilus_window_slot_get_window (slot);
nautilus_window_sync_allow_stop (window, slot);
}
+void
+nautilus_window_slot_stop_loading (NautilusWindowSlot *slot)
+{
+ nautilus_view_stop_loading (slot->details->content_view);
+
+ if (slot->details->new_content_view != NULL) {
+ slot->details->temporarily_ignore_view_signals = TRUE;
+ nautilus_view_stop_loading (slot->details->new_content_view);
+ slot->details->temporarily_ignore_view_signals = FALSE;
+ }
+
+ cancel_location_change (slot);
+}
+
static void
real_slot_set_short_status (NautilusWindowSlot *slot,
const gchar *primary_status,
@@ -2542,7 +2678,7 @@ set_floating_bar_status (NautilusWindowSlot *slot,
slot->details->set_status_timeout_id = 0;
}
- settings = gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (slot->content_view)));
+ settings = gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (slot->details->content_view)));
g_object_get (settings,
"gtk-double-click-time", &double_click_time,
NULL);
@@ -2571,7 +2707,7 @@ nautilus_window_slot_set_status (NautilusWindowSlot *slot,
{
g_assert (NAUTILUS_IS_WINDOW_SLOT (slot));
- if (slot->content_view != NULL) {
+ if (slot->details->content_view != NULL) {
set_floating_bar_status (slot, primary_status, detail_status);
}
}
@@ -2580,25 +2716,24 @@ nautilus_window_slot_set_status (NautilusWindowSlot *slot,
char *
nautilus_window_slot_get_current_uri (NautilusWindowSlot *slot)
{
- if (slot->pending_location != NULL) {
- return g_file_get_uri (slot->pending_location);
+ if (slot->details->pending_location != NULL) {
+ return g_file_get_uri (slot->details->pending_location);
}
if (slot->details->location != NULL) {
return g_file_get_uri (slot->details->location);
}
- g_assert_not_reached ();
return NULL;
}
NautilusView *
nautilus_window_slot_get_current_view (NautilusWindowSlot *slot)
{
- if (slot->content_view != NULL) {
- return slot->content_view;
- } else if (slot->new_content_view) {
- return slot->new_content_view;
+ if (slot->details->content_view != NULL) {
+ return slot->details->content_view;
+ } else if (slot->details->new_content_view) {
+ return slot->details->new_content_view;
}
return NULL;
@@ -2636,14 +2771,28 @@ nautilus_window_slot_go_up (NautilusWindowSlot *slot,
g_object_unref (parent);
}
-gboolean
-nautilus_window_slot_content_view_matches_iid (NautilusWindowSlot *slot,
- const char *iid)
+NautilusFile *
+nautilus_window_slot_get_file (NautilusWindowSlot *slot)
{
- if (slot->content_view == NULL) {
- return FALSE;
- }
- return g_strcmp0 (nautilus_view_get_view_id (slot->content_view), iid) == 0;
+ return slot->details->viewed_file;
+}
+
+NautilusBookmark *
+nautilus_window_slot_get_bookmark (NautilusWindowSlot *slot)
+{
+ return slot->details->current_location_bookmark;
+}
+
+GList *
+nautilus_window_slot_get_back_history (NautilusWindowSlot *slot)
+{
+ return slot->details->back_list;
+}
+
+GList *
+nautilus_window_slot_get_forward_history (NautilusWindowSlot *slot)
+{
+ return slot->details->forward_list;
}
NautilusWindowSlot *
diff --git a/src/nautilus-window-slot.h b/src/nautilus-window-slot.h
index 7a7c14c..47abbc9 100644
--- a/src/nautilus-window-slot.h
+++ b/src/nautilus-window-slot.h
@@ -60,98 +60,67 @@ struct NautilusWindowSlot {
GtkBox parent;
NautilusWindowSlotDetails *details;
-
- NautilusView *content_view;
- NautilusView *new_content_view;
-
- /* Information about bookmarks */
- NautilusBookmark *current_location_bookmark;
- NautilusBookmark *last_location_bookmark;
-
- NautilusFile *viewed_file;
- gboolean viewed_file_seen;
- gboolean viewed_file_in_trash;
-
- gboolean allow_stop;
-
- NautilusQueryEditor *query_editor;
- gulong qe_changed_id;
- gulong qe_cancel_id;
- gulong qe_activated_id;
-
- /* New location. */
- NautilusLocationChangeType location_change_type;
- guint location_change_distance;
- GFile *pending_location;
- char *pending_scroll_to;
- GList *pending_selection;
- NautilusFile *determine_view_file;
- GCancellable *mount_cancellable;
- GError *mount_error;
- gboolean tried_mount;
- NautilusWindowGoToCallback open_callback;
- gpointer open_callback_user_data;
- gboolean load_with_search;
-
- gboolean visible;
-
- /* Back/Forward chain, and history list.
- * The data in these lists are NautilusBookmark pointers.
- */
- GList *back_list, *forward_list;
};
GType nautilus_window_slot_get_type (void);
-NautilusWindowSlot * nautilus_window_slot_new (NautilusWindow *window);
+NautilusWindowSlot * nautilus_window_slot_new (NautilusWindow *window);
NautilusWindow * nautilus_window_slot_get_window (NautilusWindowSlot *slot);
void nautilus_window_slot_set_window (NautilusWindowSlot *slot,
NautilusWindow *window);
-void nautilus_window_slot_update_title (NautilusWindowSlot *slot);
-void nautilus_window_slot_set_query_editor_visible (NautilusWindowSlot *slot,
- gboolean visible);
-gboolean nautilus_window_slot_handle_event (NautilusWindowSlot *slot,
- GdkEventKey *event);
+/* convenience wrapper without selection and callback/user_data */
+#define nautilus_window_slot_open_location(slot, location, flags)\
+ nautilus_window_slot_open_location_full(slot, location, flags, NULL, NULL, NULL)
+
+void nautilus_window_slot_open_location_full (NautilusWindowSlot *slot,
+ GFile *location,
+ NautilusWindowOpenFlags flags,
+ GList *new_selection,
+ NautilusWindowGoToCallback callback,
+ gpointer user_data);
GFile * nautilus_window_slot_get_location (NautilusWindowSlot *slot);
char * nautilus_window_slot_get_location_uri (NautilusWindowSlot *slot);
-const gchar *nautilus_window_slot_get_title (NautilusWindowSlot *slot);
+NautilusFile * nautilus_window_slot_get_file (NautilusWindowSlot *slot);
+NautilusBookmark *nautilus_window_slot_get_bookmark (NautilusWindowSlot *slot);
+NautilusView * nautilus_window_slot_get_view (NautilusWindowSlot *slot);
-void nautilus_window_slot_queue_reload (NautilusWindowSlot *slot);
+NautilusView * nautilus_window_slot_get_current_view (NautilusWindowSlot *slot);
+char * nautilus_window_slot_get_current_uri (NautilusWindowSlot *slot);
-/* convenience wrapper without selection and callback/user_data */
-#define nautilus_window_slot_open_location(slot, location, flags)\
- nautilus_window_slot_open_location_full(slot, location, flags, NULL, NULL, NULL)
+GList * nautilus_window_slot_get_back_history (NautilusWindowSlot *slot);
+GList * nautilus_window_slot_get_forward_history (NautilusWindowSlot *slot);
+
+void nautilus_window_slot_set_query_editor_visible (NautilusWindowSlot *slot,
+ gboolean visible);
+GFile * nautilus_window_slot_get_query_editor_location (NautilusWindowSlot *slot);
+
+gboolean nautilus_window_slot_get_allow_stop (NautilusWindowSlot *slot);
+void nautilus_window_slot_set_allow_stop (NautilusWindowSlot *slot,
+ gboolean allow_stop);
+void nautilus_window_slot_stop_loading (NautilusWindowSlot *slot);
-void nautilus_window_slot_open_location_full (NautilusWindowSlot *slot,
- GFile *location,
- NautilusWindowOpenFlags flags,
- GList *new_selection, /* NautilusFile list */
- NautilusWindowGoToCallback callback,
- gpointer user_data);
+const gchar *nautilus_window_slot_get_title (NautilusWindowSlot *slot);
+void nautilus_window_slot_update_title (NautilusWindowSlot *slot);
+
+gboolean nautilus_window_slot_handle_event (NautilusWindowSlot *slot,
+ GdkEventKey *event);
-void nautilus_window_slot_stop_loading (NautilusWindowSlot *slot);
+void nautilus_window_slot_queue_reload (NautilusWindowSlot *slot);
-void nautilus_window_slot_set_content_view (NautilusWindowSlot *slot,
- const char *id);
-gboolean nautilus_window_slot_content_view_matches_iid (NautilusWindowSlot *slot,
- const char *iid);
+void nautilus_window_slot_set_content_view (NautilusWindowSlot *slot,
+ const char *id);
void nautilus_window_slot_go_home (NautilusWindowSlot *slot,
NautilusWindowOpenFlags flags);
void nautilus_window_slot_go_up (NautilusWindowSlot *slot,
NautilusWindowOpenFlags flags);
-void nautilus_window_slot_set_allow_stop (NautilusWindowSlot *slot,
- gboolean allow_stop);
void nautilus_window_slot_set_status (NautilusWindowSlot *slot,
const char *primary_status,
const char *detail_status);
-NautilusView * nautilus_window_slot_get_current_view (NautilusWindowSlot *slot);
-char * nautilus_window_slot_get_current_uri (NautilusWindowSlot *slot);
-
#endif /* NAUTILUS_WINDOW_SLOT_H */
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 2557e1b..e94fbba 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -205,8 +205,11 @@ remember_focus_widget (NautilusWindow *window)
void
nautilus_window_grab_focus (NautilusWindow *window)
{
- if (NAUTILUS_IS_WINDOW (window) && window->details->active_slot) {
- nautilus_view_grab_focus (window->details->active_slot->content_view);
+ NautilusWindowSlot *slot;
+
+ slot = nautilus_window_get_active_slot (window);
+ if (slot) {
+ nautilus_view_grab_focus (nautilus_window_slot_get_view (slot));
}
}
@@ -284,17 +287,16 @@ nautilus_window_set_search_visible (NautilusWindow *window,
restore_focus_widget (window);
/* Use the location bar as the return location */
- if (slot->query_editor != NULL) {
- location = nautilus_query_editor_get_location (slot->query_editor);
- /* Last try: use the home directory as the return location */
- if (location == NULL) {
- location = g_file_new_for_path (g_get_home_dir ());
- }
+ location = nautilus_window_slot_get_query_editor_location (slot);
- nautilus_window_go_to (window, location);
- g_object_unref (location);
+ /* Last try: use the home directory as the return location */
+ if (location == NULL) {
+ location = g_file_new_for_path (g_get_home_dir ());
}
+ nautilus_window_go_to (window, location);
+ g_object_unref (location);
+
nautilus_window_slot_set_query_editor_visible (slot, FALSE);
}
}
@@ -400,7 +402,7 @@ update_cursor (NautilusWindow *window)
slot = nautilus_window_get_active_slot (window);
- if (slot->allow_stop) {
+ if (nautilus_window_slot_get_allow_stop (slot)) {
cursor = gdk_cursor_new (GDK_WATCH);
gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (window)), cursor);
g_object_unref (cursor);
@@ -415,7 +417,7 @@ nautilus_window_sync_allow_stop (NautilusWindow *window,
{
GtkAction *stop_action;
GtkAction *reload_action;
- gboolean allow_stop, slot_is_active;
+ gboolean allow_stop, slot_is_active, slot_allow_stop;
stop_action = gtk_action_group_get_action (nautilus_window_get_main_action_group (window),
NAUTILUS_ACTION_STOP);
@@ -423,13 +425,14 @@ nautilus_window_sync_allow_stop (NautilusWindow *window,
NAUTILUS_ACTION_RELOAD);
allow_stop = gtk_action_get_sensitive (stop_action);
+ slot_allow_stop = nautilus_window_slot_get_allow_stop (slot);
slot_is_active = (slot == nautilus_window_get_active_slot (window));
if (!slot_is_active ||
- allow_stop != slot->allow_stop) {
+ allow_stop != slot_allow_stop) {
if (slot_is_active) {
- gtk_action_set_visible (stop_action, slot->allow_stop);
- gtk_action_set_visible (reload_action, !slot->allow_stop);
+ gtk_action_set_visible (stop_action, slot_allow_stop);
+ gtk_action_set_visible (reload_action, !slot_allow_stop);
}
if (gtk_widget_get_realized (GTK_WIDGET (window))) {
@@ -691,46 +694,6 @@ nautilus_window_sync_bookmarks (NautilusWindow *window)
gtk_action_set_sensitive (action, can_bookmark);
}
-static void
-toggle_toolbar_search_button (NautilusWindow *window,
- gboolean active)
-{
- GtkAction *action;
-
- action = gtk_action_group_get_action (nautilus_window_get_main_action_group (window),
- NAUTILUS_ACTION_SEARCH);
-
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), active);
-}
-
-void
-nautilus_window_sync_search_widgets (NautilusWindow *window)
-{
- NautilusDirectory *directory;
- NautilusSearchDirectory *search_directory;
- NautilusWindowSlot *slot;
- GFile *location;
-
- search_directory = NULL;
- slot = window->details->active_slot;
- location = nautilus_window_slot_get_location (slot);
-
- directory = nautilus_directory_get (location);
- if (NAUTILUS_IS_SEARCH_DIRECTORY (directory)) {
- search_directory = NAUTILUS_SEARCH_DIRECTORY (directory);
- }
-
- if (search_directory != NULL || slot->load_with_search ||
- gtk_widget_get_visible (GTK_WIDGET (slot->query_editor))) {
- slot->load_with_search = FALSE;
- toggle_toolbar_search_button (window, TRUE);
- } else {
- toggle_toolbar_search_button (window, FALSE);
- }
-
- nautilus_directory_unref (directory);
-}
-
void
nautilus_window_sync_location_widgets (NautilusWindow *window)
{
@@ -761,10 +724,10 @@ nautilus_window_sync_location_widgets (NautilusWindow *window)
action_group = nautilus_window_get_main_action_group (window);
action = gtk_action_group_get_action (action_group, NAUTILUS_ACTION_BACK);
- gtk_action_set_sensitive (action, active_slot->back_list != NULL);
+ gtk_action_set_sensitive (action, nautilus_window_slot_get_back_history (active_slot) != NULL);
action = gtk_action_group_get_action (action_group, NAUTILUS_ACTION_FORWARD);
- gtk_action_set_sensitive (action, active_slot->forward_list != NULL);
+ gtk_action_set_sensitive (action, nautilus_window_slot_get_forward_history (active_slot) != NULL);
nautilus_window_sync_bookmarks (window);
}
@@ -794,7 +757,7 @@ path_bar_location_changed_callback (GtkWidget *widget,
slot = window->details->active_slot;
/* check whether we already visited the target location */
- i = bookmark_list_get_uri_index (slot->back_list, location);
+ i = bookmark_list_get_uri_index (nautilus_window_slot_get_back_history (slot), location);
if (i >= 0) {
nautilus_window_back_or_forward (window, TRUE, i, 0);
} else {
@@ -830,7 +793,7 @@ path_bar_path_event_callback (NautilusPathBar *path_bar,
}
} else if (event->button == 3) {
slot = nautilus_window_get_active_slot (window);
- view = slot->content_view;
+ view = nautilus_window_slot_get_view (slot);
if (view != NULL) {
uri = g_file_get_uri (location);
nautilus_view_pop_up_location_context_menu (view, event, uri);
@@ -1361,19 +1324,23 @@ nautilus_window_view_visible (NautilusWindow *window,
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
- slot = nautilus_window_get_slot_for_view (window, view);
-
- if (slot->visible) {
+ /* FIXME: this code is odd and should not really be needed, but
+ * removing it causes bugs, see e.g.
+ * https://bugzilla.gnome.org/show_bug.cgi?id=679640
+ *
+ * Needs more investigation...
+ */
+ slot = nautilus_view_get_nautilus_window_slot (view);
+ if (g_object_get_data (G_OBJECT (slot), "nautilus-window-view-visible") != NULL) {
return;
}
- slot->visible = TRUE;
+ g_object_set_data (G_OBJECT (slot), "nautilus-window-view-visible", GINT_TO_POINTER (1));
/* Look for other non-visible slots */
for (l = window->details->slots; l != NULL; l = l->next) {
slot = l->data;
-
- if (!slot->visible) {
+ if (g_object_get_data (G_OBJECT (slot), "nautilus-window-view-visible") == NULL) {
return;
}
}
@@ -1381,7 +1348,6 @@ nautilus_window_view_visible (NautilusWindow *window,
/* Look for other non-visible slots */
for (l = window->details->slots; l != NULL; l = l->next) {
slot = l->data;
-
nautilus_window_slot_update_title (slot);
}
@@ -1431,25 +1397,12 @@ static void
nautilus_window_report_location_change (NautilusWindow *window)
{
NautilusWindowSlot *slot;
- GFile *location;
+ gchar *uri;
slot = nautilus_window_get_active_slot (window);
- g_assert (NAUTILUS_IS_WINDOW_SLOT (slot));
-
- location = NULL;
-
- if (slot->pending_location != NULL) {
- location = slot->pending_location;
- }
-
- if (location == NULL) {
- location = nautilus_window_slot_get_location (slot);
- }
-
- if (location != NULL) {
- char *uri;
+ uri = nautilus_window_slot_get_current_uri (slot);
- uri = g_file_get_uri (location);
+ if (uri != NULL) {
g_signal_emit_by_name (window, "loading-uri", uri);
g_free (uri);
}
@@ -1459,6 +1412,7 @@ void
nautilus_window_set_active_slot (NautilusWindow *window, NautilusWindowSlot *new_slot)
{
NautilusWindowSlot *old_slot;
+ NautilusView *view;
g_assert (NAUTILUS_IS_WINDOW (window));
@@ -1476,9 +1430,10 @@ nautilus_window_set_active_slot (NautilusWindow *window, NautilusWindowSlot *new
/* make old slot inactive if it exists (may be NULL after init, for example) */
if (old_slot != NULL) {
- /* inform window */
- if (old_slot->content_view != NULL) {
- nautilus_window_disconnect_content_view (window, old_slot->content_view);
+ view = nautilus_window_slot_get_view (old_slot);
+ if (view != NULL) {
+ /* inform window */
+ nautilus_window_disconnect_content_view (window, view);
}
/* inform slot & view */
@@ -1489,15 +1444,15 @@ nautilus_window_set_active_slot (NautilusWindow *window, NautilusWindowSlot *new
/* make new slot active, if it exists */
if (new_slot) {
- /* inform sidebar panels */
- nautilus_window_report_location_change (window);
- /* TODO decide whether "selection-changed" should be emitted */
-
- if (new_slot->content_view != NULL) {
+ view = nautilus_window_slot_get_view (new_slot);
+ if (view != NULL) {
/* inform window */
- nautilus_window_connect_content_view (window, new_slot->content_view);
+ nautilus_window_connect_content_view (window, view);
}
+ /* inform sidebar panels */
+ nautilus_window_report_location_change (window);
+
/* inform slot & view */
g_signal_emit_by_name (new_slot, "active");
}
@@ -1562,7 +1517,7 @@ nautilus_window_key_press_event (GtkWidget *widget,
window = NAUTILUS_WINDOW (widget);
active_slot = nautilus_window_get_active_slot (window);
- view = active_slot->content_view;
+ view = nautilus_window_slot_get_view (active_slot);
if (view != NULL && nautilus_view_get_is_renaming (view)) {
/* if we're renaming, just forward the event to the
@@ -1614,60 +1569,12 @@ nautilus_window_key_press_event (GtkWidget *widget,
}
if (nautilus_window_slot_handle_event (window->details->active_slot, event)) {
- toggle_toolbar_search_button (window, TRUE);
return TRUE;
}
return FALSE;
}
-/*
- * Main API
- */
-
-static void
-real_sync_view_as_menus (NautilusWindow *window)
-{
- NautilusWindowSlot *slot;
- GtkActionGroup *action_group;
- GtkAction *action;
-
- g_assert (NAUTILUS_IS_WINDOW (window));
-
- slot = nautilus_window_get_active_slot (window);
-
- if (slot->content_view == NULL || slot->new_content_view != NULL) {
- return;
- }
-
- action_group = nautilus_window_get_main_action_group (window);
-
- if (nautilus_window_slot_content_view_matches_iid (slot, NAUTILUS_LIST_VIEW_ID)) {
- action = gtk_action_group_get_action (action_group, NAUTILUS_ACTION_VIEW_LIST);
- } else {
- action = gtk_action_group_get_action (action_group, NAUTILUS_ACTION_VIEW_GRID);
- }
-
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
-}
-
-/**
- * nautilus_window_sync_view_as_menus:
- *
- * Set the visible item of the "View as" option menu and
- * the marked "View as" item in the View menu to
- * match the current content view.
- *
- * @window: The NautilusWindow whose "View as" option menu should be synched.
- */
-void
-nautilus_window_sync_view_as_menus (NautilusWindow *window)
-{
- if (NAUTILUS_WINDOW_CLASS (G_OBJECT_GET_CLASS (window))->sync_view_as_menus != NULL) {
- NAUTILUS_WINDOW_CLASS (G_OBJECT_GET_CLASS (window))->sync_view_as_menus (window);
- }
-}
-
void
nautilus_window_sync_up_button (NautilusWindow *window)
{
@@ -1724,7 +1631,7 @@ nautilus_window_sync_zoom_widgets (NautilusWindow *window)
NautilusZoomLevel zoom_level;
slot = nautilus_window_get_active_slot (window);
- view = slot->content_view;
+ view = nautilus_window_slot_get_view (slot);
if (view != NULL) {
supports_zooming = nautilus_view_supports_zooming (view);
@@ -1783,12 +1690,11 @@ nautilus_window_connect_content_view (NautilusWindow *window,
NautilusView *view)
{
NautilusWindowSlot *slot;
- NautilusDirectory *directory;
g_assert (NAUTILUS_IS_WINDOW (window));
g_assert (NAUTILUS_IS_VIEW (view));
- slot = nautilus_window_get_slot_for_view (window, view);
+ slot = nautilus_view_get_nautilus_window_slot (view);
if (slot != nautilus_window_get_active_slot (window)) {
return;
@@ -1800,22 +1706,6 @@ nautilus_window_connect_content_view (NautilusWindow *window,
/* See the comment in notebook_page_added_cb() */
notebook_num_pages_changed (window);
-
- /* Update displayed view in menu. Only do this if we're not switching
- * locations though, because if we are switching locations we'll
- * install a whole new set of views in the menu later (the current
- * views in the menu are for the old location).
- */
- if (slot->pending_location == NULL) {
- nautilus_window_sync_view_as_menus (window);
- } else {
- directory = nautilus_directory_get (slot->pending_location);
- if (!NAUTILUS_IS_SEARCH_DIRECTORY (directory)) {
- nautilus_view_grab_focus (view);
- }
-
- nautilus_directory_unref (directory);
- }
}
void
@@ -1827,7 +1717,7 @@ nautilus_window_disconnect_content_view (NautilusWindow *window,
g_assert (NAUTILUS_IS_WINDOW (window));
g_assert (NAUTILUS_IS_VIEW (view));
- slot = nautilus_window_get_slot_for_view (window, view);
+ slot = nautilus_view_get_nautilus_window_slot (view);
if (slot != nautilus_window_get_active_slot (window)) {
return;
@@ -1878,27 +1768,6 @@ nautilus_window_get_main_action_group (NautilusWindow *window)
}
NautilusWindowSlot *
-nautilus_window_get_slot_for_view (NautilusWindow *window,
- NautilusView *view)
-{
- NautilusWindowSlot *slot;
- GList *l;
-
- slot = NULL;
- for (l = window->details->slots; l; l = l->next) {
- NautilusWindowSlot *tmp = l->data;
-
- if (tmp->content_view == view ||
- tmp->new_content_view == view) {
- slot = tmp;
- break;
- }
- }
-
- return slot;
-}
-
-NautilusWindowSlot *
nautilus_window_get_active_slot (NautilusWindow *window)
{
g_assert (NAUTILUS_IS_WINDOW (window));
@@ -2020,15 +1889,6 @@ nautilus_window_init (NautilusWindow *window)
gtk_window_set_hide_titlebar_when_maximized (GTK_WINDOW (window), TRUE);
}
-static NautilusIconInfo *
-real_get_icon (NautilusWindow *window,
- NautilusWindowSlot *slot)
-{
- return nautilus_file_get_icon (slot->viewed_file, 48,
- NAUTILUS_FILE_ICON_FLAGS_IGNORE_VISITING |
- NAUTILUS_FILE_ICON_FLAGS_USE_MOUNT_ICON);
-}
-
static void
real_window_close (NautilusWindow *window)
{
@@ -2060,9 +1920,7 @@ nautilus_window_class_init (NautilusWindowClass *class)
wclass->button_press_event = nautilus_window_button_press_event;
wclass->delete_event = nautilus_window_delete_event;
- class->get_icon = real_get_icon;
class->close = real_window_close;
- class->sync_view_as_menus = real_sync_view_as_menus;
properties[PROP_DISABLE_CHROME] =
g_param_spec_boolean ("disable-chrome",
diff --git a/src/nautilus-window.h b/src/nautilus-window.h
index 748132c..6bcf477 100644
--- a/src/nautilus-window.h
+++ b/src/nautilus-window.h
@@ -72,7 +72,6 @@ typedef struct {
void (* sync_title) (NautilusWindow *window,
NautilusWindowSlot *slot);
- void (* sync_view_as_menus) (NautilusWindow *window);
NautilusIconInfo * (* get_icon) (NautilusWindow *window,
NautilusWindowSlot *slot);
@@ -118,7 +117,6 @@ void nautilus_window_slot_close (NautilusWindow *wind
GtkWidget * nautilus_window_ensure_location_entry (NautilusWindow *window);
void nautilus_window_sync_location_widgets (NautilusWindow *window);
void nautilus_window_grab_focus (NautilusWindow *window);
-void nautilus_window_sync_search_widgets (NautilusWindow *window);
void nautilus_window_hide_sidebar (NautilusWindow *window);
void nautilus_window_show_sidebar (NautilusWindow *window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]