import nautilus-3.28.1-20.el8

This commit is contained in:
CentOS Sources 2022-09-27 09:56:38 -04:00 committed by Stepan Oksanichenko
parent b75caeb90e
commit 3eada3ae62
8 changed files with 2179 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,77 @@
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 08107a64e..d808b04ff 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -6078,6 +6078,33 @@ action_cut (GSimpleAction *action,
nautilus_file_list_free (selection);
}
+static void
+action_copy_current_location (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
+{
+ NautilusFilesView *view;
+ GtkClipboard *clipboard;
+ GFile *file;
+ gchar *path;
+ NautilusFilesViewPrivate *priv;
+
+ view = NAUTILUS_FILES_VIEW (user_data);
+ priv = nautilus_files_view_get_instance_private (view);
+
+ if (priv->directory_as_file != NULL)
+ {
+ file = nautilus_file_get_location (priv->directory_as_file);
+
+ clipboard = nautilus_clipboard_get (GTK_WIDGET (view));
+ path = g_file_get_parse_name (file);
+ gtk_clipboard_set_text (clipboard, path, -1);
+
+ g_object_unref (file);
+ g_free (path);
+ }
+}
+
static void
action_create_links_in_place (GSimpleAction *action,
GVariant *state,
@@ -6958,6 +6985,7 @@ const GActionEntry view_entries[] =
{ "new-folder", action_new_folder },
{ "select-all", action_select_all },
{ "paste", action_paste_files },
+ { "copy-current-location", action_copy_current_location },
{ "create-link", action_create_links },
{ "new-document" },
/* Selection menu */
@@ -7590,6 +7618,10 @@ real_update_actions_state (NautilusFilesView *view)
g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
can_move_files && !selection_contains_recent &&
!selection_contains_starred);
+ action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group),
+ "copy-current-location");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+ !selection_contains_search);
/* Drive menu */
show_mount = (selection != NULL);
diff --git a/src/resources/ui/nautilus-pathbar-context-menu.ui b/src/resources/ui/nautilus-pathbar-context-menu.ui
index 403cf71f6..4d32c1e8e 100644
--- a/src/resources/ui/nautilus-pathbar-context-menu.ui
+++ b/src/resources/ui/nautilus-pathbar-context-menu.ui
@@ -16,6 +16,12 @@
<attribute name="label" translatable="yes">Add to _Bookmarks</attribute>
<attribute name="action">view.bookmark</attribute>
</item>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Copy Location</attribute>
+ <attribute name="action">view.copy-current-location</attribute>
+ </item>
+ </section>
<section>
<item>
<attribute name="label" translatable="yes">_Paste</attribute>
--
2.36.1

View File

