[nautilus/wip/oholy/gnome-42: 25/41] Revert "global-preferences: Remove now-unused preferences"




commit a7c2b9a1b408125e2b7d546365e4d9f62d5d1674
Author: Ondrej Holy <oholy redhat com>
Date:   Fri Feb 11 14:28:56 2022 +0100

    Revert "global-preferences: Remove now-unused preferences"
    
    This reverts commit 0a1f78a77225a6838e507aebc5ce878a8d44d2de.

 data/org.gnome.nautilus.gschema.xml | 10 ++++++++++
 src/nautilus-dnd.c                  |  7 ++++++-
 src/nautilus-files-view.c           | 12 +++++++++++-
 src/nautilus-global-preferences.h   |  6 ++++++
 src/nautilus-types.h                |  2 ++
 src/nautilus-window-slot.c          | 21 +++++++++++++++++++++
 6 files changed, 56 insertions(+), 2 deletions(-)
---
diff --git a/data/org.gnome.nautilus.gschema.xml b/data/org.gnome.nautilus.gschema.xml
index 90f63c488..aa4306aea 100644
--- a/data/org.gnome.nautilus.gschema.xml
+++ b/data/org.gnome.nautilus.gschema.xml
@@ -193,6 +193,11 @@
       <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>
+    <key type="b" name="use-experimental-views">
+      <default>false</default>
+      <summary>Enable new experimental views</summary>
+      <description>Whether to use the new experimental views using the latest GTK+ widgets to help giving 
feedback and shaping their future.</description>
+    </key>
     <key type="b" name="fts-enabled">
       <default>true</default>
       <summary>Whether to have full text search enabled by default when opening a new window/tab</summary>
@@ -218,6 +223,11 @@
       <default>'large'</default>
       <summary>Default icon view zoom level</summary>
     </key>
+    <key type="as" name="text-ellipsis-limit">
+      <default>[ '3' ]</default>
+      <summary>Text Ellipsis Limit</summary>
+      <description>A string specifying how parts of overlong file names should be replaced by ellipses, 
depending on the zoom level. Each of the list entries is of the form “Zoom Level:Integer”. For each specified 
zoom level, if the given integer is larger than 0, the file name will not exceed the given number of lines. 
If the integer is 0 or smaller, no limit is imposed on the specified zoom level. A default entry of the form 
“Integer” without any specified zoom level is also allowed. It defines the maximum number of lines for all 
other zoom levels. Examples: 0 — always display overlong file names; 3 — shorten file names if they exceed 
three lines; smallest:5,smaller:4,0 — shorten file names if they exceed five lines for zoom level “smallest”. 
Shorten file names if they exceed four lines for zoom level “smaller”. Do not shorten file names for other 
zoom levels. Available zoom levels: small, standard, large.</description>
+    </key>
   </schema>
 
   <schema path="/org/gnome/nautilus/list-view/" id="org.gnome.nautilus.list-view" gettext-domain="nautilus">
diff --git a/src/nautilus-dnd.c b/src/nautilus-dnd.c
index daa785a12..769f224ef 100644
--- a/src/nautilus-dnd.c
+++ b/src/nautilus-dnd.c
@@ -406,7 +406,12 @@ nautilus_drag_get_source_data (GdkDragContext *context)
         return NULL;
     }
 
