[nautilus] dnd: add setting for opening on hover on dnd



commit 2338a9239496b8204d302388649c2b45a57c38e9
Author: Carlos Soriano <csoriano gnome org>
Date:   Wed Sep 2 14:34:31 2015 +0200

    dnd: add setting for opening on hover on dnd
    
    In previous commits we removed opening automatically a folder
    when performing a dnd operation and hovering it, since it
    is rather difficult to control. Increasing the timeout doesn't
    fix the problem, since we can't know how much a person needs to
    control its mouse or see the files in the current folder.
    Basically it performs an action even if the user is still, which
    is a problem.
    
    But seems some users were used to it, so instead of removing it
    altogether add a gsetting key to allow its use.
    The key will be set as false by default to avoid making the experience
    difficult out of the box.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=754454

 libnautilus-private/nautilus-global-preferences.h  |    3 +++
 .../org.gnome.nautilus.gschema.xml.in              |    5 +++++
 src/nautilus-files-view-dnd.c                      |    8 +++++++-
 3 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/libnautilus-private/nautilus-global-preferences.h 
b/libnautilus-private/nautilus-global-preferences.h
index d320475..ffe1b76 100644
--- a/libnautilus-private/nautilus-global-preferences.h
+++ b/libnautilus-private/nautilus-global-preferences.h
@@ -50,6 +50,9 @@ typedef enum
 /* Single/Double click preference  */
 #define NAUTILUS_PREFERENCES_CLICK_POLICY                      "click-policy"
 
+/* Drag and drop preferences */
+#define NAUTILUS_PREFERENCES_OPEN_FOLDER_ON_DND_HOVER          "open-folder-on-dnd-hover"
+
 /* Activating executable text files */
 #define NAUTILUS_PREFERENCES_EXECUTABLE_TEXT_ACTIVATION                "executable-text-activation"
 
diff --git a/libnautilus-private/org.gnome.nautilus.gschema.xml.in 
b/libnautilus-private/org.gnome.nautilus.gschema.xml.in
index ca5811e..589977d 100644
--- a/libnautilus-private/org.gnome.nautilus.gschema.xml.in
+++ b/libnautilus-private/org.gnome.nautilus.gschema.xml.in
@@ -176,6 +176,11 @@
       <_summary>Bulk rename utility</_summary>
       <_description>If set, Nautilus will append URIs of selected files and treat the result as a command 
line for bulk renaming. Bulk rename applications can register themselves in this key by setting the key to a 
space-separated string of their executable name and any command line options. If the executable name is not 
set to a full path, it will be searched for in the search path.</_description>
     </key>
+    <key name="open-folder-on-dnd-hover" type="b">
+      <default>false</default>
+      <_summary>Whether to open the hovered folder after a timeout when drag and drop operation</_summary>
+      <_description>If this is set to true, when performing a drag and drop operation the hovered folder 
will open automatically after a timeout</_description>
+    </key>
   </schema>
 
   <schema id="org.gnome.nautilus.icon-view" path="/org/gnome/nautilus/icon-view/" gettext-domain="nautilus">
diff --git a/src/nautilus-files-view-dnd.c b/src/nautilus-files-view-dnd.c
index 6ce84be..1807318 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-global-preferences.h"
 #include "nautilus-application.h"
 
 #include <eel/eel-stock-dialogs.h>
@@ -533,6 +534,7 @@ nautilus_files_view_handle_hover (NautilusFilesView *view,
         GFile *current_location;
         NautilusFile *target_file;
         gboolean target_is_dir;
+        gboolean open_folder_on_hover;
 
         slot = nautilus_files_view_get_nautilus_window_slot (view);
 
@@ -540,7 +542,11 @@ nautilus_files_view_handle_hover (NautilusFilesView *view,
         target_file = nautilus_file_get_existing (location);
         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))) {
+        open_folder_on_hover = g_settings_get_boolean (nautilus_preferences,
+                                                       NAUTILUS_PREFERENCES_OPEN_FOLDER_ON_DND_HOVER);
+
+        if (target_is_dir && open_folder_on_hover &&
+            !(current_location != NULL && g_file_equal(location, current_location))) {
                 nautilus_application_open_location_full (NAUTILUS_APPLICATION (g_application_get_default ()),
                                                          location, 
NAUTILUS_WINDOW_OPEN_FLAG_DONT_MAKE_ACTIVE,
                                                          NULL, NULL, slot);


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