@ -0,0 +1,156 @@
diff -ruN nautilus-3.28.1/po/ca.po nautilus-3.28.1.translations/po/ca.po
--- nautilus-3.28.1/po/ca.po 2018-04-09 22:02:06.000000000 +0200
+++ nautilus-3.28.1.translations/po/ca.po 2022-06-20 17:02:58.239093717 +0200
@@ -7061,3 +7061,7 @@
#~ "Amb el Nautilus heu d'haver rebut una còpia de la Llicència Pública "
#~ "General de GNU; si no és així, escriviu a la Free Software Foundation, "
#~ "Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA"
+
+#: src/resources/ui/nautilus-files-view-context-menus.ui:24
+msgid "_Copy Location"
+msgstr "_Copia la ubicació"
diff -ruN nautilus-3.28.1/po/de.po nautilus-3.28.1.translations/po/de.po
--- nautilus-3.28.1/po/de.po 2018-04-09 22:02:06.000000000 +0200
+++ nautilus-3.28.1.translations/po/de.po 2022-06-20 17:02:58.276093695 +0200
@@ -5716,3 +5716,7 @@
#~ msgid "org.gnome.Nautilus"
#~ msgstr "org.gnome.Nautilus"
+
+#: src/resources/ui/nautilus-files-view-context-menus.ui:24
+msgid "_Copy Location"
+msgstr "Ort _kopieren"
diff -ruN nautilus-3.28.1/po/es.po nautilus-3.28.1.translations/po/es.po
--- nautilus-3.28.1/po/es.po 2018-04-09 22:02:06.000000000 +0200
+++ nautilus-3.28.1.translations/po/es.po 2022-06-20 17:02:58.309093676 +0200
@@ -10830,3 +10830,8 @@
#~ msgstr ""
#~ "Nautilus es un shell gráfico para GNOME que facilita la administración de "
#~ "sus archivos y el resto de su sistema."
+
+# src/nautilus-location-bar.c:401
+#: src/resources/ui/nautilus-files-view-context-menus.ui:24
+msgid "_Copy Location"
+msgstr "Copiar _ubicación"
diff -ruN nautilus-3.28.1/po/fa.po nautilus-3.28.1.translations/po/fa.po
--- nautilus-3.28.1/po/fa.po 2018-04-09 22:02:06.000000000 +0200
+++ nautilus-3.28.1.translations/po/fa.po 2022-06-20 17:02:58.327093666 +0200
@@ -10082,3 +10082,7 @@
#~ msgid "C_ancel Remove"
#~ msgstr "ان_صراف از حذف"
+
+#: src/resources/ui/nautilus-files-view-context-menus.ui:24
+msgid "_Copy Location"
+msgstr "_رونوشت از مکان"
diff -ruN nautilus-3.28.1/po/fr.po nautilus-3.28.1.translations/po/fr.po
--- nautilus-3.28.1/po/fr.po 2018-04-09 22:02:06.000000000 +0200
+++ nautilus-3.28.1.translations/po/fr.po 2022-06-20 17:02:58.339093659 +0200
@@ -5975,3 +5975,7 @@
#~ msgid "Copying “%B” to “%B”"
#~ msgstr "Copie de « %B » vers « %B »"
+
+#: src/resources/ui/nautilus-files-view-context-menus.ui:34
+msgid "_Copy Location"
+msgstr "Co_pier lemplacement"
diff -ruN nautilus-3.28.1/po/fur.po nautilus-3.28.1.translations/po/fur.po
--- nautilus-3.28.1/po/fur.po 2018-04-09 22:02:06.000000000 +0200
+++ nautilus-3.28.1.translations/po/fur.po 2022-06-20 17:02:58.348093654 +0200
@@ -7711,3 +7711,7 @@
#~ msgid "Set the zoom level of the current view"
#~ msgstr "Imposte il nivel di zoom de viodude atuâl"
+
+#: src/resources/ui/nautilus-files-view-context-menus.ui:24
+msgid "_Copy Location"
+msgstr "_Copie posizion"
diff -ruN nautilus-3.28.1/po/gl.po nautilus-3.28.1.translations/po/gl.po
--- nautilus-3.28.1/po/gl.po 2018-04-09 22:02:06.000000000 +0200
+++ nautilus-3.28.1.translations/po/gl.po 2022-06-20 17:02:58.366093644 +0200
@@ -7429,3 +7429,8 @@
#~ msgid "<big><b>Error autorunning software</b></big>"
#~ msgstr "<big><b>Produciuse un erro ao autoexecutar o software</b></big>"
+
+#: src/resources/ui/nautilus-files-view-context-menus.ui:24
+#| msgid "Location"
+msgid "_Copy Location"
+msgstr "_Copiar localización"
diff -ruN nautilus-3.28.1/po/he.po nautilus-3.28.1.translations/po/he.po
--- nautilus-3.28.1/po/he.po 2018-04-09 22:02:06.000000000 +0200
+++ nautilus-3.28.1.translations/po/he.po 2022-06-20 17:02:58.387093632 +0200
@@ -10468,3 +10468,7 @@
#~ msgid "Question"
#~ msgstr "שאלה"
+
+#: src/resources/ui/nautilus-files-view-context-menus.ui:34
+msgid "_Copy Location"
+msgstr "ה_עתקת מיקום"
diff -ruN nautilus-3.28.1/po/oc.po nautilus-3.28.1.translations/po/oc.po
--- nautilus-3.28.1/po/oc.po 2018-04-09 22:02:06.000000000 +0200
+++ nautilus-3.28.1.translations/po/oc.po 2022-06-20 17:02:58.523093554 +0200
@@ -6999,3 +6999,7 @@
#~ msgid "Rename “%s”"
#~ msgstr "Renomenar lo fichièr « %s »"
+
+#: src/resources/ui/nautilus-files-view-context-menus.ui:34
+msgid "_Copy Location"
+msgstr "_Copiar l'emplaçament"
diff -ruN nautilus-3.28.1/po/pt.po nautilus-3.28.1.translations/po/pt.po
--- nautilus-3.28.1/po/pt.po 2018-04-09 22:02:06.000000000 +0200
+++ nautilus-3.28.1.translations/po/pt.po 2022-06-20 17:02:58.627093494 +0200
@@ -5944,3 +5944,7 @@
#~ msgid "Whether the row represents a network location"
#~ msgstr "Se a linha representa uma localização de rede"
+
+#: src/resources/ui/nautilus-files-view-context-menus.ui:34
+msgid "_Copy Location"
+msgstr "_Copiar localização"
diff -ruN nautilus-3.28.1/po/ru.po nautilus-3.28.1.translations/po/ru.po
--- nautilus-3.28.1/po/ru.po 2018-04-09 22:02:06.000000000 +0200
+++ nautilus-3.28.1.translations/po/ru.po 2022-06-20 17:02:58.652093480 +0200
@@ -6177,3 +6177,7 @@
#~ msgctxt "Bookmark"
#~ msgid "_Name"
#~ msgstr "_Имя"
+
+#: src/resources/ui/nautilus-files-view-context-menus.ui:34
+msgid "_Copy Location"
+msgstr "_Копировать адрес"
diff -ruN nautilus-3.28.1/po/tr.po nautilus-3.28.1.translations/po/tr.po
--- nautilus-3.28.1/po/tr.po 2018-04-09 22:02:06.000000000 +0200
+++ nautilus-3.28.1.translations/po/tr.po 2022-06-20 17:02:58.776093409 +0200
@@ -6188,3 +6188,7 @@
#~ msgid "D_efault zoom level:"
#~ msgstr "Ön_tanımlı yaklaştırma seviyesi:"
+
+#: src/resources/ui/nautilus-files-view-context-menus.ui:24
+msgid "_Copy Location"
+msgstr "Konumu _Kopyala"
diff -ruN nautilus-3.28.1/po/uk.po nautilus-3.28.1.translations/po/uk.po
--- nautilus-3.28.1/po/uk.po 2018-04-09 22:02:06.000000000 +0200
+++ nautilus-3.28.1.translations/po/uk.po 2022-06-20 17:02:58.808093390 +0200
@@ -7967,3 +7967,7 @@
#~ msgid "Set the zoom level of the current view"
#~ msgstr "Встановити рівень масштабування поточного вікна"
+
+#: src/resources/ui/nautilus-files-view-context-menus.ui:34
+msgid "_Copy Location"
+msgstr "_Копіювати адресу"
diff -ruN nautilus-3.28.1/po/zh_CN.po nautilus-3.28.1.translations/po/zh_CN.po
--- nautilus-3.28.1/po/zh_CN.po 2018-04-09 22:02:06.000000000 +0200
+++ nautilus-3.28.1.translations/po/zh_CN.po 2022-06-20 17:02:58.865093358 +0200
@@ -5495,3 +5495,7 @@
#~ msgid "Zoom In"
#~ msgstr "放大"
+
+#: src/resources/ui/nautilus-files-view-context-menus.ui:34
+msgid "_Copy Location"
+msgstr "复制位置(_C)"

