diff options
author | Felipe Borges <felipeborges@gnome.org> | 2021-05-25 16:56:09 +0200 |
---|---|---|
committer | Felipe Borges <felipeborges@gnome.org> | 2021-05-25 16:56:09 +0200 |
commit | 805e7aec15c027837c1baf3912b55a635c04b1e0 (patch) | |
tree | c935a0f2989511f8d693db31b13b5c822ab4b0a4 /src/nautilus-previewer.c | |
parent | c10cd96379860d243e6b17775a36c86c455c2cb7 (diff) | |
download | nautilus-805e7aec15c027837c1baf3912b55a635c04b1e0.tar.gz |
nautilus-previewer: Only launch previewer when file URI changespreviewer-track-currently-open-file
There's a race condition for when Nautilus checks for Sushi's
"Visible" property and decides whether a selection change should
update the previewed file.
By avoiding calling Sushi when the selected file is the same as
the last one previewed, we can workaround the race condition.
Fixes #1823
Diffstat (limited to 'src/nautilus-previewer.c')
-rw-r--r-- | src/nautilus-previewer.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/nautilus-previewer.c b/src/nautilus-previewer.c index 66074ab93..4ab2e2d02 100644 --- a/src/nautilus-previewer.c +++ b/src/nautilus-previewer.c @@ -38,6 +38,7 @@ #define PREVIEWER_DBUS_PATH "/org/gnome/NautilusPreviewer" static GDBusProxy *previewer_v2_proxy = NULL; +static char *current_file_uri = NULL; static gboolean ensure_previewer_v2_proxy (void) @@ -88,6 +89,16 @@ nautilus_previewer_call_show_file (const gchar *uri, guint xid, gboolean close_if_already_visible) { + + if (current_file_uri != NULL && g_strcmp0 (current_file_uri, uri) == 0) + { + g_free (current_file_uri); + current_file_uri = NULL; + + return; + } + + current_file_uri = g_strdup (uri); if (!ensure_previewer_v2_proxy ()) { return; |