gpgme idle, Re: gpgme progress meter callback

Jacob Perkins jap1 at users.sourceforge.net
Sun Sep 8 19:30:01 CEST 2002


Yes, I saw the compiler warning, but I'm new to c and did not know how
to pass a function pointer.

Anyway, how does gpgme tell if it is idle?  I set an idle function with
register_idle, but it never seems to be called.  Is this feature not
completely supported yet, or do I need to do more with the I/O callback
interface?

gpgme_register_idle (idle);
...
void idle(){
	g_print ("idleing\n");
}

On Sat, 2002-09-07 at 18:05, Marcus Brinkmann wrote:
> On Sat, Sep 07, 2002 at 02:46:23PM -0500, Jacob Perkins wrote:
> > I'm confused about how to use the progess meter callback setup in gpgme.
> > How do I construct a GpgmeProgessCb and a HookValue?
> 
>  
> > Here's what I did, and it caused a segfault when I called
> > gpgme_op_generate:
> > 
> > GpgmeProgressCb *progfunc = "progress";	
> > gpgme_set_progress_cb (ctx, *progfunc, key_status);
> 
> Do you need a PROGFUNC variable?  This could be as simple as:
> 
> gpgme_set_progress_cb (ctx, progfunc, key_status);
> 
> Of course passing a string to a pointer to a function pointer is completely
> wrong.  I can not believe that you compiled this with -Wall and did not spot
> the compiler warning "initialization of incompatible pointer type".
>  
> > and then I have:
> > void
> > progress (gpointer status, gchar *what, gint type, gint current, gint
> > total){}
> 
> This is not too bad, but not strictly correct with the types.  The plethora
> of g* types are GTK+ (or GLib) types, but that is not what a GpgmeProgressCb
> is expected to take.  You should use this:
> 
> void progress (void *status, const char *what, int type, int current, int total);
> 
> and nothing else.  If you need a gpointer or gint, you can cast it to that
> later:
> 
> {
>   gpointer gstatus = (gpointer) status;
>   gchar *gwhat = (gchar *) what;
>   ...
> }
> 
> The gchar conversion might trigger a warning about dropping the const
> attribute.
> 
> Thanks,
> Marcus
> 
> 
> -- 
> `Rhubarb is no Egyptian god.' GNU      http://www.gnu.org    marcus at gnu.org
> Marcus Brinkmann              The Hurd http://www.gnu.org/software/hurd/
> Marcus.Brinkmann at ruhr-uni-bochum.de
> http://www.marcus-brinkmann.de/
> 
> _______________________________________________
> Gnupg-devel mailing list
> Gnupg-devel at gnupg.org
> http://lists.gnupg.org/mailman/listinfo/gnupg-devel
-- 
pub  1024D/57DDD9E3 2002-05-24 Jacob (Direct to Home)
<jap1 at rig.dyndns.ws>
Key fingerprint = 1E02 A5FD 8162 4322 C674  6E67 05EB 30F1 57DD D9E3




More information about the Gnupg-devel mailing list