View File

@ -0,0 +1,189 @@
From a7a31137aee8c4af81d7d447ceb83ccdb2ddadc0 Mon Sep 17 00:00:00 2001
From: Xiang Fan <sfanxiang@gmail.com>
Date: Fri, 13 Jul 2018 11:49:09 -0700
Subject: [PATCH] nautilus-canvas-container: Remove the "include visible area"
logic.
canvas_set_scroll_region_include_visible_area() was added in
ec054c80981e26b71c8bb2e6853b035dc2063e7d to fix
https://bugzilla.gnome.org/show_bug.cgi?id=42068 ("Dragging icons
adjusts scroll area in a way that causes immediate scrolling"). This is
no longer the case, because now icons remain in place when being dragged
and are not allowed to be rearranged.
ec054c80981e26b71c8bb2e6853b035dc2063e7d causes issues relating to extra
scrolling space (#340), hence the removal.
Fixes #340.
---
src/nautilus-canvas-container.c | 79 +--------------------------------
src/nautilus-canvas-container.h | 1 -
src/nautilus-canvas-private.h | 3 --
src/nautilus-canvas-view.c | 6 ---
4 files changed, 1 insertion(+), 88 deletions(-)
diff --git a/src/nautilus-canvas-container.c b/src/nautilus-canvas-container.c
index 09acd47fc..bd05a3a2d 100644
--- a/src/nautilus-canvas-container.c
+++ b/src/nautilus-canvas-container.c
@@ -968,45 +968,6 @@ get_all_icon_bounds (NautilusCanvasContainer *container,
x1, y1, x2, y2, usage);
}
-/* Don't preserve visible white space the next time the scroll region
- * is recomputed when the container is not empty. */
-void
-nautilus_canvas_container_reset_scroll_region (NautilusCanvasContainer *container)
-{
- container->details->reset_scroll_region_trigger = TRUE;
-}
-
-/* Set a new scroll region without eliminating any of the currently-visible area. */
-static void
-canvas_set_scroll_region_include_visible_area (EelCanvas *canvas,
- double x1,
- double y1,
- double x2,
- double y2)
-{
- double old_x1, old_y1, old_x2, old_y2;
- double old_scroll_x, old_scroll_y;
- double height, width;
- GtkAllocation allocation;
-
- eel_canvas_get_scroll_region (canvas, &old_x1, &old_y1, &old_x2, &old_y2);
- gtk_widget_get_allocation (GTK_WIDGET (canvas), &allocation);
-
- width = (allocation.width) / canvas->pixels_per_unit;
- height = (allocation.height) / canvas->pixels_per_unit;
-
- old_scroll_x = gtk_adjustment_get_value (gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (canvas)));
- old_scroll_y = gtk_adjustment_get_value (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (canvas)));
-
- x1 = MIN (x1, old_x1 + old_scroll_x);
- y1 = MIN (y1, old_y1 + old_scroll_y);
- x2 = MAX (x2, old_x1 + old_scroll_x + width);
- y2 = MAX (y2, old_y1 + old_scroll_y + height);
-
- eel_canvas_set_scroll_region
- (canvas, x1, y1, x2, y2);
-}
-
void
nautilus_canvas_container_update_scroll_region (NautilusCanvasContainer *container)
{
@@ -1014,24 +975,10 @@ nautilus_canvas_container_update_scroll_region (NautilusCanvasContainer *contain
double pixels_per_unit;
GtkAdjustment *hadj, *vadj;
float step_increment;
- gboolean reset_scroll_region;
GtkAllocation allocation;
pixels_per_unit = EEL_CANVAS (container)->pixels_per_unit;
- reset_scroll_region = container->details->reset_scroll_region_trigger
- || nautilus_canvas_container_is_empty (container);
-
- /* The trigger is only cleared when container is non-empty, so
- * callers can reliably reset the scroll region when an item
- * is added even if extraneous relayouts are called when the
- * window is still empty.
- */
- if (!nautilus_canvas_container_is_empty (container))
- {
- container->details->reset_scroll_region_trigger = FALSE;
- }
-
get_all_icon_bounds (container, &x1, &y1, &x2, &y2, BOUNDS_USAGE_FOR_ENTIRE_ITEM);
/* Add border at the "end"of the layout (i.e. after the icons), to
@@ -1053,18 +1000,7 @@ nautilus_canvas_container_update_scroll_region (NautilusCanvasContainer *contain
y2 -= 1;
y2 = MAX (y1, y2);
- if (reset_scroll_region)
- {
- eel_canvas_set_scroll_region
- (EEL_CANVAS (container),
- x1, y1, x2, y2);
- }
- else
- {
- canvas_set_scroll_region_include_visible_area
- (EEL_CANVAS (container),
- x1, y1, x2, y2);
- }
+ eel_canvas_set_scroll_region (EEL_CANVAS (container), x1, y1, x2, y2);
hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (container));
vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (container));
@@ -5722,23 +5658,10 @@ nautilus_canvas_container_get_icon_drop_target_uri (NautilusCanvasContainer *con
return uri;
}
-/* Call to reset the scroll region only if the container is not empty,
- * to avoid having the flag linger until the next file is added.
- */
-static void
-reset_scroll_region_if_not_empty (NautilusCanvasContainer *container)
-{
- if (!nautilus_canvas_container_is_empty (container))
- {
- nautilus_canvas_container_reset_scroll_region (container);
- }
-}
-
/* Re-sort, switching to automatic layout if it was in manual layout. */
void
nautilus_canvas_container_sort (NautilusCanvasContainer *container)
{
- reset_scroll_region_if_not_empty (container);
container->details->needs_resort = TRUE;
redo_layout (container);
}
diff --git a/src/nautilus-canvas-container.h b/src/nautilus-canvas-container.h
index a370bba26..33929375d 100644
--- a/src/nautilus-canvas-container.h
+++ b/src/nautilus-canvas-container.h
@@ -271,7 +271,6 @@ void nautilus_canvas_container_set_single_click_mode (Nauti
gboolean single_click_mode);
void nautilus_canvas_container_enable_linger_selection (NautilusCanvasContainer *view,
gboolean enable);
-void nautilus_canvas_container_reset_scroll_region (NautilusCanvasContainer *container);
void nautilus_canvas_container_set_font (NautilusCanvasContainer *container,
const char *font);
void nautilus_canvas_container_set_margins (NautilusCanvasContainer *container,
diff --git a/src/nautilus-canvas-private.h b/src/nautilus-canvas-private.h
index dd5e79060..e60e86299 100644
--- a/src/nautilus-canvas-private.h
+++ b/src/nautilus-canvas-private.h
@@ -192,9 +192,6 @@ struct NautilusCanvasContainerDetails {
int size_allocation_count;
guint size_allocation_count_id;
-
- /* Ignore the visible area the next time the scroll region is recomputed */
- gboolean reset_scroll_region_trigger;
/* a11y items used by canvas items */
guint a11y_item_action_idle_handler;
diff --git a/src/nautilus-canvas-view.c b/src/nautilus-canvas-view.c
index f74ea06db..bd3a7ae5d 100644
--- a/src/nautilus-canvas-view.c
+++ b/src/nautilus-canvas-view.c
@@ -355,12 +355,6 @@ nautilus_canvas_view_add_files (NautilusFilesView *view,
canvas_view = NAUTILUS_CANVAS_VIEW (view);
canvas_container = get_canvas_container (canvas_view);
- /* Reset scroll region for the first canvas added when loading a directory. */
- if (nautilus_files_view_get_loading (view) && nautilus_canvas_container_is_empty (canvas_container))
- {
- nautilus_canvas_container_reset_scroll_region (canvas_container);
- }
-
for (l = files; l != NULL; l = l->next)
{
if (nautilus_canvas_container_add (canvas_container,
--
2.37.1

View File

@ -0,0 +1,118 @@
From 4bdd3fad8d51e50e3539c8e04bc91538467bd236 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ant=C3=B3nio=20Fernandes?= <antoniof@gnome.org>
Date: Wed, 8 Jul 2020 14:44:38 +0100
Subject: [PATCH] window: Streamline RestoreTabData memory management
When restoring the back and forward lists, we make a deep copy only to
free the data immediately afterwards.
Instead of reallocating the lists unnecessarily, let's just steal them.
Also, use g_queue_free_full() to make free_restore_tab_data() a proper
GDestroyNotify; also define it in window-slot.c, where it belongs.
---
src/nautilus-window-slot.c | 16 ++++++++++++++--
src/nautilus-window-slot.h | 1 +
src/nautilus-window.c | 20 ++------------------
3 files changed, 17 insertions(+), 20 deletions(-)
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index c3260aeb0..bf040bff2 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -155,6 +155,18 @@ static void trash_state_changed_cb (NautilusTrashMonitor *monitor,
gboolean is_empty,
gpointer user_data);
+void
+free_restore_tab_data (gpointer data)
+{
+ RestoreTabData *tab_data = data;
+
+ g_list_free_full (tab_data->back_list, g_object_unref);
+ g_list_free_full (tab_data->forward_list, g_object_unref);
+ nautilus_file_unref (tab_data->file);
+
+ g_free (tab_data);
+}
+
void
nautilus_window_slot_restore_from_data (NautilusWindowSlot *self,
RestoreTabData *data)
@@ -163,9 +175,9 @@ nautilus_window_slot_restore_from_data (NautilusWindowSlot *self,
priv = nautilus_window_slot_get_instance_private (self);
- priv->back_list = g_list_copy_deep (data->back_list, (GCopyFunc) g_object_ref, NULL);
+ priv->back_list = g_steal_pointer (&data->back_list);
- priv->forward_list = g_list_copy_deep (data->forward_list, (GCopyFunc) g_object_ref, NULL);
+ priv->forward_list = g_steal_pointer (&data->forward_list);
priv->view_mode_before_search = data->view_before_search;
diff --git a/src/nautilus-window-slot.h b/src/nautilus-window-slot.h
index 573357d9b..bda1a920f 100644
--- a/src/nautilus-window-slot.h
+++ b/src/nautilus-window-slot.h
@@ -125,4 +125,5 @@ RestoreTabData* nautilus_window_slot_get_restore_tab_data (NautilusWindowSlot *s
/* Only used by slot-dnd */
NautilusView* nautilus_window_slot_get_current_view (NautilusWindowSlot *slot);
+void free_restore_tab_data (gpointer data);
#endif /* NAUTILUS_WINDOW_SLOT_H */
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 1f8d5208e..175da6fce 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -79,8 +79,6 @@ static GtkWidget *nautilus_window_ensure_location_entry (NautilusWindow *window)
static void close_slot (NautilusWindow *window,
NautilusWindowSlot *slot,
gboolean remove_from_notebook);
-static void free_restore_tab_data (gpointer data,
- gpointer user_data);
/* Sanity check: highest mouse button value I could find was 14. 5 is our
* lower threshold (well-documented to be the one of the button events for the
@@ -1374,7 +1372,7 @@ action_restore_tab (GSimpleAction *action,
nautilus_window_slot_open_location_full (slot, location, flags, NULL);
nautilus_window_slot_restore_from_data (slot, data);
- free_restore_tab_data (data, NULL);
+ free_restore_tab_data (data);
}
static void
@@ -2501,19 +2499,6 @@ nautilus_window_destroy (GtkWidget *object)
GTK_WIDGET_CLASS (nautilus_window_parent_class)->destroy (object);
}
-static void
-free_restore_tab_data (gpointer data,
- gpointer user_data)
-{
- RestoreTabData *tab_data = data;
-
- g_list_free_full (tab_data->back_list, g_object_unref);
- g_list_free_full (tab_data->forward_list, g_object_unref);
- nautilus_file_unref (tab_data->file);
-
- g_free (tab_data);
-}
-
static void
nautilus_window_finalize (GObject *object)
{
@@ -2548,8 +2533,7 @@ nautilus_window_finalize (GObject *object)
G_CALLBACK (nautilus_window_on_undo_changed),
window);
- g_queue_foreach (priv->tab_data_queue, (GFunc) free_restore_tab_data, NULL);
- g_queue_free (priv->tab_data_queue);
+ g_queue_free_full (priv->tab_data_queue, free_restore_tab_data);
g_object_unref (priv->pad_controller);
--
2.35.1

View File

@ -0,0 +1,170 @@
From 148559bc6809aac40be4aff64b7d3a4e5ac3c59a Mon Sep 17 00:00:00 2001
From: Sachin Daluja <30343-sachindaluja@users.noreply.gitlab.gnome.org>
Date: Sun, 24 May 2020 13:29:49 -0400
Subject: [PATCH] window-slot: Rename RestoreTabData to NautilusNavigationState
This struct is going to be used to also restore navigation state when
replacing the active window slot in order to handle other-locations://
Also enhance it to also save and restore the current location bookmark.
---
src/nautilus-window-slot.c | 28 ++++++++++++++++------------
src/nautilus-window-slot.h | 11 ++++++-----
src/nautilus-window.c | 12 ++++++------
3 files changed, 28 insertions(+), 23 deletions(-)
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index bf040bff2..e688f0716 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -156,20 +156,21 @@ static void trash_state_changed_cb (NautilusTrashMonitor *monitor,
gpointer user_data);
void
-free_restore_tab_data (gpointer data)
+free_navigation_state (gpointer data)
{
- RestoreTabData *tab_data = data;
+ NautilusNavigationState *navigation_state = data;
- g_list_free_full (tab_data->back_list, g_object_unref);
- g_list_free_full (tab_data->forward_list, g_object_unref);
- nautilus_file_unref (tab_data->file);
+ g_list_free_full (navigation_state->back_list, g_object_unref);
+ g_list_free_full (navigation_state->forward_list, g_object_unref);
+ nautilus_file_unref (navigation_state->file);
+ g_clear_object (&navigation_state->current_location_bookmark);
- g_free (tab_data);
+ g_free (navigation_state);
}
void
-nautilus_window_slot_restore_from_data (NautilusWindowSlot *self,
- RestoreTabData *data)
+nautilus_window_slot_restore_navigation_state (NautilusWindowSlot *self,
+ NautilusNavigationState *data)
{
NautilusWindowSlotPrivate *priv;
@@ -181,14 +182,16 @@ nautilus_window_slot_restore_from_data (NautilusWindowSlot *self,
priv->view_mode_before_search = data->view_before_search;
+ g_set_object (&priv->current_location_bookmark, data->current_location_bookmark);
+
priv->location_change_type = NAUTILUS_LOCATION_CHANGE_RELOAD;
}
-RestoreTabData *
-nautilus_window_slot_get_restore_tab_data (NautilusWindowSlot *self)
+NautilusNavigationState *
+nautilus_window_slot_get_navigation_state (NautilusWindowSlot *self)
{
NautilusWindowSlotPrivate *priv;
- RestoreTabData *data;
+ NautilusNavigationState *data;
GList *back_list;
GList *forward_list;
@@ -211,11 +214,12 @@ nautilus_window_slot_get_restore_tab_data (NautilusWindowSlot *self)
* the view mode before search and a reference to the file.
* A GFile isn't enough, as the NautilusFile also keeps a
* reference to the search directory */
- data = g_new0 (RestoreTabData, 1);
+ data = g_new0 (NautilusNavigationState, 1);
data->back_list = back_list;
data->forward_list = forward_list;
data->file = nautilus_file_get (priv->location);
data->view_before_search = priv->view_mode_before_search;
+ g_set_object (&data->current_location_bookmark, priv->current_location_bookmark);
return data;
}
diff --git a/src/nautilus-window-slot.h b/src/nautilus-window-slot.h
index bda1a920f..2edc96786 100644
--- a/src/nautilus-window-slot.h
+++ b/src/nautilus-window-slot.h
@@ -48,7 +48,8 @@ typedef struct
gint view_before_search;
GList *back_list;
GList *forward_list;
-} RestoreTabData;
+ NautilusBookmark *current_location_bookmark;
+} NautilusNavigationState;
struct _NautilusWindowSlotClass {
GtkBoxClass parent_class;
@@ -117,13 +118,13 @@ void nautilus_window_slot_search (NautilusWindowSlot *
gboolean nautilus_window_slot_handles_location (NautilusWindowSlot *self,
GFile *location);
-void nautilus_window_slot_restore_from_data (NautilusWindowSlot *self,
- RestoreTabData *data);
+void nautilus_window_slot_restore_navigation_state (NautilusWindowSlot *self,
+ NautilusNavigationState *data);
-RestoreTabData* nautilus_window_slot_get_restore_tab_data (NautilusWindowSlot *self);
+NautilusNavigationState* nautilus_window_slot_get_navigation_state (NautilusWindowSlot *self);
/* Only used by slot-dnd */
NautilusView* nautilus_window_slot_get_current_view (NautilusWindowSlot *slot);
-void free_restore_tab_data (gpointer data);
+void free_navigation_state (gpointer data);
#endif /* NAUTILUS_WINDOW_SLOT_H */
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 175da6fce..900239cb8 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -1349,7 +1349,7 @@ action_restore_tab (GSimpleAction *action,
NautilusWindowOpenFlags flags;
g_autoptr (GFile) location = NULL;
NautilusWindowSlot *slot;
- RestoreTabData *data;
+ NautilusNavigationState *data;
priv = nautilus_window_get_instance_private (window);
@@ -1370,9 +1370,9 @@ action_restore_tab (GSimpleAction *action,
slot = nautilus_window_create_and_init_slot (window, location, flags);
nautilus_window_slot_open_location_full (slot, location, flags, NULL);
- nautilus_window_slot_restore_from_data (slot, data);
+ nautilus_window_slot_restore_navigation_state (slot, data);
- free_restore_tab_data (data);
+ free_navigation_state (data);
}
static void
@@ -1579,7 +1579,7 @@ nautilus_window_slot_close (NautilusWindow *window,
{
NautilusWindowPrivate *priv;
NautilusWindowSlot *next_slot;
- RestoreTabData *data;
+ NautilusNavigationState *data;
DEBUG ("Requesting to remove slot %p from window %p", slot, window);
if (window == NULL)
@@ -1595,7 +1595,7 @@ nautilus_window_slot_close (NautilusWindow *window,
nautilus_window_set_active_slot (window, next_slot);
}
- data = nautilus_window_slot_get_restore_tab_data (slot);
+ data = nautilus_window_slot_get_navigation_state (slot);
if (data != NULL)
{
g_queue_push_head (priv->tab_data_queue, data);
@@ -2533,7 +2533,7 @@ nautilus_window_finalize (GObject *object)
G_CALLBACK (nautilus_window_on_undo_changed),
window);
- g_queue_free_full (priv->tab_data_queue, free_restore_tab_data);
+ g_queue_free_full (priv->tab_data_queue, free_navigation_state);
g_object_unref (priv->pad_controller);
--
2.35.1

View File

@ -0,0 +1,242 @@
From fe7533b0b82e2ebc7767006ee9768572700a91df Mon Sep 17 00:00:00 2001
From: Sachin Daluja <30343-sachindaluja@users.noreply.gitlab.gnome.org>
Date: Sun, 10 May 2020 22:30:03 -0400
Subject: [PATCH] window, window-slot: Save and restore navigation history
When a new window slot instance replaces the existing one to handle the new
location.
This allows back and forward history lists to be preserved when the window
switches between instances of different window slot classes.
Closes https://gitlab.gnome.org/GNOME/nautilus/-/issues/32
---
src/nautilus-window-slot.c | 48 +++++++++++++++++++---
src/nautilus-window-slot.h | 13 ++++++
src/nautilus-window.c | 84 +++++++++++++++++++++++++++++++++++++-
3 files changed, 138 insertions(+), 7 deletions(-)
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index e688f0716..69040fc44 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -176,6 +176,9 @@ nautilus_window_slot_restore_navigation_state (NautilusWindowSlot *self,
priv = nautilus_window_slot_get_instance_private (self);
+ /* We are restoring saved history to newly created slot with no history. */
+ g_warn_if_fail (priv->back_list == NULL && priv->forward_list == NULL);
+
priv->back_list = g_steal_pointer (&data->back_list);
priv->forward_list = g_steal_pointer (&data->forward_list);
@@ -2003,12 +2006,11 @@ nautilus_window_slot_set_content_view (NautilusWindowSlot *self,
}
void
-nautilus_window_back_or_forward (NautilusWindow *window,
- gboolean back,
- guint distance,
- NautilusWindowOpenFlags flags)
+nautilus_window_slot_back_or_forward (NautilusWindowSlot *self,
+ gboolean back,
+ guint distance,
+ NautilusWindowOpenFlags flags)
{
- NautilusWindowSlot *self;
GList *list;
GFile *location;
guint len;
@@ -2016,7 +2018,6 @@ nautilus_window_back_or_forward (NautilusWindow *window,
GFile *old_location;
NautilusWindowSlotPrivate *priv;
- self = nautilus_window_get_active_slot (window);
priv = nautilus_window_slot_get_instance_private (self);
list = back ? priv->back_list : priv->forward_list;
@@ -3308,3 +3309,38 @@ nautilus_window_slot_get_loading (NautilusWindowSlot *self)
return priv->loading;
}
+
+/*
+ * Open the specified location and set up the navigation history including the
+ * back and forward lists. This function is intended to be called when switching
+ * between NautilusWindowSlot and NautilusOtherLocationsWindowSlot. It allows
+ * the navigation history accumulated in the slot being replaced to be loaded
+ * into the replacing slot.
+ *
+ * The 'location' member variable is set to the new location before calling
+ * begin_location_change() to ensure that it matches the
+ * 'current_location_bookmark' member as expected by the location change
+ * pipeline.
+ */
+void
+nautilus_window_slot_open_location_set_navigation_state (NautilusWindowSlot *self,
+ GFile *location,
+ NautilusWindowOpenFlags flags,
+ GList *new_selection,
+ NautilusLocationChangeType change_type,
+ NautilusNavigationState *navigation_state,
+ guint distance)
+{
+ NautilusWindowSlotPrivate *priv;
+
+ priv = nautilus_window_slot_get_instance_private (self);
+
+ nautilus_window_slot_restore_navigation_state (self, navigation_state);
+
+ g_clear_object (&priv->location);
+
+ priv->location = nautilus_file_get_location (navigation_state->file);
+
+ begin_location_change (self, location, NULL, new_selection,
+ change_type, distance, NULL);
+}
diff --git a/src/nautilus-window-slot.h b/src/nautilus-window-slot.h
index 2edc96786..cbd3454ce 100644
--- a/src/nautilus-window-slot.h
+++ b/src/nautilus-window-slot.h
@@ -82,6 +82,14 @@ void nautilus_window_slot_open_location_full (NautilusWindowSlot
NautilusWindowOpenFlags flags,
GList *new_selection);
+void nautilus_window_slot_open_location_set_navigation_state (NautilusWindowSlot *slot,
+ GFile *location,
+ NautilusWindowOpenFlags flags,
+ GList *new_selection,
+ NautilusLocationChangeType change_type,
+ NautilusNavigationState *navigation_state,
+ guint distance);
+
GFile * nautilus_window_slot_get_location (NautilusWindowSlot *slot);
NautilusBookmark *nautilus_window_slot_get_bookmark (NautilusWindowSlot *slot);
@@ -126,5 +134,10 @@ NautilusNavigationState* nautilus_window_slot_get_navigation_state (NautilusWind
/* Only used by slot-dnd */
NautilusView* nautilus_window_slot_get_current_view (NautilusWindowSlot *slot);
+void nautilus_window_slot_back_or_forward (NautilusWindowSlot *slot,
+ gboolean back,
+ guint distance,
+ NautilusWindowOpenFlags flags);
+
void free_navigation_state (gpointer data);
#endif /* NAUTILUS_WINDOW_SLOT_H */
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 900239cb8..af01b43e7 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -613,6 +613,7 @@ nautilus_window_open_location_full (NautilusWindow *window,
{
NautilusWindowSlot *active_slot;
gboolean new_tab_at_end;
+ NautilusNavigationState *navigation_state = NULL;
/* The location owner can be one of the slots requesting to handle an
* unhandled location. But this slot can be destroyed when switching to
@@ -644,6 +645,8 @@ nautilus_window_open_location_full (NautilusWindow *window,
}
else if (!nautilus_window_slot_handles_location (target_slot, location))
{
+ navigation_state = nautilus_window_slot_get_navigation_state (active_slot);
+
target_slot = replace_active_slot (window, location, flags);
}
@@ -655,7 +658,19 @@ nautilus_window_open_location_full (NautilusWindow *window,
nautilus_window_set_active_slot (window, target_slot);
}
- nautilus_window_slot_open_location_full (target_slot, location, flags, selection);
+ if (navigation_state != NULL)
+ {
+ nautilus_window_slot_open_location_set_navigation_state (target_slot,
+ location, flags, selection,
+ NAUTILUS_LOCATION_CHANGE_STANDARD,
+ navigation_state, 0);
+
+ free_navigation_state (navigation_state);
+ }
+ else
+ {
+ nautilus_window_slot_open_location_full (target_slot, location, flags, selection);
+ }
g_object_unref (location);
}
@@ -3099,3 +3114,70 @@ nautilus_window_search (NautilusWindow *window,
g_warning ("Trying search on a slot but no active slot present");
}
}
+
+/* Ideally, this method should be a simple wrapper for the slot method. However,
+ * going back or forward can result in a new slot (or another subclass), so we
+ * workaround that by duplicating part of nautilus_window_slot_back_or_forward()
+ */
+void
+nautilus_window_back_or_forward (NautilusWindow *window,
+ gboolean back,
+ guint distance,
+ NautilusWindowOpenFlags flags)
+{
+ NautilusWindowSlot *slot;
+ GList *next_location_list, *back_list, *forward_list;
+ GFile *next_location;
+ guint len;
+ NautilusBookmark *next_location_bookmark;
+ gboolean active_slot_handles_location;
+
+ slot = nautilus_window_get_active_slot (window);
+ back_list = nautilus_window_slot_get_back_history (slot);
+ forward_list = nautilus_window_slot_get_forward_history (slot);
+
+ next_location_list = back ? back_list : forward_list;
+
+ len = (guint) g_list_length (next_location_list);
+
+ /* If we can't move in the direction at all, just return. */
+ if (len == 0)
+ {
+ return;
+ }
+
+ /* If the distance to move is off the end of the list, go to the end
+ * of the list. */
+ if (distance >= len)
+ {
+ distance = len - 1;
+ }
+
+ next_location_bookmark = g_list_nth_data (next_location_list, distance);
+ next_location = nautilus_bookmark_get_location (next_location_bookmark);
+
+ active_slot_handles_location = nautilus_window_slot_handles_location (slot, next_location);
+
+ if (!active_slot_handles_location)
+ {
+ NautilusNavigationState *navigation_state;
+ NautilusLocationChangeType location_change_type;
+
+ navigation_state = nautilus_window_slot_get_navigation_state (slot);
+
+ location_change_type = back ? NAUTILUS_LOCATION_CHANGE_BACK : NAUTILUS_LOCATION_CHANGE_FORWARD;
+
+ slot = replace_active_slot (window, next_location, flags);
+
+ nautilus_window_slot_open_location_set_navigation_state (slot,
+ next_location, flags, NULL,
+ location_change_type,
+ navigation_state, distance);
+
+ free_navigation_state (navigation_state);
+ }
+ else
+ {
+ nautilus_window_slot_back_or_forward (slot, back, distance, flags);
+ }
+}
--
2.35.1

View File

@ -8,7 +8,7 @@
Name: nautilus
Version: 3.28.1
Release: 15%{?dist}
Release: 20%{?dist}
Summary: File manager for GNOME
License: GPLv3+
@ -69,6 +69,21 @@ Patch33: search-engine-tracker-Expand-macro-as-string.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1906499
Patch34: nautilus-file.c-Fix-open-writable-file-in-recent-tab.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=2068092
Patch35: window-Streamline-RestoreTabData-memory-management.patch
Patch36: window-slot-Rename-RestoreTabData-to-NautilusNavigat.patch
Patch37: window-window-slot-Save-and-restore-navigation-histo.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=2068089
Patch38: Add-actions-to-the-toolbar.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=2094431
Patch39: files-view-Add-menu-item-to-copy-current-path.patch
Patch40: files-view-Backport-translations.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=2106241
Patch41: nautilus-canvas-container-Remove-the-include-visible.patch
BuildRequires: gtk-doc
BuildRequires: meson
BuildRequires: gcc
@ -181,6 +196,21 @@ desktop-file-validate $RPM_BUILD_ROOT%{_datadir}/applications/*.desktop
%{_datadir}/gir-1.0/*.gir
%changelog
* Tue Aug 9 2022 Ondrej Holy <oholy@redhat.com> - 3.28.1-20
- Fix scrolling issues in the icon view on focus changes (#2106241)
* Fri Jul 29 2022 Ondrej Holy <oholy@redhat.com> - 3.28.1-19
- Fix the "Copy Location" action to copy just the plain path (#2094431)
* Mon Jun 20 2022 Ondrej Holy <oholy@redhat.com> - 3.28.1-18
- Add toolbar action to copy current location (#2094431)
* Mon Jun 6 2022 Ondrej Holy <oholy@redhat.com> - 3.28.1-17
- Add actions to the toolbar (#2068089)
* Wed Apr 13 2022 Ondrej Holy <oholy@redhat.com> - 3.28.1-16
- Save and restore navigation history when changing window slot (#2068092)
* Wed Jan 6 2021 Ondrej Holy <oholy@redhat.com> - 3.28.1-15
- Fix activation_uri handling to prevent invalid bookmarks (rhbz#1906499)