1 --- caja-1.28.0/src/caja-window-manage-views.c.orig 2024-02-20 01:30:36.000000000 +0100
2 +++ caja-1.28.0/src/caja-window-manage-views.c 2024-02-26 08:42:41.081708726 +0100
6 #include <glib/gi18n.h>
9 #include <eel/eel-accessibility.h>
10 #include <eel/eel-debug.h>
12 #include "caja-trash-bar.h"
13 #include "caja-x-content-bar.h"
14 #include "caja-navigation-window-pane.h"
15 +#include "caja-zfs-bar.h"
17 /* FIXME bugzilla.gnome.org 41243:
18 * We should use inheritance instead of these special cases
21 end_location_change (slot);
23 + GFile *old_file = NULL;
24 + old_file = caja_window_slot_get_location (slot);
28 + directory = caja_directory_get (old_file);
31 + caja_directory_cancel_restore_info (directory);
32 + g_object_unref (directory);
35 + g_object_unref (old_file);
39 caja_window_slot_set_allow_stop (slot, TRUE);
40 caja_window_slot_set_status (slot, " ");
42 g_assert (slot->pending_location == NULL);
43 g_assert (slot->pending_selection == NULL);
45 + directory = caja_directory_get (location);
47 + /* if snap and (ts is enabled and displayed )
48 + * check if the directory exist
49 + * if it doesn't move to the next available one */
50 + if (caja_directory_is_in_snapshot (directory) && caja_is_time_slider_enabled ())
52 + if (gtk_widget_get_visible (GTK_WIDGET (CAJA_NAVIGATION_WINDOW (window)->zfs_bar)))
54 + char *path = g_file_get_path (location);
55 + if (!g_file_test (path, G_FILE_TEST_IS_DIR))
57 + caja_zfs_bar_remove_and_skip_snap (CAJA_ZFS_BAR (CAJA_NAVIGATION_WINDOW (window)->zfs_bar), path);
65 slot->pending_location = g_object_ref (location);
66 slot->location_change_type = type;
67 slot->location_change_distance = distance;
69 slot->open_callback = callback;
70 slot->open_callback_user_data = user_data;
72 - directory = caja_directory_get (location);
74 /* The code to force a reload is here because if we do it
75 * after determining an initial view (in the components), then
76 * we end up fetching things twice.
77 @@ -1255,8 +1291,20 @@
78 if (slot->location_change_type != CAJA_LOCATION_CHANGE_FALLBACK)
80 /* Look in metadata for view */
81 - view_id = caja_file_get_metadata
82 - (file, CAJA_METADATA_KEY_DEFAULT_VIEW, NULL);
83 + if (caja_file_is_in_snapshot (file))
85 + CajaDirectory* root_dir = caja_zfs_bar_get_dir (CAJA_ZFS_BAR (CAJA_NAVIGATION_WINDOW (window)->zfs_bar));
88 + view_id = caja_file_get_metadata (caja_directory_get_corresponding_file (root_dir),
89 + CAJA_METADATA_KEY_DEFAULT_VIEW, NULL);
92 + if (view_id == NULL)
94 + view_id = caja_file_get_metadata (file, CAJA_METADATA_KEY_DEFAULT_VIEW, NULL);
97 if (view_id != NULL &&
98 !caja_view_factory_view_supports_uri (view_id,
100 @@ -1804,6 +1852,7 @@
102 update_for_new_location (CajaWindowSlot *slot)
104 + CajaDirectory *directory;
108 @@ -1857,6 +1906,30 @@
109 caja_window_load_extension_menus (window);
112 + /* time slider pref can be just enabled so we need
113 + * to rescan for snapshots */
114 + directory = caja_directory_get (slot->location);
116 + if (CAJA_IS_NAVIGATION_WINDOW (window))
118 + if (slot->find_zfs_snapshots_cancellable != NULL)
120 + g_cancellable_cancel (slot->find_zfs_snapshots_cancellable);
121 + slot->find_zfs_snapshots_cancellable = NULL;
123 + slot->find_zfs_snapshots_cancellable = g_cancellable_new ();
124 + caja_zfs_bar_display (CAJA_ZFS_BAR (CAJA_NAVIGATION_WINDOW (window)->zfs_bar),
127 + slot->find_zfs_snapshots_cancellable);
132 + caja_window_allow_restore (window, FALSE);
134 + caja_directory_unref (directory);
136 if (location_really_changed)
138 CajaDirectory *directory;
139 @@ -2227,12 +2300,22 @@
140 caja_window_slot_stop_loading (CajaWindowSlot *slot)
143 + CajaDirectory *directory;
145 window = CAJA_WINDOW (slot->pane->window);
146 g_assert (CAJA_IS_WINDOW (window));
148 caja_view_stop_loading (slot->content_view);
150 + if (slot->find_zfs_snapshots_cancellable)
152 + g_cancellable_cancel (slot->find_zfs_snapshots_cancellable);
155 + directory = caja_directory_get (slot->location);
156 + caja_directory_cancel_restore_info (directory);
157 + caja_directory_unref (directory);
159 if (slot->new_content_view != NULL)
161 window->details->temporarily_ignore_view_signals = TRUE;
162 @@ -2293,11 +2376,22 @@
163 caja_window_manage_views_close_slot (CajaWindowPane *pane,
164 CajaWindowSlot *slot)
166 + CajaDirectory *directory;
168 if (slot->content_view != NULL)
170 caja_window_slot_disconnect_content_view (slot, slot->content_view);
173 + if (slot->find_zfs_snapshots_cancellable)
175 + g_cancellable_cancel (slot->find_zfs_snapshots_cancellable);
178 + directory = caja_directory_get (slot->location);
179 + caja_directory_cancel_restore_info (directory);
180 + caja_directory_unref (directory);
182 free_location_change (slot);
183 cancel_viewed_file_changed_callback (slot);