summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2022-02-11 14:28:56 +0100
committerAntónio Fernandes <antoniof@gnome.org>2022-02-11 19:24:09 +0000
commit7cd29ca006e7438491d528224250d8d7b22c511e (patch)
tree9b1e64515bcd72b871905021ef58b190a8cefbf4
parentb3d750533160795cf779ba7f0e13e57117e16424 (diff)
downloadnautilus-7cd29ca006e7438491d528224250d8d7b22c511e.tar.gz
Revert "global-preferences: Remove now-unused preferences"
This reverts commit 0a1f78a77225a6838e507aebc5ce878a8d44d2de.
-rw-r--r--data/org.gnome.nautilus.gschema.xml10
-rw-r--r--src/nautilus-dnd.c7
-rw-r--r--src/nautilus-files-view.c12
-rw-r--r--src/nautilus-global-preferences.h6
-rw-r--r--src/nautilus-types.h2
-rw-r--r--src/nautilus-window-slot.c21
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 abef9b002..7b7a1ba2b 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 0e2094bd4..5fff557eb 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -9801,12 +9801,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 25b582610..bde3337dc 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -1092,6 +1092,24 @@ recursive_search_preferences_changed (GSettings *settings,
}
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)
{
GApplication *app;
@@ -1107,6 +1125,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",