[nautilus] general: separate handling of windows/slots/views



commit 28f50cfe6ee7290b92d4a69c7ee557f07d73cd64
Author: Carlos Soriano <csoriano gnome org>
Date:   Wed Aug 26 17:11:45 2015 +0200

    general: separate handling of windows/slots/views
    
    This is another step towards the isolation of the management
    of the direcotories, views, slots and windows.
    The current situation had a few issues:
    - the comunication of changes in the model was done in a
    bidirectional way. So for example, sometimes the view updates
    directly the slot, sometimes directly the window, and sometimes
    the window was listening to changes on the model and updating the slot,
    view, or model itself. Problem with this is, encapsulation is wrong,
    the code paths are confusing, and the public API exposed is big.
    - public API is big, so even if sometimes if convenient to not do the
    same thing twice, having public API that is actually covered by the GLib
    or Gtk API doesn't worth it, if the complexity of the API grows too much.
    In Nautilus case, specifically on the slot, we were allowing all kind of
    convenient API, but it was behaving differently depending on small connotations.
    - management was not encapsulated. So the window was modifyng the model, or
    doing actions that belongs to the slot or the view. The same thing for the slot
    and the view, and similarly for the application and the window. For example,
    we were handling the flag for creating new windows on a specific window,
    instead of relying on the application management. Similar cases for the slot
    and the view.
    - there were multiple code paths for opening a location. This is one of the
    biggest changes on the patch. We were exposing API to open a location in every
    component, and we were using that API from other components above or below the
    hierarchy randomly. So for example the view was using the opening location
    API from the slot, the window, and the application; but with the same pourpose,
    opening a location in the active window.
    - API was not explicit. For example sometimes we wanted to open
    a location in the current active window, but somtimes it was implicit and
    sometimes not, and to be safe we were making it explicit on the caller.
    - we were using mutiple code paths with the same intention. This is related
    to the previous one, the intention in every caller was not clear.
    
    This patch tries to improve the situation, also thinking on the future
    rework of the views and separation of the desktop handling.
    The patch applies the following rules:
    - If the API is provided somehow by nautilus-file or Glib or Gtk, don't
    add new API. Custom API is fine if it is used inside the component itself,
    since the added complexity for tracking code paths is not that important.
    - Use one way communication, from the top level to the innermost component.
    In case that the component needs top level features, ask the most top level.
    A specific example, the view provides opening a new window with a selection.
    Although encapsulation is good, there is not a good way to avoid the dance
    from the model to the view to the slot to the window to the application.
    So instead of that, allow a quick shorcut only communicating to the top most
    level. In this way, the code path is always the same (therefore much easier to
    debug or to change code) and encapsulation is preserved.
    - don't break encapsulation. Only allow management of the component to the component
    itself or its parent. So for example, the slot is the one that manages errors on what
    happens in the slot itself.
    Exception to this is the application, that needs access to all the hierarchy for
    specific situations. For example for updating the dbus locations or to discern
    between a desktop window or a common window.
    - if two way communication is needed, listen changes through properties.
    We have been moving to properties lately, since it clearer and cleaner and
    allow a few features that are useful like listening to its changes withouth
    explicit API for it. This allows to bind properties in a clean way throuh the
    hierarchy and not breaking the encapsulation.
    
    In this patch most of the ground work is done, and some things are remaining
    like moving all the loading of the location to the view instead of the slot.
    Even if it is convenient to have some management on the slot to share between
    the views, some views don't use models at all, or they are not common
    files, like the other-locations, and this breaks the situation. At some point
    what we want for the files-view is having a common model API, that can be on top
    of nautilus-file or in nautilus-file itself.
    
    With this patch, a serie of improvements can be done now, and they will
    come in future patches.

 src/nautilus-application-actions.c |   13 +-
 src/nautilus-application.c         |  152 +++++++++--
 src/nautilus-application.h         |    7 +
 src/nautilus-bookmarks-window.c    |    3 +-
 src/nautilus-desktop-window.c      |    4 +-
 src/nautilus-files-view-dnd.c      |    5 +-
 src/nautilus-files-view.c          |   25 +-
 src/nautilus-location-entry.c      |   10 +-
 src/nautilus-mime-actions.c        |    4 +-
 src/nautilus-places-view.c         |   11 +-
 src/nautilus-window-slot-dnd.c     |   20 +-
 src/nautilus-window-slot.c         |  516 ++++++++++++------------------------
 src/nautilus-window-slot.h         |   36 +--
 src/nautilus-window.c              |  182 +++++++------
 src/nautilus-window.h              |   18 +-
 15 files changed, 469 insertions(+), 537 deletions(-)
---
diff --git a/src/nautilus-application-actions.c b/src/nautilus-application-actions.c
index 0c6aedc..72e31e5 100644
--- a/src/nautilus-application-actions.c
+++ b/src/nautilus-application-actions.c
@@ -37,16 +37,13 @@ action_new_window (GSimpleAction *action,
                   gpointer user_data)
 {
        GtkApplication *application = user_data;
-       NautilusWindow *window;
-       GtkWindow *cur_window;
+        GFile *home;
 
-       cur_window = gtk_application_get_active_window (application);
-       window = nautilus_application_create_window (NAUTILUS_APPLICATION (application),
-                                                    cur_window ?
-                                                    gtk_window_get_screen (cur_window) :
-                                                    gdk_screen_get_default ());
+        home = g_file_new_for_path (g_get_home_dir ());
+        nautilus_application_open_location_full (NAUTILUS_APPLICATION (application), home,
+                                                 NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW, NULL, NULL, NULL);
 
-       nautilus_window_slot_go_home (nautilus_window_get_active_slot (window), 0);
+        g_object_unref (home);
 }
 
 static void
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index 1b4fae1..a1f3f3f 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -417,10 +417,120 @@ get_window_slot_for_location (NautilusApplication *application, GFile *location)
        return slot;
 }
 
