gnome-control-center/0001-sharing-Remember-the-password-on-remote-desktop-shar.patch

67 lines
2.7 KiB
Diff

From 718426652881a9e0cb1ddffb0af0f58128396a23 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Tue, 11 Feb 2020 19:10:15 +0100
Subject: [PATCH] sharing: Remember the password on remote desktop sharing
If we are going through mutter's RemoteDesktop interface, we don't
seemingly remember the password set. Add support for reading it
from secrets and change the entry password on dialog construction,
to bring it on par with our vino handling.
---
panels/sharing/cc-gnome-remote-desktop.c | 16 ++++++++++++++++
panels/sharing/cc-gnome-remote-desktop.h | 2 ++
panels/sharing/cc-sharing-panel.c | 2 ++
3 files changed, 20 insertions(+)
diff --git a/panels/sharing/cc-gnome-remote-desktop.c b/panels/sharing/cc-gnome-remote-desktop.c
index 8420fddca..599467fb4 100644
--- a/panels/sharing/cc-gnome-remote-desktop.c
+++ b/panels/sharing/cc-gnome-remote-desktop.c
@@ -169,3 +169,19 @@ cc_grd_on_vnc_password_entry_notify_text (GtkEntry *entry,
cancellable, on_password_stored, entry,
NULL);
}
+
+void
+cc_grd_update_password_entry (GtkEntry *entry)
+{
+ g_autoptr(GError) error = NULL;
+ g_autofree gchar *password = NULL;
+
+ password = secret_password_lookup_sync (CC_GRD_VNC_PASSWORD_SCHEMA,
+ NULL, &error,
+ NULL);
+ if (error)
+ g_critical ("Failed to get password: %s", error->message);
+
+ if (password)
+ gtk_entry_set_text (entry, password);
+}
diff --git a/panels/sharing/cc-gnome-remote-desktop.h b/panels/sharing/cc-gnome-remote-desktop.h
index 2a4819986..1f83e2dd6 100644
--- a/panels/sharing/cc-gnome-remote-desktop.h
+++ b/panels/sharing/cc-gnome-remote-desktop.h
@@ -46,4 +46,6 @@ void cc_grd_on_vnc_password_entry_notify_text (GtkEntry *entry,
GParamSpec *pspec,
gpointer user_data);
+void cc_grd_update_password_entry (GtkEntry *entry);
+
#endif /* CC_GNOME_REMOTE_DESKTOP_H */
diff --git a/panels/sharing/cc-sharing-panel.c b/panels/sharing/cc-sharing-panel.c
index ab22f5df8..17ecdb11a 100644
--- a/panels/sharing/cc-sharing-panel.c
+++ b/panels/sharing/cc-sharing-panel.c
@@ -1106,6 +1106,8 @@ cc_sharing_panel_setup_screen_sharing_dialog_gnome_remote_desktop (CcSharingPane
g_signal_connect (priv->screen_sharing_dialog, "hide",
G_CALLBACK (screen_sharing_hide_cb), self);
+ cc_grd_update_password_entry (WID ("remote-control-password-entry"));
+
/* accept at most 8 bytes in password entry */
g_signal_connect (WID ("remote-control-password-entry"), "insert-text",
G_CALLBACK (screen_sharing_password_insert_text_cb), self);
--
2.24.1