jenkins-core-weekly: update to 2.491
[oi-userland.git] / components / desktop / mate / caja / patches / 10-timeslider-caja-window-manage-views.patch
blobf5ef421c934673d35b8fa7a67c591549a0b542bf
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
3 @@ -30,6 +30,7 @@
4 #include <gtk/gtk.h>
5 #include <gdk/gdkx.h>
6 #include <glib/gi18n.h>
7 +#include <stdlib.h>
9 #include <eel/eel-accessibility.h>
10 #include <eel/eel-debug.h>
11 @@ -71,6 +72,7 @@
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
19 @@ -942,12 +944,48 @@
21 end_location_change (slot);
23 + GFile *old_file = NULL;
24 + old_file = caja_window_slot_get_location (slot);
26 + if (old_file)
27 + {
28 + directory = caja_directory_get (old_file);
29 + if (directory)
30 + {
31 + caja_directory_cancel_restore_info (directory);
32 + g_object_unref (directory);
33 + directory = NULL;
34 + }
35 + g_object_unref (old_file);
36 + old_file = NULL;
37 + }
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 ())
51 + {
52 + if (gtk_widget_get_visible (GTK_WIDGET (CAJA_NAVIGATION_WINDOW (window)->zfs_bar)))
53 + {
54 + char *path = g_file_get_path (location);
55 + if (!g_file_test (path, G_FILE_TEST_IS_DIR))
56 + {
57 + caja_zfs_bar_remove_and_skip_snap (CAJA_ZFS_BAR (CAJA_NAVIGATION_WINDOW (window)->zfs_bar), path);
58 + g_free (path);
59 + return;
60 + }
61 + g_free (path);
62 + }
63 + }
65 slot->pending_location = g_object_ref (location);
66 slot->location_change_type = type;
67 slot->location_change_distance = distance;
68 @@ -959,8 +997,6 @@
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))
84 + {
85 + CajaDirectory* root_dir = caja_zfs_bar_get_dir (CAJA_ZFS_BAR (CAJA_NAVIGATION_WINDOW (window)->zfs_bar));
86 + if (root_dir)
87 + {
88 + view_id = caja_file_get_metadata (caja_directory_get_corresponding_file (root_dir),
89 + CAJA_METADATA_KEY_DEFAULT_VIEW, NULL);
90 + }
91 + }
92 + if (view_id == NULL)
93 + {
94 + view_id = caja_file_get_metadata (file, CAJA_METADATA_KEY_DEFAULT_VIEW, NULL);
95 + }
97 if (view_id != NULL &&
98 !caja_view_factory_view_supports_uri (view_id,
99 location,
100 @@ -1804,6 +1852,7 @@
101 static void
102 update_for_new_location (CajaWindowSlot *slot)
104 + CajaDirectory *directory;
105 CajaWindow *window;
106 GFile *new_location;
107 CajaFile *file;
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),
125 + window,
126 + directory,
127 + slot->find_zfs_snapshots_cancellable);
130 + else
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)
142 CajaWindow *window;
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);