[nautilus/wip/csoriano/destktop-split2: 39/54] f with other locations subclass



commit b31ae7bacd77fcf682dbba427a22d92f6157b62c
Author: Carlos Soriano <csoriano gnome org>
Date:   Thu Mar 24 17:08:04 2016 +0100

    f with other locations subclass

 src/nautilus-window.c |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 1c1ceef..a0aa346 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -592,6 +592,11 @@ nautilus_window_open_location_full (NautilusWindow          *window,
         gboolean new_tab_at_end;
 
         active_slot = nautilus_window_get_active_slot (window);
+        /* The location owner can be one of the slots requesting to handle an
+         * unhandled location. But this slot can be destroyed when switching to
+         * a new slot. So keep the locaiton alive
+         */
+        g_object_ref (location);
 
         /* Assert that we are not managing new windows */
         g_assert (! (flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW));
@@ -605,15 +610,15 @@ nautilus_window_open_location_full (NautilusWindow          *window,
                 nautilus_window_initialize_slot (window, target_slot, flags);
        }
 
-       if (target_slot == NULL) {
-                if (nautilus_window_slot_handles_location (active_slot, location)) {
-                        target_slot = active_slot;
-                } else {
-                        target_slot = nautilus_window_create_slot (window, location);
-                        nautilus_window_initialize_slot (window, target_slot, flags);
-                        close_slot (window, active_slot, TRUE);
-                }
-       }
+        if (!target_slot)
+                target_slot = active_slot;
+
+       if (target_slot == NULL || !nautilus_window_slot_handles_location (active_slot, location)) {
+                target_slot = nautilus_window_create_slot (window, location);
+                nautilus_window_initialize_slot (window, target_slot, flags);
+                if (active_slot)
+                  close_slot (window, active_slot, TRUE);
+        }
 
         /* Make the opened location the one active if we weren't ask for the
          * oposite, since it's the most usual use case */
@@ -623,6 +628,8 @@ nautilus_window_open_location_full (NautilusWindow          *window,
         }
 
        nautilus_window_slot_open_location_full (target_slot, location, flags, selection);
+
+        g_object_unref (location);
 }
 
 static int


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