No subject
     
    
       
    Tue Oct  7 21:23:11 CEST 2003
    
    
  
static const char *
passphrase_cb (void *opaque, const char *desc, void *r_hd)
{
    struct passphrase_cb_info_s *info = opaque;
    GpgmeCtx ctx = info ? info->c : NULL;
    const char *pass;
    if (!desc) {
        /* FIXME: cleanup by looking at *r_hd */
        return NULL;
    }
    g_message ("%% requesting passphrase for `%s': ", desc );
    pass = gpgmegtk_passphrase_mbox (desc);
    if (!pass) {
        g_message ("%% cancel passphrase entry");
        gpgme_cancel (ctx);
    }
    else
        g_message ("%% sending passphrase");
    return pass;
}
Somewhere in gpgmegtk_passphrase_mbox the window is created and the
displayed prompt varied by looking at the first line of the
description (TRY_AGAIN)
static GtkWidget *
create_description (const gchar *desc)
{
    const gchar *cmd=NULL, *uid=NULL, *info=NULL;
    gchar *buf;
    GtkWidget *label;
    cmd = desc;
    uid = strchr (cmd, '\n');
    if (uid) {
        info = strchr (++uid, '\n');
        if (info )
            info++;
    }
    if (!uid)
        uid = _("[no user id]");
    if (!info)
        info = "";
    buf = g_strdup_printf (_("%sPlease enter the passphrase for:\n\n"
                           "  %.*s  \n"
                           "(%.*s)\n"),
                           !strncmp (cmd, "TRY_AGAIN", 9 ) ?
                           _("Bad passphrase! Try again...\n\n") : "",
                           linelen (uid), uid, linelen (info), info);
    label = gtk_label_new (buf);
    g_free (buf);
    return label;
}
-- 
Werner Koch        Omnis enim res, quae dando non deficit, dum habetur
g10 Code GmbH      et non datur, nondum habetur, quomodo habenda est.
Privacy Solutions                                        -- Augustinus
    
    
More information about the Gnupg-devel
mailing list