+static void
+new_window_show_callback (GtkWidget *widget,
+                          gpointer   user_data)
+{
+       NautilusWindow *window;
+
+       window = NAUTILUS_WINDOW (user_data);
+       nautilus_window_close (window);
+
+       g_signal_handlers_disconnect_by_func (widget,
+                                             G_CALLBACK (new_window_show_callback),
+                                             user_data);
+}
+
+void
+nautilus_application_open_location_full (NautilusApplication     *application,
+                                         GFile                   *location,
+                                         NautilusWindowOpenFlags  flags,
+                                         GList                   *selection,
+                                         NautilusWindow          *target_window,
+                                         NautilusWindowSlot      *target_slot)
+{
+        NautilusWindowSlot *active_slot;
+        NautilusWindow *active_window;
+        GFile *old_location;
+       char *old_uri, *new_uri;
+       gboolean use_same;
+
+       use_same = TRUE;
+        active_window = NAUTILUS_WINDOW (gtk_application_get_active_window (GTK_APPLICATION (application)));
+        active_slot = nautilus_window_get_active_slot (active_window);
+
+       /* Just for debug.*/
+
+       old_location = nautilus_window_slot_get_location (active_slot);
+        /* this happens at startup */
+        if (old_location == NULL)
+               old_uri = g_strdup ("(none)");
+        else
+                old_uri = g_file_get_uri (old_location);
+
+       new_uri = g_file_get_uri (location);
+
+       DEBUG ("Application opening location, old: %s, new: %s", old_uri, new_uri);
+       nautilus_profile_start ("Application opening location, old: %s, new: %s", old_uri, new_uri);
+
+       g_free (old_uri);
+       g_free (new_uri);
+        /* end debug */
+
+        if ((target_window && NAUTILUS_IS_DESKTOP_WINDOW (target_window)) ||
+            (!target_window && NAUTILUS_IS_DESKTOP_WINDOW (active_window))) {
+                NautilusWindow *desktop_target_window;
+
+                desktop_target_window = target_window ? target_window : active_window;
+               use_same = !nautilus_desktop_window_loaded (NAUTILUS_DESKTOP_WINDOW (desktop_target_window));
+
+               /* if we're requested to open a new tab on the desktop, open a window
+                * instead.
+                */
+               if (flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB) {
+                       flags ^= NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB;
+                       flags |= NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW;
+               }
+       }
+
+       g_assert (!((flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW) != 0 &&
+                   (flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB) != 0));
+
+       /* and if the flags specify so, this is overridden */
+       if ((flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW) != 0) {
+               use_same = FALSE;
+       }
+
+       /* now get/create the window */
+       if (use_same) {
+                if (!target_window) {
+                        if (!target_slot) {
+                                target_window = active_window;
+                        } else {
+                                target_window = nautilus_window_slot_get_window (target_slot);
+                        }
+                }
+       } else {
+               target_window = nautilus_application_create_window (application,
+                                                                    gtk_window_get_screen (GTK_WINDOW 
(active_window)));
+       }
+
+        g_assert (target_window != NULL);
+
+       /* close the current window if the flags say so */
+       if ((flags & NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND) != 0) {
+               if (NAUTILUS_IS_DESKTOP_WINDOW (active_window)) {
+                       if (gtk_widget_get_visible (GTK_WIDGET (target_window))) {
+                               nautilus_window_close (active_window);
+                       } else {
+                               g_signal_connect_object (target_window,
+                                                        "show",
+                                                        G_CALLBACK (new_window_show_callback),
+                                                        active_window,
+                                                        G_CONNECT_AFTER);
+                       }
+               }
+       }
+
+        /* Application is the one that manages windows, so this flag shouldn't use
+         * it anymore by any client */
+        flags &= ~NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW;
+        nautilus_window_open_location_full (target_window, location, flags, selection, target_slot);
+}
 
 static void
 open_window (NautilusApplication *application,
-            GFile *location)
+             GFile               *location)
 {
        NautilusWindow *window;
 
@@ -428,9 +538,13 @@ open_window (NautilusApplication *application,
        window = nautilus_application_create_window (application, gdk_screen_get_default ());
 
        if (location != NULL) {
-               nautilus_window_go_to (window, location);
+                nautilus_application_open_location_full (application, location, 0, NULL, window, NULL);
        } else {
-               nautilus_window_slot_go_home (nautilus_window_get_active_slot (window), 0);
+                GFile *home;
+               home = g_file_new_for_path (g_get_home_dir ());
+                nautilus_application_open_location_full (application, home, 0, NULL, window, NULL);
+
+                g_object_unref (home);
        }
 
        nautilus_profile_end (NULL);
@@ -438,9 +552,9 @@ open_window (NautilusApplication *application,
 
 void
 nautilus_application_open_location (NautilusApplication *application,
-                                   GFile *location,
-                                   GFile *selection,
-                                   const char *startup_id)
+                                    GFile               *location,
+                                    GFile               *selection,
+                                    const char          *startup_id)
 {
        NautilusWindow *window;
        NautilusWindowSlot *slot;
@@ -448,22 +562,19 @@ nautilus_application_open_location (NautilusApplication *application,
 
        nautilus_profile_start (NULL);
 
+       if (selection != NULL) {
+               sel_list = g_list_prepend (sel_list, nautilus_file_get (selection));
+       }
+
        slot = get_window_slot_for_location (application, location);
 
        if (!slot) {
                window = nautilus_application_create_window (application, gdk_screen_get_default ());
-               slot = nautilus_window_get_active_slot (window);
        } else {
                window = nautilus_window_slot_get_window (slot);
-               nautilus_window_set_active_slot (window, slot);
-               gtk_window_present (GTK_WINDOW (window));
        }
 
-       if (selection != NULL) {
-               sel_list = g_list_prepend (sel_list, nautilus_file_get (selection));
-       }
-
-       nautilus_window_slot_open_location_full (slot, location, 0, sel_list, NULL, NULL);
+       nautilus_application_open_location_full (application, location, 0, sel_list, window, slot);
 
        if (sel_list != NULL) {
                nautilus_file_list_free (sel_list);
@@ -487,7 +598,6 @@ nautilus_application_open (GApplication *app,
        NautilusApplication *self = NAUTILUS_APPLICATION (app);
        gboolean force_new = (g_strcmp0 (hint, "new-window") == 0);
        NautilusWindowSlot *slot = NULL;
-       NautilusWindow *window;
        GFile *file;
        gint idx;
 
@@ -505,11 +615,7 @@ nautilus_application_open (GApplication *app,
                        open_window (self, file);
                } else {
                        /* We open the location again to update any possible selection */
-                       nautilus_window_slot_open_location (slot, file, 0);
-
-                       window = nautilus_window_slot_get_window (slot);
-                       nautilus_window_set_active_slot (window, slot);
-                       gtk_window_present (GTK_WINDOW (window));
+                       nautilus_application_open_location_full (NAUTILUS_APPLICATION (app), file, 0, NULL, 
NULL, slot);
                }
        }
 }
@@ -997,6 +1103,7 @@ update_dbus_opened_locations (NautilusApplication *app)
        gsize locations_size = 0;
        gchar **locations_array;
        NautilusWindow *window;
+        GFile *location;
 
        g_return_if_fail (NAUTILUS_IS_APPLICATION (app));
 
@@ -1005,9 +1112,10 @@ update_dbus_opened_locations (NautilusApplication *app)
 
                for (sl = nautilus_window_get_slots (window); sl; sl = sl->next) {
                        NautilusWindowSlot *slot = sl->data;
-                       gchar *uri = nautilus_window_slot_get_location_uri (slot);
+                        location = nautilus_window_slot_get_location (slot);
 
-                       if (uri) {
+                       if (location != NULL) {
+                               gchar *uri = g_file_get_uri (location);
                                GList *found = g_list_find_custom (locations, uri, (GCompareFunc) g_strcmp0);
 
                                if (!found) {
diff --git a/src/nautilus-application.h b/src/nautilus-application.h
index 179a4f4..4aaa90c 100644
--- a/src/nautilus-application.h
+++ b/src/nautilus-application.h
@@ -71,6 +71,13 @@ void nautilus_application_open_location (NautilusApplication *application,
                                         GFile *selection,
                                         const char *startup_id);
 
+void nautilus_application_open_location_full (NautilusApplication     *application,
+                                              GFile                   *location,
+                                              NautilusWindowOpenFlags  flags,
+                                              GList                   *selection,
+                                              NautilusWindow          *target_window,
+                                              NautilusWindowSlot      *target_slot);
+
 NautilusBookmarkList *
      nautilus_application_get_bookmarks  (NautilusApplication *application);
 void nautilus_application_edit_bookmarks (NautilusApplication *application,
diff --git a/src/nautilus-bookmarks-window.c b/src/nautilus-bookmarks-window.c
index 122aba4..d034544 100644
--- a/src/nautilus-bookmarks-window.c
+++ b/src/nautilus-bookmarks-window.c
@@ -609,7 +609,8 @@ on_row_activated (GtkTreeView       *view,
                return;
        }
 
-       nautilus_window_go_to (self->priv->parent_window, location);
+        nautilus_application_open_location_full (NAUTILUS_APPLICATION (g_application_get_default ()),
+                                                 location, 0, NULL, NULL, NULL);
        g_object_unref (location);
 }
 
diff --git a/src/nautilus-desktop-window.c b/src/nautilus-desktop-window.c
index a7c647c..bde4622 100644
--- a/src/nautilus-desktop-window.c
+++ b/src/nautilus-desktop-window.c
@@ -24,6 +24,7 @@
 #include <config.h>
 #include "nautilus-desktop-window.h"
 #include "nautilus-window.h"
+#include "nautilus-application.h"
 
 #include <X11/Xatom.h>
 #include <gdk/gdkx.h>
@@ -57,7 +58,8 @@ nautilus_desktop_window_update_directory (NautilusDesktopWindow *window)
 
        window->details->loaded = FALSE;
        location = g_file_new_for_uri (EEL_DESKTOP_URI);
-       nautilus_window_go_to (NAUTILUS_WINDOW (window), location);
+        nautilus_application_open_location_full (NAUTILUS_APPLICATION (g_application_get_default ()),
+                                                 location, 0, NULL, NAUTILUS_WINDOW (window), NULL);
        window->details->loaded = TRUE;
 
        g_object_unref (location);
diff --git a/src/nautilus-files-view-dnd.c b/src/nautilus-files-view-dnd.c
index 90c5b46..6ce84be 100644
--- a/src/nautilus-files-view-dnd.c
+++ b/src/nautilus-files-view-dnd.c
@@ -30,6 +30,7 @@
 #include "nautilus-files-view-dnd.h"
 
 #include "nautilus-files-view.h"
+#include "nautilus-application.h"
 
 #include <eel/eel-stock-dialogs.h>
 #include <eel/eel-string.h>
@@ -540,7 +541,9 @@ nautilus_files_view_handle_hover (NautilusFilesView *view,
         target_is_dir = nautilus_file_get_file_type (target_file) == G_FILE_TYPE_DIRECTORY;
         current_location = nautilus_window_slot_get_location (slot);
         if (target_is_dir && ! (current_location != NULL && g_file_equal(location, current_location))) {
-                nautilus_window_slot_open_location (slot, location, 0);
+                nautilus_application_open_location_full (NAUTILUS_APPLICATION (g_application_get_default ()),
+                                                         location, 
NAUTILUS_WINDOW_OPEN_FLAG_DONT_MAKE_ACTIVE,
+                                                         NULL, NULL, slot);
         }
         g_object_unref (location);
         nautilus_file_unref (target_file);
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 9958115..2179437 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -4174,14 +4174,12 @@ static GList *
 get_extension_background_menu_items (NautilusFilesView *view)
 {
         NautilusWindow *window;
-        NautilusFile *file;
         GList *items;
         GList *providers;
         GList *l;
 
         window = nautilus_files_view_get_window (view);
         providers = nautilus_module_get_extensions_for_type (NAUTILUS_TYPE_MENU_PROVIDER);
-        file = nautilus_window_slot_get_file (view->details->slot);
         items = NULL;
 
         for (l = providers; l != NULL; l = l->next) {
@@ -4191,7 +4189,7 @@ get_extension_background_menu_items (NautilusFilesView *view)
                 provider = NAUTILUS_MENU_PROVIDER (l->data);
                 file_items = nautilus_menu_provider_get_background_items (provider,
                                                                           GTK_WIDGET (window),
-                                                                          file);
+                                                                          view->details->directory_as_file);
                 items = g_list_concat (items, file_items);
         }
 
@@ -4983,15 +4981,14 @@ action_open_scripts_folder (GSimpleAction *action,
                             GVariant      *state,
                             gpointer       user_data)
 {
-        NautilusFilesView *view;
         static GFile *location = NULL;
 
         if (location == NULL) {
                 location = g_file_new_for_uri (scripts_directory_uri);
         }
 
-        view = NAUTILUS_FILES_VIEW (user_data);
-        nautilus_window_slot_open_location (view->details->slot, location, 0);
+        nautilus_application_open_location_full (NAUTILUS_APPLICATION (g_application_get_default ()),
+                                                 location, 0, NULL, NULL, NULL);
 }
 
 typedef struct _CopyCallbackData {
@@ -5048,26 +5045,30 @@ static void
 add_bookmarks_for_window_slot (CopyCallbackData   *data,
                                NautilusWindowSlot *slot)
 {
+        GFile *location;
         char *uri;
 
-        uri = nautilus_window_slot_get_location_uri (slot);
-        if (uri != NULL) {
+        location = nautilus_window_slot_get_location (slot);
+        if (location != NULL) {
+                uri = g_file_get_uri (location);
                 add_bookmark_for_uri (data, uri);
+                g_free (uri);
         }
-        g_free (uri);
 }
 
 static void
 remove_bookmarks_for_window_slot (CopyCallbackData   *data,
                                   NautilusWindowSlot *slot)
 {
+        GFile *location;
         char *uri;
 
-        uri = nautilus_window_slot_get_location_uri (slot);
-        if (uri != NULL) {
+        location = nautilus_window_slot_get_location (slot);
+        if (location != NULL) {
+                uri = g_file_get_uri (location);
                 remove_bookmark_for_uri (data, uri);
+                g_free (uri);
         }
-        g_free (uri);
 }
 
 static void
diff --git a/src/nautilus-location-entry.c b/src/nautilus-location-entry.c
index f0c637d..4c738be 100644
--- a/src/nautilus-location-entry.c
+++ b/src/nautilus-location-entry.c
@@ -225,11 +225,8 @@ drag_data_received_callback (GtkWidget *widget,
                             gpointer callback_data)
 {
        char **names;
-       NautilusApplication *application;
        int name_count;
-       NautilusWindow *new_window;
        GtkWidget *window;
-       GdkScreen      *screen;
        gboolean new_windows_for_extras;
        char *prompt;
        char *detail;
@@ -290,13 +287,10 @@ drag_data_received_callback (GtkWidget *widget,
        if (new_windows_for_extras) {
                int i;
 
-               application = NAUTILUS_APPLICATION (g_application_get_default ());
-               screen = gtk_window_get_screen (GTK_WINDOW (window));
-
                for (i = 1; names[i] != NULL; ++i) {
-                       new_window = nautilus_application_create_window (application, screen);
                        location = g_file_new_for_uri (names[i]);
-                       nautilus_window_go_to (new_window, location);
+                        nautilus_application_open_location_full (NAUTILUS_APPLICATION 
(g_application_get_default ()),
+                                                                 location, 
NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW, NULL, NULL, NULL);
                        g_object_unref (location);
                }
        }
diff --git a/src/nautilus-mime-actions.c b/src/nautilus-mime-actions.c
index 2251383..493aee4 100644
--- a/src/nautilus-mime-actions.c
+++ b/src/nautilus-mime-actions.c
@@ -26,6 +26,7 @@
 #include "nautilus-mime-actions.h"
 
 #include "nautilus-window-slot.h"
+#include "nautilus-application.h"
 
 #include <eel/eel-glib-extensions.h>
 #include <eel/eel-stock-dialogs.h>
@@ -1548,7 +1549,8 @@ activate_files (ActivateParameters *parameters)
 
                        uri = nautilus_file_get_activation_uri (file);
                        f = g_file_new_for_uri (uri);
-                       nautilus_window_slot_open_location (parameters->slot, f, flags);
+                        nautilus_application_open_location_full (NAUTILUS_APPLICATION 
(g_application_get_default ()),
+                                                                 f, flags, NULL, NULL, NULL);
                        g_object_unref (f);
                        g_free (uri);
                }
diff --git a/src/nautilus-places-view.c b/src/nautilus-places-view.c
index 7a4d15f..1d5db8b 100644
--- a/src/nautilus-places-view.c
+++ b/src/nautilus-places-view.c
@@ -19,6 +19,7 @@
 #include "nautilus-mime-actions.h"
 #include "nautilus-places-view.h"
 #include "nautilus-window-slot.h"
+#include "nautilus-application.h"
 #include "gtk/gtkplacesviewprivate.h"
 
 typedef struct
@@ -199,16 +200,12 @@ nautilus_places_view_set_location (NautilusView *view,
 
                 /*
                  * If it's not trying to open the places view itself, simply
-                 * delegates the location to window-slot, which takes care of
+                 * delegates the location to application, which takes care of
                  * selecting the appropriate view.
                  */
                 if (!g_strcmp0 (uri, "other-locations:///") == 0) {
-                        GtkWidget *slot;
-
-                        slot = gtk_widget_get_ancestor (GTK_WIDGET (view), NAUTILUS_TYPE_WINDOW_SLOT);
-                        g_assert (slot != NULL);
-
-                        nautilus_window_slot_open_location (NAUTILUS_WINDOW_SLOT (slot), location, 0);
+                        nautilus_application_open_location_full (NAUTILUS_APPLICATION 
(g_application_get_default ()),
+                                                                 location, 0, NULL, NULL, NULL);
                 } else {
                         g_set_object (&priv->location, location);
                 }
diff --git a/src/nautilus-window-slot-dnd.c b/src/nautilus-window-slot-dnd.c
index af15c18..6c9fea5 100644
--- a/src/nautilus-window-slot-dnd.c
+++ b/src/nautilus-window-slot-dnd.c
@@ -26,6 +26,7 @@
 #include <config.h>
 
 #include "nautilus-notebook.h"
+#include "nautilus-application.h"
 #include "nautilus-files-view-dnd.h"
 #include "nautilus-window-slot-dnd.h"
 
@@ -79,8 +80,6 @@ static void
 switch_location (NautilusDragSlotProxyInfo *drag_info)
 {
   GFile *location;
-  GFile *current_location;
-  NautilusWindowSlot *target_slot;
   GtkWidget *window;
 
   if (drag_info->target_file == NULL) {
@@ -90,13 +89,10 @@ switch_location (NautilusDragSlotProxyInfo *drag_info)
   window = gtk_widget_get_toplevel (drag_info->widget);
   g_assert (NAUTILUS_IS_WINDOW (window));
 
-  target_slot = nautilus_window_get_active_slot (NAUTILUS_WINDOW (window));
-
-  current_location = nautilus_window_slot_get_location (target_slot);
   location = nautilus_file_get_location (drag_info->target_file);
-  if (! (current_location != NULL && g_file_equal (location, current_location))) {
-       nautilus_window_slot_open_location (target_slot, location, 0);
-  }
+  nautilus_application_open_location_full (NAUTILUS_APPLICATION (g_application_get_default ()),
+                                           location, NAUTILUS_WINDOW_OPEN_FLAG_DONT_MAKE_ACTIVE,
+                                           NULL, NAUTILUS_WINDOW (window), NULL);
   g_object_unref (location);
 }
 
@@ -158,6 +154,7 @@ slot_proxy_drag_motion (GtkWidget          *widget,
   GdkAtom target;
   int action;
   char *target_uri;
+  GFile *location;
   gboolean valid_text_drag;
   gboolean valid_xds_drag;
 
@@ -195,7 +192,8 @@ slot_proxy_drag_motion (GtkWidget          *widget,
     }
 
     if (target_slot != NULL) {
-      target_uri = nautilus_window_slot_get_current_uri (target_slot);
+        location = nautilus_window_slot_get_location (target_slot);
+        target_uri = g_file_get_uri (location);
     }
   }
 
@@ -334,6 +332,7 @@ slot_proxy_handle_drop (GtkWidget                *widget,
   NautilusFilesView *target_view;
   char *target_uri;
   GList *uri_list;
+  GFile *location;
 
   if (!drag_info->have_data ||
       !drag_info->have_valid_data) {
@@ -355,7 +354,8 @@ slot_proxy_handle_drop (GtkWidget                *widget,
   if (drag_info->target_file != NULL) {
     target_uri = nautilus_file_get_uri (drag_info->target_file);
   } else if (target_slot != NULL) {
-    target_uri = nautilus_window_slot_get_current_uri (target_slot);
+    location = nautilus_window_slot_get_location (target_slot);
+    target_uri = g_file_get_uri (location);
   }
 
   target_view = NULL;
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index a47a178..d48be27 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -62,6 +62,7 @@ enum {
        PROP_WINDOW,
         PROP_ICON,
         PROP_VIEW_WIDGET,
+       PROP_LOADING,
        NUM_PROPERTIES
 };
 
@@ -69,6 +70,7 @@ struct NautilusWindowSlotDetails {
        NautilusWindow *window;
 
         gboolean active : 1;
+        guint loading : 1;
 
        /* slot contains
         *  1) an vbox containing extra_location_widgets
@@ -123,8 +125,6 @@ struct NautilusWindowSlotDetails {
        GCancellable *mount_cancellable;
        GError *mount_error;
        gboolean tried_mount;
-       NautilusWindowGoToCallback open_callback;
-       gpointer open_callback_user_data;
         gchar *view_mode_before_search;
         gchar *view_mode_before_places;
 };
@@ -142,6 +142,10 @@ static void nautilus_window_slot_emit_location_change (NautilusWindowSlot *slot,
 static gboolean nautilus_window_slot_content_view_matches (NautilusWindowSlot *slot, const char *iid);
 static NautilusView* nautilus_window_slot_get_view_for_location (NautilusWindowSlot *slot, GFile *location);
 static void nautilus_window_slot_set_content_view (NautilusWindowSlot *slot, const char        *id);
+static void nautilus_window_slot_set_loading (NautilusWindowSlot *slot, gboolean loading);
+char * nautilus_window_slot_get_location_uri (NautilusWindowSlot *slot);
+static void nautilus_window_slot_set_search_visible (NautilusWindowSlot *slot,
+                                                    gboolean            visible);
 
 static NautilusView*
 nautilus_window_slot_get_view_for_location (NautilusWindowSlot *slot,
@@ -315,7 +319,7 @@ query_editor_changed_callback (NautilusQueryEditor *editor,
         view = nautilus_window_slot_get_current_view (slot);
 
         nautilus_view_set_search_query (view, query);
-        nautilus_window_slot_open_location (slot, nautilus_view_get_location (view), 0);
+        nautilus_window_slot_open_location_full (slot, nautilus_view_get_location (view), 0, NULL);
 }
 
 static void
@@ -350,9 +354,7 @@ hide_query_editor (NautilusWindowSlot *slot)
                 nautilus_window_slot_open_location_full (slot,
                                                          nautilus_view_get_location (view),
                                                          0,
-                                                         selection,
-                                                         NULL,
-                                                         NULL);
+                                                         selection);
 
                 nautilus_file_list_free (selection);
         }
@@ -416,7 +418,7 @@ show_query_editor (NautilusWindowSlot *slot)
        }
 }
 
-void
+static void
 nautilus_window_slot_set_search_visible (NautilusWindowSlot *slot,
                                         gboolean            visible)
 {
@@ -559,6 +561,9 @@ nautilus_window_slot_get_property (GObject *object,
         case PROP_VIEW_WIDGET:
                 g_value_set_object (value, nautilus_window_slot_get_view_widget (slot));
                 break;
+        case PROP_LOADING:
+                g_value_set_boolean (value, nautilus_window_slot_get_loading (slot));
+                break;
        default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
                break;
@@ -692,196 +697,58 @@ nautilus_window_slot_init (NautilusWindowSlot *slot)
 #define MAX_URI_IN_DIALOG_LENGTH 60
 
 static void begin_location_change                     (NautilusWindowSlot         *slot,
-                                                      GFile                      *location,
-                                                      GFile                      *previous_location,
-                                                      GList                      *new_selection,
-                                                      NautilusLocationChangeType  type,
-                                                      guint                       distance,
-                                                      const char                 *scroll_pos,
-                                                      NautilusWindowGoToCallback  callback,
-                                                      gpointer                    user_data);
+                                                       GFile                      *location,
+                                                       GFile                      *previous_location,
+                                                       GList                      *new_selection,
+                                                       NautilusLocationChangeType  type,
+                                                       guint                       distance,
+                                                       const char                 *scroll_pos);
 static void free_location_change                      (NautilusWindowSlot         *slot);
 static void end_location_change                       (NautilusWindowSlot         *slot);
 static void cancel_location_change                    (NautilusWindowSlot         *slot);
 static void got_file_info_for_view_selection_callback (NautilusFile               *file,
                                                       gpointer                    callback_data);
-static gboolean setup_view                            (NautilusWindowSlot         *slot,
-                                                       NautilusView               *view,
-                                                      GError                    **error);
+static gboolean setup_view                            (NautilusWindowSlot *slot,
+                                                       NautilusView       *view);
 static void load_new_location                         (NautilusWindowSlot         *slot,
                                                       GFile                      *location,
                                                       GList                      *selection,
                                                       gboolean                    tell_current_content_view,
                                                       gboolean                    tell_new_content_view);
 
-static void
-new_window_show_callback (GtkWidget *widget,
-                         gpointer user_data){
-       NautilusWindow *window;
-
-       window = NAUTILUS_WINDOW (user_data);
-       nautilus_window_close (window);
-
-       g_signal_handlers_disconnect_by_func (widget,
-                                             G_CALLBACK (new_window_show_callback),
-                                             user_data);
-}
-
 void
-nautilus_window_slot_open_location_full (NautilusWindowSlot *slot,
-                                        GFile *location,
-                                        NautilusWindowOpenFlags flags,
-                                        GList *new_selection,
-                                        NautilusWindowGoToCallback callback,
-                                        gpointer user_data)
+nautilus_window_slot_open_location_full (NautilusWindowSlot      *slot,
+                                         GFile                   *location,
+                                         NautilusWindowOpenFlags  flags,
+                                         GList                   *new_selection)
 {
-       NautilusWindow *window;
-        NautilusWindow *target_window;
-        NautilusWindowSlot *target_slot;
-       NautilusWindowOpenFlags slot_flags;
        GFile *old_location;
        GList *old_selection;
-       char *old_uri, *new_uri;
-       int new_slot_position;
-       gboolean use_same;
-       gboolean is_desktop;
-
-       window = nautilus_window_slot_get_window (slot);
-
-        target_window = NULL;
-       target_slot = NULL;
-       use_same = TRUE;
-
-       /* this happens at startup */
-       old_uri = nautilus_window_slot_get_location_uri (slot);
-       if (old_uri == NULL) {
-               old_uri = g_strdup ("(none)");
-               use_same = TRUE;
-       }
-       new_uri = g_file_get_uri (location);
-
-       DEBUG ("Opening location, old: %s, new: %s", old_uri, new_uri);
-       nautilus_profile_start ("Opening location, old: %s, new: %s", old_uri, new_uri);
-
-       g_free (old_uri);
-       g_free (new_uri);
-
-       is_desktop = NAUTILUS_IS_DESKTOP_WINDOW (window);
-
-       if (is_desktop) {
-               use_same = !nautilus_desktop_window_loaded (NAUTILUS_DESKTOP_WINDOW (window));
-
-               /* if we're requested to open a new tab on the desktop, open a window
-                * instead.
-                */
-               if (flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB) {
-                       flags ^= NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB;
-                       flags |= NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW;
-               }
-       }
-
-       g_assert (!((flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW) != 0 &&
-                   (flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB) != 0));
-
-       /* and if the flags specify so, this is overridden */
-       if ((flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW) != 0) {
-               use_same = FALSE;
-       }
-
-       old_location = nautilus_window_slot_get_location (slot);
-
-       /* now get/create the window */
-       if (use_same) {
-               target_window = window;
-       } else {
-               target_window = nautilus_application_create_window
-                       (NAUTILUS_APPLICATION (g_application_get_default ()),
-                        gtk_window_get_screen (GTK_WINDOW (window)));
-       }
-
-        g_assert (target_window != NULL);
-
-       /* if the flags say we want a new tab, open a slot in the current window */
-       if ((flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB) != 0) {
-               g_assert (target_window == window);
-
-               slot_flags = 0;
-
-               new_slot_position = g_settings_get_enum (nautilus_preferences, 
NAUTILUS_PREFERENCES_NEW_TAB_POSITION);
-               if (new_slot_position == NAUTILUS_NEW_TAB_POSITION_END) {
-                       slot_flags = NAUTILUS_WINDOW_OPEN_SLOT_APPEND;
-               }
-
-               target_slot = nautilus_window_open_slot (window,
-                                                        slot_flags);
-       }
-
-       /* close the current window if the flags say so */
-       if ((flags & NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND) != 0) {
-               if (!is_desktop) {
-                       if (gtk_widget_get_visible (GTK_WIDGET (target_window))) {
-                               nautilus_window_close (window);
-                       } else {
-                               g_signal_connect_object (target_window,
-                                                        "show",
-                                                        G_CALLBACK (new_window_show_callback),
-                                                        window,
-                                                        G_CONNECT_AFTER);
-                       }
-               }
-       }
-
-       if (target_slot == NULL) {
-               if (target_window == window) {
-                       target_slot = slot;
-               } else {
-                       target_slot = nautilus_window_get_active_slot (target_window);
-               }
-       }
+        NautilusWindow *window;
+        gboolean is_desktop;
 
        old_selection = NULL;
+        old_location = nautilus_window_slot_get_location (slot);
+        window = nautilus_window_slot_get_window (slot);
+        is_desktop = NAUTILUS_IS_DESKTOP_CANVAS_VIEW (window);
+
         if (slot->details->content_view) {
                 old_selection = nautilus_view_get_selection (slot->details->content_view);
        }
-
-       if (target_window == window && target_slot == slot && !is_desktop &&
-           old_location && g_file_equal (old_location, location) &&
-           nautilus_file_selection_equal (old_selection, new_selection)) {
-
-               if (callback != NULL) {
-                       callback (window, location, NULL, user_data);
-               }
-
-               goto done;
-       }
+        if (!is_desktop &&
+            old_location && g_file_equal (old_location, location) &&
+            nautilus_file_selection_equal (old_selection, new_selection))
+          goto done;
 
        slot->details->pending_use_default_location = ((flags & 
NAUTILUS_WINDOW_OPEN_FLAG_USE_DEFAULT_LOCATION) != 0);
-       begin_location_change (target_slot, location, old_location, new_selection,
-                              NAUTILUS_LOCATION_CHANGE_STANDARD, 0, NULL, callback, user_data);
+       begin_location_change (slot, location, old_location, new_selection,
+                              NAUTILUS_LOCATION_CHANGE_STANDARD, 0, NULL);
 
  done:
        nautilus_file_list_free (old_selection);
        nautilus_profile_end (NULL);
 }
 
-static gboolean
-report_callback (NautilusWindowSlot *slot,
-                GError *error)
-{
-       if (slot->details->open_callback != NULL) {
-               gboolean res;
-               res = slot->details->open_callback (nautilus_window_slot_get_window (slot),
-                                                   slot->details->pending_location,
-                                                   error, slot->details->open_callback_user_data);
-               slot->details->open_callback = NULL;
-               slot->details->open_callback_user_data = NULL;
-
-               return res;
-       }
-
-       return FALSE;
-}
-
 /*
  * begin_location_change
  *
@@ -894,22 +761,18 @@ report_callback (NautilusWindowSlot *slot,
  * @distance: If type is back or forward, the index into the back or forward chain. If
  * type is standard or reload, this is ignored, and must be 0.
  * @scroll_pos: The file to scroll to when the location is loaded.
- * @callback: function to be called when the location is changed.
- * @user_data: data for @callback.
  *
  * This is the core function for changing the location of a window. Every change to the
  * location begins here.
  */
 static void
-begin_location_change (NautilusWindowSlot *slot,
-                       GFile *location,
-                       GFile *previous_location,
-                      GList *new_selection,
-                       NautilusLocationChangeType type,
-                       guint distance,
-                       const char *scroll_pos,
-                      NautilusWindowGoToCallback callback,
-                      gpointer user_data)
+begin_location_change (NautilusWindowSlot         *slot,
+                       GFile                      *location,
+                       GFile                      *previous_location,
+                       GList                      *new_selection,
+                       NautilusLocationChangeType  type,
+                       guint                       distance,
+                       const char                 *scroll_pos)
 {
         NautilusDirectory *directory;
         NautilusFile *file;
@@ -971,9 +834,6 @@ begin_location_change (NautilusWindowSlot *slot,
 
        slot->details->pending_scroll_to = g_strdup (scroll_pos);
 
-       slot->details->open_callback = callback;
-       slot->details->open_callback_user_data = user_data;
-
        /* The code to force a reload is here because if we do it
         * after determining an initial view (in the components), then
         * we end up fetching things twice.
@@ -1101,7 +961,7 @@ viewed_file_changed_callback (NautilusFile *file,
                                go_to_file = g_file_new_for_path (g_get_home_dir ());
                        }
 
-                       nautilus_window_slot_open_location (slot, go_to_file, 0);
+                       nautilus_window_slot_open_location_full (slot, go_to_file, 0, NULL);
 
                        g_clear_object (&parent);
                        g_object_unref (go_to_file);
@@ -1115,6 +975,19 @@ viewed_file_changed_callback (NautilusFile *file,
 }
 
 static void
+nautilus_window_slot_go_home (NautilusWindowSlot *slot,
+                             NautilusWindowOpenFlags flags)
+{
+       GFile *home;
+
+       g_return_if_fail (NAUTILUS_IS_WINDOW_SLOT (slot));
+
+       home = g_file_new_for_path (g_get_home_dir ());
+       nautilus_window_slot_open_location_full (slot, home, flags, NULL);
+       g_object_unref (home);
+}
+
+static void
 nautilus_window_slot_set_viewed_file (NautilusWindowSlot *slot,
                                      NautilusFile *file)
 {
@@ -1197,6 +1070,73 @@ mount_not_mounted_callback (GObject *source_object,
 }
 
 static void
+nautilus_window_slot_display_view_selection_failure (NautilusWindow *window,
+                                                     NautilusFile   *file,
+                                                     GFile          *location,
+                                                     GError         *error)
+{
+       char *error_message;
+       char *detail_message;
+       char *scheme_string;
+
+       /* Some sort of failure occurred. How 'bout we tell the user? */
+
+       error_message = g_strdup (_("Oops! Something went wrong."));
+       detail_message = NULL;
+       if (error == NULL) {
+               if (nautilus_file_is_directory (file)) {
+                       detail_message = g_strdup (_("Unable to display the contents of this folder."));
+               } else {
+                       detail_message = g_strdup (_("This location doesn't appear to be a folder."));
+               }
+       } else if (error->domain == G_IO_ERROR) {
+               switch (error->code) {
+               case G_IO_ERROR_NOT_FOUND:
+                       detail_message = g_strdup (_("Unable to find the requested file. Please check the 
spelling and try again."));
+                       break;
+               case G_IO_ERROR_NOT_SUPPORTED:
+                       scheme_string = g_file_get_uri_scheme (location);
+                       if (scheme_string != NULL) {
+                               detail_message = g_strdup_printf (_("“%s” locations are not supported."),
+                                                                 scheme_string);
+                       } else {
+                               detail_message = g_strdup (_("Unable to handle this kind of location."));
+                       }
+                       g_free (scheme_string);
+                       break;
+               case G_IO_ERROR_NOT_MOUNTED:
+                       detail_message = g_strdup (_("Unable to access the requested location."));
+                       break;
+               case G_IO_ERROR_PERMISSION_DENIED:
+                       detail_message = g_strdup (_("Don't have permission to access the requested 
location."));
+                       break;
+               case G_IO_ERROR_HOST_NOT_FOUND:
+                       /* This case can be hit for user-typed strings like "foo" due to
+                        * the code that guesses web addresses when there's no initial "/".
+                        * But this case is also hit for legitimate web addresses when
+                        * the proxy is set up wrong.
+                        */
+                       detail_message = g_strdup (_("Unable to find the requested location. Please check the 
spelling or the network settings."));
+                       break;
+               case G_IO_ERROR_CANCELLED:
+               case G_IO_ERROR_FAILED_HANDLED:
+                       goto done;
+               default:
+                       break;
+               }
+       }
+
+       if (detail_message == NULL) {
+               detail_message = g_strdup_printf (_("Unhandled error message: %s"), error->message);
+       }
+
+       eel_show_error_dialog (error_message, detail_message, GTK_WINDOW (window));
+ done:
+       g_free (error_message);
+       g_free (detail_message);
+}
+
+static void
 got_file_info_for_view_selection_callback (NautilusFile *file,
                                           gpointer callback_data)
 {
@@ -1309,23 +1249,16 @@ got_file_info_for_view_selection_callback (NautilusFile *file,
        }
 
         if (view != NULL) {
-               GError *err = NULL;
-
-                setup_view (slot, view, &err);
-
-               report_callback (slot, err);
-               g_clear_error (&err);
+                setup_view (slot, view);
        } else {
                if (error == NULL) {
                        error = g_error_new (G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
                                             _("Unable to load location"));
                }
-               if (!report_callback (slot, error)) {
-                       nautilus_window_slot_display_view_selection_failure (window,
-                                                                             file,
-                                                                             location,
-                                                                             error);
-               }
+               nautilus_window_slot_display_view_selection_failure (window,
+                                                                     file,
+                                                                     location,
+                                                                     error);
 
                if (!gtk_widget_get_visible (GTK_WIDGET (window))) {
                        /* Destroy never-had-a-chance-to-be-seen window. This case
@@ -1348,7 +1281,7 @@ got_file_info_for_view_selection_callback (NautilusFile *file,
 
                                                root = g_file_new_for_path ("/");
                                                /* the last fallback is to go to a known place that can't be 
deleted! */
-                                               nautilus_window_slot_open_location (slot, location, 0);
+                                               nautilus_window_slot_open_location_full (slot, location, 0, 
NULL);
                                                g_object_unref (root);
                                        }
                                } else {
@@ -1399,12 +1332,10 @@ got_file_info_for_view_selection_callback (NautilusFile *file,
  * view, and the current location will be used.
  */
 static gboolean
-setup_view (NautilusWindowSlot  *slot,
-            NautilusView        *view,
-            GError             **error_out)
+setup_view (NautilusWindowSlot *slot,
+            NautilusView       *view)
 {
        gboolean ret = TRUE;
-       GError *error = NULL;
        GFile *old_location;
 
        nautilus_profile_start (NULL);
@@ -1440,20 +1371,14 @@ setup_view (NautilusWindowSlot  *slot,
                                   TRUE);
                g_list_free_full (selection, g_object_unref);
        } else {
-               /* Something is busted, there was no location to load. */
-               ret = FALSE;
-               error = g_error_new (G_IO_ERROR,
-                                    G_IO_ERROR_NOT_FOUND,
-                                    _("Unable to load location"));
-       }
-
-       if (error != NULL) {
-               g_propagate_error (error_out, error);
-       } else {
-                change_view (slot);
-                gtk_widget_show (GTK_WIDGET (slot->details->window));
+                ret = FALSE;
+                goto out;
         }
 
+        change_view (slot);
+        gtk_widget_show (GTK_WIDGET (slot->details->window));
+
+out:
        nautilus_profile_end (NULL);
 
        return ret;
@@ -1585,73 +1510,6 @@ cancel_location_change (NautilusWindowSlot *slot)
 }
 
 void
-nautilus_window_slot_display_view_selection_failure (NautilusWindow *window,
-                                                     NautilusFile   *file,
-                                                     GFile          *location,
-                                                     GError         *error)
-{
-       char *error_message;
-       char *detail_message;
-       char *scheme_string;
-
-       /* Some sort of failure occurred. How 'bout we tell the user? */
-
-       error_message = g_strdup (_("Oops! Something went wrong."));
-       detail_message = NULL;
-       if (error == NULL) {
-               if (nautilus_file_is_directory (file)) {
-                       detail_message = g_strdup (_("Unable to display the contents of this folder."));
-               } else {
-                       detail_message = g_strdup (_("This location doesn't appear to be a folder."));
-               }
-       } else if (error->domain == G_IO_ERROR) {
-               switch (error->code) {
-               case G_IO_ERROR_NOT_FOUND:
-                       detail_message = g_strdup (_("Unable to find the requested file. Please check the 
spelling and try again."));
-                       break;
-               case G_IO_ERROR_NOT_SUPPORTED:
-                       scheme_string = g_file_get_uri_scheme (location);
-                       if (scheme_string != NULL) {
-                               detail_message = g_strdup_printf (_("“%s” locations are not supported."),
-                                                                 scheme_string);
-                       } else {
-                               detail_message = g_strdup (_("Unable to handle this kind of location."));
-                       }
-                       g_free (scheme_string);
-                       break;
-               case G_IO_ERROR_NOT_MOUNTED:
-                       detail_message = g_strdup (_("Unable to access the requested location."));
-                       break;
-               case G_IO_ERROR_PERMISSION_DENIED:
-                       detail_message = g_strdup (_("Don't have permission to access the requested 
location."));
-                       break;
-               case G_IO_ERROR_HOST_NOT_FOUND:
-                       /* This case can be hit for user-typed strings like "foo" due to
-                        * the code that guesses web addresses when there's no initial "/".
-                        * But this case is also hit for legitimate web addresses when
-                        * the proxy is set up wrong.
-                        */
-                       detail_message = g_strdup (_("Unable to find the requested location. Please check the 
spelling or the network settings."));
-                       break;
-               case G_IO_ERROR_CANCELLED:
-               case G_IO_ERROR_FAILED_HANDLED:
-                       goto done;
-               default:
-                       break;
-               }
-       }
-
-       if (detail_message == NULL) {
-               detail_message = g_strdup_printf (_("Unhandled error message: %s"), error->message);
-       }
-
-       eel_show_error_dialog (error_message, detail_message, GTK_WINDOW (window));
- done:
-       g_free (error_message);
-       g_free (detail_message);
-}
-
-void
 nautilus_window_slot_set_content_view (NautilusWindowSlot *slot,
                                       const char *id)
 {
@@ -1685,7 +1543,7 @@ nautilus_window_slot_set_content_view (NautilusWindowSlot *slot,
 
        slot->details->location_change_type = NAUTILUS_LOCATION_CHANGE_RELOAD;
 
-        if (!setup_view (slot, NAUTILUS_VIEW (view), NULL)) {
+        if (!setup_view (slot, NAUTILUS_VIEW (view))) {
                /* Just load the homedir. */
                nautilus_window_slot_go_home (slot, FALSE);
        }
@@ -1722,7 +1580,7 @@ nautilus_window_back_or_forward (NautilusWindow *window,
        location = nautilus_bookmark_get_location (bookmark);
 
        if (flags != 0) {
-               nautilus_window_slot_open_location (slot, location, flags);
+               nautilus_window_slot_open_location_full (slot, location, flags, NULL);
        } else {
                char *scroll_pos;
 
@@ -1733,8 +1591,7 @@ nautilus_window_back_or_forward (NautilusWindow *window,
                         location, old_location, NULL,
                         back ? NAUTILUS_LOCATION_CHANGE_BACK : NAUTILUS_LOCATION_CHANGE_FORWARD,
                         distance,
-                        scroll_pos,
-                        NULL, NULL);
+                        scroll_pos);
 
                g_free (scroll_pos);
        }
@@ -1772,8 +1629,7 @@ nautilus_window_slot_force_reload (NautilusWindowSlot *slot)
        }
        begin_location_change
                (slot, location, location, selection,
-                NAUTILUS_LOCATION_CHANGE_RELOAD, 0, current_pos,
-                NULL, NULL);
+                NAUTILUS_LOCATION_CHANGE_RELOAD, 0, current_pos);
         g_free (current_pos);
        g_object_unref (location);
        g_list_free_full (selection, g_object_unref);
@@ -2152,6 +2008,8 @@ view_started_loading (NautilusWindowSlot *slot,
         gtk_widget_grab_focus (GTK_WIDGET (slot->details->window));
 
         gtk_widget_show (GTK_WIDGET (slot->details->window));
+
+        nautilus_window_slot_set_loading (slot, TRUE);
 }
 
 static void
@@ -2172,6 +2030,8 @@ view_ended_loading (NautilusWindowSlot *slot,
         }
 
         nautilus_window_slot_set_allow_stop (slot, FALSE);
+
+        nautilus_window_slot_set_loading (slot, FALSE);
 }
 
 static void
@@ -2466,6 +2326,7 @@ nautilus_window_slot_class_init (NautilusWindowSlotClass *klass)
                              NULL, NULL,
                              g_cclosure_marshal_VOID__VOID,
                              G_TYPE_NONE, 0);
+
        signals[LOCATION_CHANGED] =
                g_signal_new ("location-changed",
                              G_TYPE_FROM_CLASS (klass),
@@ -2483,6 +2344,12 @@ nautilus_window_slot_class_init (NautilusWindowSlotClass *klass)
                                       "Whether the slot is the active slot of the window",
                                       FALSE,
                                       G_PARAM_READWRITE);
+        properties[PROP_LOADING] =
+                g_param_spec_boolean ("loading",
+                                      "Whether the slot loading",
+                                      "Whether the slot is loading a new location",
+                                      FALSE,
+                                      G_PARAM_READABLE);
 
        properties[PROP_WINDOW] =
                g_param_spec_object ("window",
@@ -2554,12 +2421,6 @@ 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.
@@ -2624,20 +2485,6 @@ nautilus_window_slot_stop_loading (NautilusWindowSlot *slot)
         cancel_location_change (slot);
 }
 
-/* returns either the pending or the actual current uri */
-char *
-nautilus_window_slot_get_current_uri (NautilusWindowSlot *slot)
-{
-       GFile *location;
-
-       location = nautilus_window_slot_get_current_location (slot);
-       if (location != NULL) {
-               return g_file_get_uri (location);
-       }
-
-       return NULL;
-}
-
 NautilusView*
 nautilus_window_slot_get_current_view (NautilusWindowSlot *slot)
 {
@@ -2650,44 +2497,6 @@ nautilus_window_slot_get_current_view (NautilusWindowSlot *slot)
        return NULL;
 }
 
-void
-nautilus_window_slot_go_home (NautilusWindowSlot *slot,
-                             NautilusWindowOpenFlags flags)
-{                            
-       GFile *home;
-
-       g_return_if_fail (NAUTILUS_IS_WINDOW_SLOT (slot));
-
-       home = g_file_new_for_path (g_get_home_dir ());
-       nautilus_window_slot_open_location (slot, home, flags);
-       g_object_unref (home);
-}
-
-void
-nautilus_window_slot_go_up (NautilusWindowSlot *slot,
-                           NautilusWindowOpenFlags flags)
-{
-       GFile *parent;
-
-       if (slot->details->location == NULL) {
-               return;
-       }
-
-       parent = g_file_get_parent (slot->details->location);
-       if (parent == NULL) {
-               return;
-       }
-
-       nautilus_window_slot_open_location (slot, parent, flags);
-       g_object_unref (parent);
-}
-
-NautilusFile *
-nautilus_window_slot_get_file (NautilusWindowSlot *slot)
-{
-       return slot->details->viewed_file;
-}
-
 NautilusBookmark *
 nautilus_window_slot_get_bookmark (NautilusWindowSlot *slot)
 {
@@ -2764,3 +2573,22 @@ nautilus_window_slot_set_active (NautilusWindowSlot *slot,
                 g_object_notify_by_pspec (G_OBJECT (slot), properties[PROP_ACTIVE]);
         }
 }
+
+static void
+nautilus_window_slot_set_loading (NautilusWindowSlot *slot,
+                                  gboolean            loading)
+{
+        g_return_if_fail (NAUTILUS_IS_WINDOW_SLOT (slot));
+
+        slot->details->loading = loading;
+
+        g_object_notify_by_pspec (G_OBJECT (slot), properties[PROP_LOADING]);
+}
+
+gboolean
+nautilus_window_slot_get_loading (NautilusWindowSlot *slot)
+{
+        g_return_val_if_fail (NAUTILUS_IS_WINDOW_SLOT (slot), FALSE);
+
+        return slot->details->loading;
+}
diff --git a/src/nautilus-window-slot.h b/src/nautilus-window-slot.h
index 238d926..14fa425 100644
--- a/src/nautilus-window-slot.h
+++ b/src/nautilus-window-slot.h
@@ -72,31 +72,17 @@ NautilusWindow * nautilus_window_slot_get_window           (NautilusWindowSlot *
 void             nautilus_window_slot_set_window           (NautilusWindowSlot *slot,
                                                            NautilusWindow     *window);
 
-/* 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);
+void nautilus_window_slot_open_location_full              (NautilusWindowSlot      *slot,
+                                                           GFile                   *location,
+                                                           NautilusWindowOpenFlags  flags,
+                                                           GList                   *new_selection);
 
 GFile * nautilus_window_slot_get_location                 (NautilusWindowSlot *slot);
-char *  nautilus_window_slot_get_location_uri             (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);
-
-NautilusView*  nautilus_window_slot_get_current_view       (NautilusWindowSlot *slot);
-char *         nautilus_window_slot_get_current_uri        (NautilusWindowSlot *slot);
 
 GList * nautilus_window_slot_get_back_history              (NautilusWindowSlot *slot);
 GList * nautilus_window_slot_get_forward_history           (NautilusWindowSlot *slot);
-void    nautilus_window_slot_set_search_visible            (NautilusWindowSlot *slot,
-                                                           gboolean            visible);
 
 gboolean nautilus_window_slot_get_allow_stop               (NautilusWindowSlot *slot);
 void     nautilus_window_slot_set_allow_stop              (NautilusWindowSlot *slot,
@@ -111,16 +97,6 @@ gboolean nautilus_window_slot_handle_event             (NautilusWindowSlot *slot,
 
 void    nautilus_window_slot_queue_reload                 (NautilusWindowSlot *slot);
 
-void    nautilus_window_slot_go_home                      (NautilusWindowSlot *slot,
-                                                           NautilusWindowOpenFlags flags);
-void    nautilus_window_slot_go_up                         (NautilusWindowSlot *slot,
-                                                           NautilusWindowOpenFlags flags);
-
-void nautilus_window_slot_display_view_selection_failure   (NautilusWindow *window,
-                                                            NautilusFile   *file,
-                                                            GFile          *location,
-                                                            GError         *error);
-
 GIcon*   nautilus_window_slot_get_icon                     (NautilusWindowSlot *slot);
 
 GtkWidget* nautilus_window_slot_get_view_widget            (NautilusWindowSlot *slot);
@@ -129,5 +105,9 @@ gboolean nautilus_window_slot_get_active                   (NautilusWindowSlot *
 
 void     nautilus_window_slot_set_active                   (NautilusWindowSlot *slot,
                                                             gboolean            active);
+gboolean nautilus_window_slot_get_loading                  (NautilusWindowSlot *slot);
+
+/* Only used by slot-dnd */
+NautilusView*  nautilus_window_slot_get_current_view       (NautilusWindowSlot *slot);
 
 #endif /* NAUTILUS_WINDOW_SLOT_H */
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 50db396..23df900 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -82,6 +82,7 @@ static void mouse_forward_button_changed           (gpointer                  callbac
 static void use_extra_mouse_buttons_changed          (gpointer                  callback_data);
 static void nautilus_window_initialize_actions              (NautilusWindow *window);
 static GtkWidget * nautilus_window_ensure_location_entry (NautilusWindow *window);
+static void nautilus_window_report_location_change (NautilusWindow *window);
 
 /* Sanity check: highest mouse button value I could find was 14. 5 is our 
  * lower threshold (well-documented to be the one of the button events for the 
@@ -198,13 +199,14 @@ action_go_home (GSimpleAction *action,
                gpointer       user_data)
 {
        NautilusWindow *window;
-       NautilusWindowSlot *slot;
+        GFile *home;
 
        window = NAUTILUS_WINDOW (user_data);
-       slot = nautilus_window_get_active_slot (window);
+        home = g_file_new_for_path (g_get_home_dir ());
 
-       nautilus_window_slot_go_home (slot,
-                                     nautilus_event_get_window_open_flags ());
+        nautilus_window_open_location_full (window, home, nautilus_event_get_window_open_flags (), NULL, 
NULL);
+
+        g_object_unref (home);
 }
 
 static void
@@ -246,7 +248,10 @@ action_up (GSimpleAction *action,
        if (location != NULL) {
                parent = g_file_get_parent (location);
                if (parent != NULL)
-                       nautilus_window_slot_go_up (slot, nautilus_event_get_window_open_flags ());
+                        nautilus_window_open_location_full (NAUTILUS_WINDOW (user_data),
+                                                            parent,
+                                                            nautilus_event_get_window_open_flags (),
+                                                            NULL, NULL);
 
                g_clear_object (&parent);
        }
@@ -470,13 +475,59 @@ undo_manager_changed (NautilusWindow *window)
        g_free (redo_description);
 }
 
+static void
+on_location_changed (NautilusWindow *window)
+{
+
+        nautilus_window_report_location_change (window);
+        gtk_places_sidebar_set_location (GTK_PLACES_SIDEBAR (window->priv->places_sidebar),
+                                         nautilus_window_slot_get_location (nautilus_window_get_active_slot 
(window)));
+}
+
+static void
+on_slot_loading_changed (NautilusWindowSlot *slot,
+                         GParamSpec         *pspec,
+                         NautilusWindow     *window)
+{
+        if (nautilus_window_get_active_slot (window) == slot)
+                on_location_changed (window);
+}
+
 void
-nautilus_window_go_to (NautilusWindow *window, GFile *location)
+nautilus_window_open_location_full (NautilusWindow          *window,
+                                    GFile                   *location,
+                                    NautilusWindowOpenFlags  flags,
+                                    GList                   *selection,
+                                    NautilusWindowSlot      *target_slot)
 {
-       g_return_if_fail (NAUTILUS_IS_WINDOW (window));
+        NautilusWindowSlot *active_slot;
+        gboolean new_tab_at_end;
+
+        active_slot = nautilus_window_get_active_slot (window);
 
-       nautilus_window_slot_open_location (nautilus_window_get_active_slot (window),
-                                           location, 0);
+        /* Assert that we are not managing new windows */
+        g_assert (! (flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW));
+       /* if the flags say we want a new tab, open a slot in the current window */
+       if ((flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB) != 0) {
+                new_tab_at_end = g_settings_get_enum (nautilus_preferences, 
NAUTILUS_PREFERENCES_NEW_TAB_POSITION) == NAUTILUS_NEW_TAB_POSITION_END;
+                if (new_tab_at_end)
+               flags |= NAUTILUS_WINDOW_OPEN_SLOT_APPEND;
+
+               target_slot = nautilus_window_open_slot (window, flags);
+       }
+
+       if (target_slot == NULL) {
+               target_slot = active_slot;
+       }
+
+        /* Make the opened location the one active if we weren't ask for the
+         * oposite, since it's the most usual use case */
+        if (!(flags & NAUTILUS_WINDOW_OPEN_FLAG_DONT_MAKE_ACTIVE)) {
+                gtk_window_present (GTK_WINDOW (window));
+                nautilus_window_set_active_slot (window, target_slot);
+        }
+
+       nautilus_window_slot_open_location_full (target_slot, location, flags, selection);
 }
 
 static int
@@ -569,7 +620,7 @@ location_entry_location_changed_callback (GtkWidget      *widget,
 
        restore_focus_widget (window);
 
-       nautilus_window_slot_open_location (window->priv->active_slot, location, 0);
+       nautilus_window_open_location_full (window, location, 0, NULL, NULL);
 }
 
 static void
@@ -593,6 +644,21 @@ notebook_switch_page_cb (GtkNotebook    *notebook,
 }
 
 static void
+connect_slot (NautilusWindow     *window,
+              NautilusWindowSlot *slot)
+{
+        g_signal_connect (slot, "notify::loading",
+                          G_CALLBACK (on_slot_loading_changed), window);
+}
+
+static void
+disconnect_slot (NautilusWindow     *window,
+                 NautilusWindowSlot *slot)
+{
+        g_signal_handlers_disconnect_by_data (slot, window);
+}
+
+static void
 close_slot (NautilusWindow     *window,
            NautilusWindowSlot *slot,
            gboolean            remove_from_notebook)
@@ -604,6 +670,8 @@ close_slot (NautilusWindow     *window,
 
        DEBUG ("Closing slot %p", slot);
 
+        disconnect_slot (window, slot);
+
        window->priv->slots = g_list_remove (window->priv->slots, slot);
 
        g_signal_emit (window, signals[SLOT_REMOVED], 0, slot);
@@ -621,13 +689,14 @@ close_slot (NautilusWindow     *window,
 
 NautilusWindowSlot *
 nautilus_window_open_slot (NautilusWindow             *window,
-                          NautilusWindowOpenSlotFlags flags)
+                          NautilusWindowOpenFlags flags)
 {
        NautilusWindowSlot *slot;
 
        g_assert (NAUTILUS_IS_WINDOW (window));
 
        slot = nautilus_window_slot_new (window);
+        connect_slot (window, slot);
 
        g_signal_handlers_block_by_func (window->priv->notebook,
                                         G_CALLBACK (notebook_switch_page_cb),
@@ -652,22 +721,15 @@ void
 nautilus_window_new_tab (NautilusWindow *window)
 {
        NautilusWindowSlot *current_slot;
-       NautilusWindowSlot *new_slot;
        NautilusWindowOpenFlags flags;
        GFile *location;
-       int new_slot_position;
        char *scheme;
 
        current_slot = nautilus_window_get_active_slot (window);
        location = nautilus_window_slot_get_location (current_slot);
 
        if (location != NULL) {
-               flags = 0;
-
-               new_slot_position = g_settings_get_enum (nautilus_preferences, 
NAUTILUS_PREFERENCES_NEW_TAB_POSITION);
-               if (new_slot_position == NAUTILUS_NEW_TAB_POSITION_END) {
-                       flags = NAUTILUS_WINDOW_OPEN_SLOT_APPEND;
-               }
+               flags = g_settings_get_enum (nautilus_preferences, NAUTILUS_PREFERENCES_NEW_TAB_POSITION);
 
                scheme = g_file_get_uri_scheme (location);
                if (strcmp (scheme, "x-nautilus-search") == 0) {
@@ -678,9 +740,8 @@ nautilus_window_new_tab (NautilusWindow *window)
 
                g_free (scheme);
 
-               new_slot = nautilus_window_open_slot (window, flags);
-               nautilus_window_set_active_slot (window, new_slot);
-               nautilus_window_slot_open_location (new_slot, location, 0);
+                flags |= NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB;
+               nautilus_window_open_location_full (window, location, flags, NULL, NULL);
                g_object_unref (location);
        }
 }
@@ -845,34 +906,6 @@ setup_side_pane_width (NautilusWindow *window)
                                window->priv->side_pane_width);
 }
 
-static void
-nautilus_window_location_opened (NautilusWindow *window,
-                                 GFile          *location,
-                                 GError         *error,
-                                 gpointer        user_data)
-{
-       g_return_if_fail (NAUTILUS_IS_WINDOW (window));
-
-       if (error) {
-               NautilusFile *old_file;
-               GFile *old_location;
-
-               old_file = nautilus_window_slot_get_file (window->priv->active_slot);
-               old_location = nautilus_file_get_location (old_file);
-
-               gtk_places_sidebar_set_location (GTK_PLACES_SIDEBAR (window->priv->places_sidebar), 
old_location);
-
-               g_warning ("error opening location: %s", error->message);
-
-               nautilus_window_slot_display_view_selection_failure (window,
-                                                                     old_file,
-                                                                     location,
-                                                                     error);
-
-               g_object_unref (old_location);
-       }
-}
-
 /* Callback used when the places sidebar changes location; we need to change the displayed folder */
 static void
 open_location_cb (NautilusWindow     *window,
@@ -896,12 +929,8 @@ open_location_cb (NautilusWindow     *window,
                break;
        }
 
-       nautilus_window_slot_open_location_full (window->priv->active_slot,
-                                                 location,
-                                                 flags,
-                                                 NULL,
-                                                 (NautilusWindowGoToCallback) 
nautilus_window_location_opened,
-                                                 NULL);
+        nautilus_application_open_location_full (NAUTILUS_APPLICATION (g_application_get_default ()),
+                                                 location, flags, NULL, NULL, NULL);
 }
 
 /* Callback used when the places sidebar needs us to present an error message */
@@ -1023,21 +1052,6 @@ places_sidebar_drag_perform_drop_cb (GtkPlacesSidebar *sidebar,
        g_list_free_full (source_uri_list, g_free);
 }
 
-/* Callback for our own loading_uri signal.  We update the sidebar's path. */
-static void
-window_loading_uri_cb (NautilusWindow *window,
-                      char           *location,
-                      gpointer        user_data)
-{
-       if (window->priv->places_sidebar) {
-               GFile *file;
-
-               file = g_file_new_for_uri (location);
-               gtk_places_sidebar_set_location (GTK_PLACES_SIDEBAR (window->priv->places_sidebar), file);
-               g_object_unref (file);
-       }
-}
-
 /* Callback used in the "empty trash" menu item from the places sidebar */
 static void
 action_empty_trash (GSimpleAction *action,
@@ -1226,9 +1240,6 @@ nautilus_window_set_up_sidebar (NautilusWindow *window)
                          G_CALLBACK (places_sidebar_drag_perform_drop_cb), window);
        g_signal_connect (window->priv->places_sidebar, "populate-popup",
                          G_CALLBACK (places_sidebar_populate_popup_cb), window);
-
-       g_signal_connect (window, "loading-uri",
-                         G_CALLBACK (window_loading_uri_cb), window);
 }
 
 void
@@ -1502,9 +1513,8 @@ static void
 on_notification_operation_open_clicked (GtkWidget      *notification,
                                         NautilusWindow *window)
 {
-        nautilus_window_slot_open_location (window->priv->active_slot,
-                                            window->priv->folder_to_open,
-                                            0);
+        nautilus_window_open_location_full (window, window->priv->folder_to_open,
+                                            0, NULL, NULL);
         hide_notification_operation (window);
 }
 
@@ -1576,7 +1586,7 @@ path_bar_location_changed_callback (GtkWidget      *widget,
        if (i >= 0) {
                nautilus_window_back_or_forward (window, TRUE, i, 0);
        } else {
-               nautilus_window_slot_open_location (slot, location, 0);
+                nautilus_window_open_location_full (window, location, 0, NULL, NULL);
        }
 }
 
@@ -2164,12 +2174,15 @@ static void
 nautilus_window_report_location_change (NautilusWindow *window)
 {
        NautilusWindowSlot *slot;
+        GFile *location;
        gchar *uri;
 
        slot = nautilus_window_get_active_slot (window);
-       uri = nautilus_window_slot_get_current_uri (slot);
+       location = nautilus_window_slot_get_location (slot);
 
-       if (uri != NULL) {
+        /* location can be null on creating for first time the slot */
+       if (location != NULL) {
+                uri = g_file_get_uri (location);
                g_signal_emit (window, signals[LOADING_URI], 0, uri);
                g_free (uri);
        }
@@ -2182,8 +2195,6 @@ nautilus_window_set_active_slot (NautilusWindow *window, NautilusWindowSlot *new
 
        g_assert (NAUTILUS_IS_WINDOW (window));
 
-       DEBUG ("Setting new slot %p as active", new_slot);
-
        if (new_slot) {
                g_assert ((window == nautilus_window_slot_get_window (new_slot)));
        }
@@ -2194,6 +2205,8 @@ nautilus_window_set_active_slot (NautilusWindow *window, NautilusWindowSlot *new
                return;
        }
 
+       DEBUG ("Setting new slot %p as active, old slot inactive %p", new_slot, old_slot);
+
        /* make old slot inactive if it exists (may be NULL after init, for example) */
        if (old_slot != NULL) {
                /* inform slot & view */
@@ -2204,13 +2217,12 @@ 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);
-
                 nautilus_toolbar_set_active_slot (NAUTILUS_TOOLBAR (window->priv->toolbar), new_slot);
 
                /* inform slot & view */
                 nautilus_window_slot_set_active (new_slot, TRUE);
+
+                on_location_changed (window);
        }
 }
 
diff --git a/src/nautilus-window.h b/src/nautilus-window.h
index 2bffe05..4caa55d 100644
--- a/src/nautilus-window.h
+++ b/src/nautilus-window.h
@@ -41,14 +41,11 @@ typedef enum {
         NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND = 1 << 0,
         NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW = 1 << 1,
         NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB = 1 << 2,
-        NAUTILUS_WINDOW_OPEN_FLAG_USE_DEFAULT_LOCATION = 1 << 3
+        NAUTILUS_WINDOW_OPEN_SLOT_APPEND = 1 << 3,
+        NAUTILUS_WINDOW_OPEN_FLAG_USE_DEFAULT_LOCATION = 1 << 4,
+        NAUTILUS_WINDOW_OPEN_FLAG_DONT_MAKE_ACTIVE = 1 << 5
 } NautilusWindowOpenFlags;
 
-typedef enum {
-       NAUTILUS_WINDOW_OPEN_SLOT_NONE = 0,
-       NAUTILUS_WINDOW_OPEN_SLOT_APPEND = 1
-}  NautilusWindowOpenSlotFlags;
-
 typedef gboolean (* NautilusWindowGoToCallback) (NautilusWindow *window,
                                                  GFile *location,
                                                  GError *error,
@@ -105,16 +102,19 @@ GType            nautilus_window_get_type             (void);
 NautilusWindow * nautilus_window_new                  (GdkScreen         *screen);
 void             nautilus_window_close                (NautilusWindow    *window);
 
+void nautilus_window_open_location_full               (NautilusWindow          *window,
+                                                       GFile                   *location,
+                                                       NautilusWindowOpenFlags  flags,
+                                                       GList                   *selection,
+                                                       NautilusWindowSlot      *target_slot);
 
-void             nautilus_window_go_to                (NautilusWindow    *window,
-                                                       GFile             *location);
 void             nautilus_window_new_tab              (NautilusWindow    *window);
 NautilusWindowSlot * nautilus_window_get_active_slot       (NautilusWindow *window);
 void                 nautilus_window_set_active_slot       (NautilusWindow    *window,
                                                             NautilusWindowSlot *slot);
 GList *              nautilus_window_get_slots             (NautilusWindow *window);
 NautilusWindowSlot * nautilus_window_open_slot             (NautilusWindow *window,
-                                                            NautilusWindowOpenSlotFlags flags);
+                                                            NautilusWindowOpenFlags flags);
 void                 nautilus_window_slot_close            (NautilusWindow *window,
                                                             NautilusWindowSlot *slot);
 


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