[nautilus/previewer-track-currently-open-file] nautilus-previewer: Only launch previewer when file URI changes
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/previewer-track-currently-open-file] nautilus-previewer: Only launch previewer when file URI changes
- Date: Tue, 25 May 2021 15:01:00 +0000 (UTC)
commit 805e7aec15c027837c1baf3912b55a635c04b1e0
Author: Felipe Borges <felipeborges gnome org>
Date: Tue May 25 16:56:09 2021 +0200
nautilus-previewer: Only launch previewer when file URI changes
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
src/nautilus-previewer.c | 11 +++++++++++
1 file changed, 11 insertions(+)
---
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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]