[PINENTRY PATCH 1/8] gnome3: Set parent window.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Fri Nov 4 23:57:45 CET 2016


* gnome3/pinentry-gnome3.c (create_prompt): Tell Gcr about the caller
window, if we know it.

Signed-off-by: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
---
 gnome3/pinentry-gnome3.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/gnome3/pinentry-gnome3.c b/gnome3/pinentry-gnome3.c
index 90ff60f..1205300 100644
--- a/gnome3/pinentry-gnome3.c
+++ b/gnome3/pinentry-gnome3.c
@@ -75,6 +75,7 @@ create_prompt (pinentry_t pe, int confirm)
   GcrPrompt *prompt;
   GError *error = NULL;
   char *msg;
+  char window_id[32];
 
   /* Create the prompt.  */
   prompt = GCR_PROMPT (gcr_system_prompt_open (-1, NULL, &error));
@@ -145,8 +146,11 @@ create_prompt (pinentry_t pe, int confirm)
       /* XXX: Add support for the third option.  */
     }
 
-  /* XXX: gcr expects a string; we have a int.  */
-  // gcr_prompt_set_caller_window (prompt, pe->parent_wid);
+  /* gcr expects a string; we have a int.  see gcr's
+     ui/frob-system-prompt.c for example conversion using %lu */
+  snprintf(window_id, sizeof (window_id), "%lu", (long unsigned int)pe->parent_wid);
+  window_id[sizeof (window_id) - 1] = '\0';
+  gcr_prompt_set_caller_window (prompt, window_id);
 
 #ifdef HAVE_LIBSECRET
   if (! confirm && pe->allow_external_password_cache && pe->keyinfo)
-- 
2.10.1




More information about the Gnupg-devel mailing list