[nautilus/wip/ernestask/glory-to-arstotzka] general: Kill off NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND



commit 3332de3026846ee6d0cae9bd203f1ec9311d21cc
Author: Ernestas Kulik <ernestask gnome org>
Date:   Tue Oct 30 11:02:30 2018 +0100

    general: Kill off NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND
    
    bb884cb6151a10523276c2888011692877c686a3 changed the accelerator for
    open-file-and-close-window from alt-shift-down to ctrl-shift-down, which
    now conflicts with keyboard rubberbanding in the canvas view.
    Additionally, it’s nothing more than a relict from a more spatial time.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=765526
    
    Fixes https://gitlab.gnome.org/GNOME/nautilus/issues/701

 src/nautilus-application.c  | 31 --------------------
 src/nautilus-enums.h        |  9 +++---
 src/nautilus-files-view.c   | 18 ------------
 src/nautilus-mime-actions.c | 71 ++-------------------------------------------
 4 files changed, 7 insertions(+), 122 deletions(-)
---
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index b0893f344..498f7a147 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -337,20 +337,6 @@ get_window_slot_for_location (NautilusApplication *self,
     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     *self,
                                          GFile                   *location,
@@ -463,23 +449,6 @@ real_open_location_full (NautilusApplication     *self,
 
     g_assert (target_window != NULL);
 
-    /* close the current window if the flags say so */
-    if ((flags & NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND) != 0)
-    {
-        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;
diff --git a/src/nautilus-enums.h b/src/nautilus-enums.h
index 62c268330..edfd99919 100644
--- a/src/nautilus-enums.h
+++ b/src/nautilus-enums.h
@@ -76,9 +76,8 @@ typedef enum
 
 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_SLOT_APPEND           = 1 << 3,
-    NAUTILUS_WINDOW_OPEN_FLAG_DONT_MAKE_ACTIVE = 1 << 4
+    NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW       = 1 << 0,
+    NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB          = 1 << 1,
+    NAUTILUS_WINDOW_OPEN_SLOT_APPEND           = 1 << 2,
+    NAUTILUS_WINDOW_OPEN_FLAG_DONT_MAKE_ACTIVE = 1 << 3,
 } NautilusWindowOpenFlags;
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 1ee21bb24..64e11e2a9 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -1353,22 +1353,6 @@ action_open_with_default_application (GSimpleAction *action,
     view = NAUTILUS_FILES_VIEW (user_data);
     nautilus_files_view_activate_selection (view);
 }
-static void
-action_open_file_and_close_window (GSimpleAction *action,
-                                   GVariant      *state,
-                                   gpointer       user_data)
-{
-    g_autolist (NautilusFile) selection = NULL;
-    NautilusFilesView *view;
-
-    view = NAUTILUS_FILES_VIEW (user_data);
-
-    selection = nautilus_view_get_selection (NAUTILUS_VIEW (view));
-    nautilus_files_view_activate_files (view,
-                                        selection,
-                                        NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND,
-                                        TRUE);
-}
 
 static void
 action_open_item_location (GSimpleAction *action,
@@ -6999,7 +6983,6 @@ const GActionEntry view_entries[] =
     /* Only accesible by shorcuts */
     { "select-pattern", action_select_pattern },
     { "invert-selection", action_invert_selection },
-    { "open-file-and-close-window", action_open_file_and_close_window },
 };
 
 static gboolean
@@ -9762,7 +9745,6 @@ nautilus_files_view_init (NautilusFilesView *view)
     nautilus_application_set_accelerator (app, "view.select-pattern", "<control>s");
     nautilus_application_set_accelerator (app, "view.zoom-standard", "<control>0");
     nautilus_application_set_accelerator (app, "view.invert-selection", "<shift><control>i");
-    nautilus_application_set_accelerator (app, "view.open-file-and-close-window", "<control><shift>Down");
 
     priv->starred_cancellable = g_cancellable_new ();
     priv->tag_manager = nautilus_tag_manager_get ();
diff --git a/src/nautilus-mime-actions.c b/src/nautilus-mime-actions.c
index 252dfea81..e021d0b90 100644
--- a/src/nautilus-mime-actions.c
+++ b/src/nautilus-mime-actions.c
@@ -1416,23 +1416,9 @@ on_launch_default_for_uri (GObject      *source_object,
     }
     else
     {
-        gboolean should_close;
-        NautilusWindow *window;
-
-        should_close = activation_params->flags &
-                       NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND;
-        window = nautilus_window_slot_get_window (activation_params->slot);
-
-        if (should_close && window != NULL)
-        {
-            nautilus_window_close (window);
-        }
-        else
+        while ((uri = g_queue_pop_head (params->unhandled_uris)) != NULL)
         {
-            while ((uri = g_queue_pop_head (params->unhandled_uris)) != NULL)
-            {
-                application_unhandled_uri (activation_params, uri);
-            }
+            application_unhandled_uri (activation_params, uri);
         }
 
         application_launch_parameters_free (params);
@@ -1443,12 +1429,10 @@ static void
 activate_files (ActivateParameters *parameters)
 {
     NautilusFile *file;
-    NautilusWindow *window;
     NautilusWindowOpenFlags flags;
     int count;
     g_autofree char *old_working_dir = NULL;
     GdkScreen *screen;
-    gboolean closed_window;
     g_autoptr (GQueue) launch_files = NULL;
     g_autoptr (GQueue) launch_in_terminal_files = NULL;
     g_autoptr (GQueue) open_in_app_uris = NULL;
@@ -1585,32 +1569,13 @@ activate_files (ActivateParameters *parameters)
     {
         if ((parameters->flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW) == 0)
         {
-            /* if CLOSE_BEHIND is set and we have a directory to be activated, we
-             * will first have to open a new window and after that we can open the
-             * rest of files in tabs */
-            if ((parameters->flags & NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND) != 0)
-            {
-                flags |= NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW;
-            }
-            else
-            {
-                flags |= NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB;
-            }
+            flags |= NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB;
         }
         else
         {
             flags |= NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW;
         }
     }
-    else
-    {
-        /* if we want to close the window and activate a single directory, then we will need
-         * the NEW_WINDOW flag set */
-        if ((parameters->flags & NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND) != 0)
-        {
-            flags |= NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW;
-        }
-    }
 
     if (parameters->slot != NULL &&
         (!parameters->user_confirmation ||
@@ -1629,8 +1594,6 @@ activate_files (ActivateParameters *parameters)
             g_queue_reverse (open_in_view_files);
         }
 
-        closed_window = FALSE;
-
         for (l = g_queue_peek_head_link (open_in_view_files); l != NULL; l = l->next)
         {
             g_autofree char *uri = NULL;
@@ -1661,39 +1624,11 @@ activate_files (ActivateParameters *parameters)
              * to make splicit the window we want to use for activating the files */
             nautilus_application_open_location_full (NAUTILUS_APPLICATION (g_application_get_default ()),
                                                      location_with_permissions, flags, NULL, NULL, 
parameters->slot);
-
-            /* close only the window from which the action was launched and then open
-             * tabs/windows (depending on parameters->flags) */
-            if (!closed_window && (flags & NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND) != 0)
-            {
-                flags &= (~NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND);
-
-                /* if NEW_WINDOW is set, we want all files in new windows, not in tabs */
-                if ((parameters->flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW) == 0)
-                {
-                    flags &= (~NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW);
-                    flags |= NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB;
-                }
-
-                closed_window = TRUE;
-            }
         }
     }
 
     if (g_queue_is_empty (open_in_app_uris))
     {
-        window = NULL;
-        if (parameters->slot != NULL)
-        {
-            window = nautilus_window_slot_get_window (parameters->slot);
-        }
-
-        if ((parameters->flags & NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND) != 0 &&
-            window != NULL)
-        {
-            nautilus_window_close (window);
-        }
-
         activation_parameters_free (parameters);
     }
     else


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