-    if (GTK_IS_TREE_VIEW (source_widget))
+    if (NAUTILUS_IS_CANVAS_CONTAINER (source_widget))
+    {
+        source_data = nautilus_canvas_dnd_get_drag_source_data (NAUTILUS_CANVAS_CONTAINER (source_widget),
+                                                                context);
+    }
+    else if (GTK_IS_TREE_VIEW (source_widget))
     {
         NautilusWindow *window;
         NautilusWindowSlot *active_slot;
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 90212a454..b62089cd0 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -9753,12 +9753,22 @@ nautilus_files_view_new (guint               id,
                          NautilusWindowSlot *slot)
 {
     NautilusFilesView *view = NULL;
+    gboolean use_experimental_views;
 
+    use_experimental_views = g_settings_get_boolean (nautilus_preferences,
+                                                     NAUTILUS_PREFERENCES_USE_EXPERIMENTAL_VIEWS);
     switch (id)
     {
         case NAUTILUS_VIEW_GRID_ID:
         {
-            view = NAUTILUS_FILES_VIEW (nautilus_view_icon_controller_new (slot));
+            if (use_experimental_views)
+            {
+                view = NAUTILUS_FILES_VIEW (nautilus_view_icon_controller_new (slot));
+            }
+            else
+            {
+                view = nautilus_canvas_view_new (slot);
+            }
         }
         break;
 
diff --git a/src/nautilus-global-preferences.h b/src/nautilus-global-preferences.h
index e7b158001..6f098b6b8 100644
--- a/src/nautilus-global-preferences.h
+++ b/src/nautilus-global-preferences.h
@@ -84,9 +84,15 @@ typedef enum
 /* Icon View */
 #define NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL              "default-zoom-level"
 
+/* Experimental views */
+#define NAUTILUS_PREFERENCES_USE_EXPERIMENTAL_VIEWS "use-experimental-views"
+
 /* Which text attributes appear beneath icon names */
 #define NAUTILUS_PREFERENCES_ICON_VIEW_CAPTIONS                                "captions"
 
+/* ellipsization preferences */
+#define NAUTILUS_PREFERENCES_ICON_VIEW_TEXT_ELLIPSIS_LIMIT             "text-ellipsis-limit"
+
 /* List View */
 #define NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL              "default-zoom-level"
 #define NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_VISIBLE_COLUMNS         "default-visible-columns"
diff --git a/src/nautilus-types.h b/src/nautilus-types.h
index d980c5052..3c2979a67 100644
--- a/src/nautilus-types.h
+++ b/src/nautilus-types.h
@@ -32,6 +32,8 @@
 
 typedef struct _NautilusBookmark            NautilusBookmark;
 typedef struct _NautilusBookmarkList        NautilusBookmarkList;
+typedef struct _NautilusCanvasContainer     NautilusCanvasContainer;
+typedef struct _NautilusCanvasView          NautilusCanvasView;
 typedef struct _NautilusDirectory           NautilusDirectory;
 typedef struct  NautilusFile                NautilusFile;
 typedef struct  NautilusFileQueue           NautilusFileQueue;
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 16ae23a4a..4e7e6f471 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -1090,6 +1090,24 @@ recursive_search_preferences_changed (GSettings *settings,
     update_search_information (self);
 }
 
+static void
+use_experimental_views_changed_callback (GSettings *settings,
+                                         gchar     *key,
+                                         gpointer   callback_data)
+{
+    NautilusWindowSlot *self;
+
+    self = callback_data;
+
+    if (nautilus_window_slot_content_view_matches (self, NAUTILUS_VIEW_GRID_ID))
+    {
+        /* Note that although this call does not change the view id,
+         * it changes the canvas view between new and old.
+         */
+        nautilus_window_slot_set_content_view (self, NAUTILUS_VIEW_GRID_ID);
+    }
+}
+
 static void
 nautilus_window_slot_init (NautilusWindowSlot *self)
 {
@@ -1106,6 +1124,9 @@ nautilus_window_slot_init (NautilusWindowSlot *self)
     g_signal_connect (nautilus_trash_monitor_get (),
                       "trash-state-changed",
                       G_CALLBACK (trash_state_changed_cb), self);
+    g_signal_connect_object (nautilus_preferences,
+                             "changed::" NAUTILUS_PREFERENCES_USE_EXPERIMENTAL_VIEWS,
+                             G_CALLBACK (use_experimental_views_changed_callback), self, 0);
 
     g_signal_connect_object (nautilus_preferences,
                              "changed::recursive-search",


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